mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
Merge pull request #763 from MihailRis/fix-selectbox
close selectbox popup on second click
This commit is contained in:
commit
97d2623a06
1 changed files with 5 additions and 1 deletions
|
|
@ -21,7 +21,8 @@ SelectBox::SelectBox(
|
|||
|
||||
listenAction(UIAction::CLICK, [this](GUI& gui) {
|
||||
auto panel = std::make_shared<Panel>(gui, getSize());
|
||||
panel->setPos(calcPos() + glm::vec2(0, size.y));
|
||||
panel->setPadding(glm::vec4(0, size.y, 0, 0));
|
||||
panel->setPos(calcPos() + glm::vec2(0, 0));
|
||||
for (const auto& option : this->options) {
|
||||
auto button = std::make_shared<Button>(
|
||||
gui, option.text, glm::vec4(10.0f), nullptr, glm::vec2(-1.0f)
|
||||
|
|
@ -37,6 +38,9 @@ SelectBox::SelectBox(
|
|||
panel->listenAction(UIAction::DEFOCUS, [panel=panel.get()](GUI& gui) {
|
||||
gui.remove(panel);
|
||||
});
|
||||
panel->listenAction(UIAction::CLICK, [panel=panel.get()](GUI& gui) {
|
||||
gui.remove(panel);
|
||||
});
|
||||
gui.add(panel);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue