Browse Source

Set BlankWidget width before it is added to the RackWidget, so it doesn't unnecessarily shove other modules.

tags/v2.0.4
Andrew Belt 2 years ago
parent
commit
ac853905cc
1 changed files with 9 additions and 2 deletions
  1. +9
    -2
      src/core/Blank.cpp

+ 9
- 2
src/core/Blank.cpp View File

@@ -147,6 +147,11 @@ struct BlankWidget : ModuleWidget {
bottomRightScrew = createWidget<ScrewSilver>(Vec(box.size.x - 30, 365));
addChild(topRightScrew);
addChild(bottomRightScrew);

// Set box width from loaded Module before adding to the RackWidget, so modules aren't unnecessarily shoved around.
if (module) {
box.size.x = module->width * RACK_GRID_WIDTH;
}
}

void step() override {
@@ -159,10 +164,12 @@ struct BlankWidget : ModuleWidget {
topRightScrew->box.pos.x = box.size.x - 30;
bottomRightScrew->box.pos.x = box.size.x - 30;
if (box.size.x < RACK_GRID_WIDTH * 6) {
topRightScrew->visible = bottomRightScrew->visible = false;
topRightScrew->hide();
bottomRightScrew->hide();
}
else {
topRightScrew->visible = bottomRightScrew->visible = true;
topRightScrew->show();
bottomRightScrew->show();
}
rightHandle->box.pos.x = box.size.x - rightHandle->box.size.x;
ModuleWidget::step();


Loading…
Cancel
Save