Browse Source

Fixed onHoverKey traversal

tags/v0.4.0
Andrew Belt 7 years ago
parent
commit
0d24d6926d
2 changed files with 12 additions and 8 deletions
  1. +11
    -4
      src/app/ModuleWidget.cpp
  2. +1
    -4
      src/app/RackScene.cpp

+ 11
- 4
src/app/ModuleWidget.cpp View File

@@ -168,19 +168,26 @@ Widget *ModuleWidget::onMouseMove(Vec pos, Vec mouseRel) {
Widget *ModuleWidget::onHoverKey(Vec pos, int key) { Widget *ModuleWidget::onHoverKey(Vec pos, int key) {
switch (key) { switch (key) {
case GLFW_KEY_I: case GLFW_KEY_I:
if (guiIsModPressed() && !guiIsShiftPressed())
if (guiIsModPressed() && !guiIsShiftPressed()) {
initialize(); initialize();
return this;
}
break; break;
case GLFW_KEY_R: case GLFW_KEY_R:
if (guiIsModPressed() && !guiIsShiftPressed())
if (guiIsModPressed() && !guiIsShiftPressed()) {
randomize(); randomize();
return this;
}
break; break;
case GLFW_KEY_D: case GLFW_KEY_D:
if (guiIsModPressed() && !guiIsShiftPressed())
if (guiIsModPressed() && !guiIsShiftPressed()) {
gRackWidget->cloneModule(this); gRackWidget->cloneModule(this);
return this;
}
break; break;
} }
return this;

return Widget::onHoverKey(pos, key);
} }


void ModuleWidget::onDragStart() { void ModuleWidget::onDragStart() {


+ 1
- 4
src/app/RackScene.cpp View File

@@ -73,9 +73,6 @@ void RackScene::draw(NVGcontext *vg) {
} }


Widget *RackScene::onHoverKey(Vec pos, int key) { Widget *RackScene::onHoverKey(Vec pos, int key) {
Widget *w = Widget::onHoverKey(pos, key);
if (w) return w;

switch (key) { switch (key) {
case GLFW_KEY_N: case GLFW_KEY_N:
if (guiIsModPressed() && !guiIsShiftPressed()) { if (guiIsModPressed() && !guiIsShiftPressed()) {
@@ -107,7 +104,7 @@ Widget *RackScene::onHoverKey(Vec pos, int key) {
break; break;
} }


return NULL;
return Widget::onHoverKey(pos, key);
} }






Loading…
Cancel
Save