Browse Source

Clean up MenuOverlay

tags/v1.0.0
Andrew Belt 6 years ago
parent
commit
5d64ca1de7
2 changed files with 10 additions and 17 deletions
  1. +10
    -13
      include/ui/MenuOverlay.hpp
  2. +0
    -4
      src/app/RackWidget.cpp

+ 10
- 13
include/ui/MenuOverlay.hpp View File

@@ -9,8 +9,6 @@ namespace rack {
/** Deletes itself from parent when clicked */
struct MenuOverlay : OpaqueWidget {
void step() override {
Widget::step();

// Adopt parent's size
box.size = parent->box.size;

@@ -18,27 +16,26 @@ struct MenuOverlay : OpaqueWidget {
for (Widget *child : children) {
child->box = child->box.nudge(box.zeroPos());
}

Widget::step();
}

void onButton(event::Button &e) override {
Widget::onButton(e);
OpaqueWidget::onButton(e);

if (!e.target) {
e.target = this;
if (e.target == this && e.action == GLFW_PRESS && e.button == GLFW_MOUSE_BUTTON_LEFT) {
requestedDelete = true;
}
}

void onHoverKey(event::HoverKey &e) override {
switch (e.key) {
case GLFW_KEY_ESCAPE: {
e.target = this;
requestedDelete = true;
return;
} break;
}
OpaqueWidget::onHoverKey(e);

Widget::onHoverKey(e);
if (e.target == this && e.action == GLFW_PRESS && e.key == GLFW_KEY_ESCAPE) {
e.target = this;
requestedDelete = true;
return;
}
}
};



+ 0
- 4
src/app/RackWidget.cpp View File

@@ -503,13 +503,9 @@ void RackWidget::onHover(event::Hover &e) {
}

void RackWidget::onButton(event::Button &e) {
DEBUG("1");
OpaqueWidget::onButton(e);
DEBUG("2");
if (e.target == this) {
DEBUG("3");
if (e.action == GLFW_PRESS && e.button == GLFW_MOUSE_BUTTON_RIGHT) {
DEBUG("4");
appModuleBrowserCreate();
}
}


Loading…
Cancel
Save