Browse Source

Delete MenuOverlay on mouse down

tags/v0.6.0
Andrew Belt 7 years ago
parent
commit
c336e67577
2 changed files with 5 additions and 3 deletions
  1. +1
    -1
      include/widgets.hpp
  2. +4
    -2
      src/widgets/MenuOverlay.cpp

+ 1
- 1
include/widgets.hpp View File

@@ -295,7 +295,7 @@ struct Label : Widget {
/** Deletes itself from parent when clicked */
struct MenuOverlay : OpaqueWidget {
void step() override;
void onDragDrop(EventDragDrop &e) override;
void onMouseDown(EventMouseDown &e) override;
void onHoverKey(EventHoverKey &e) override;
};



+ 4
- 2
src/widgets/MenuOverlay.cpp View File

@@ -13,10 +13,12 @@ void MenuOverlay::step() {
}
}

void MenuOverlay::onDragDrop(EventDragDrop &e) {
if (e.origin == this) {
void MenuOverlay::onMouseDown(EventMouseDown &e) {
Widget::onMouseDown(e);
if (!e.consumed) {
// deletes `this`
gScene->setOverlay(NULL);
e.consumed = true;
}
}



Loading…
Cancel
Save