Browse Source

Place cloned module directly to the right of the original module.

tags/v2.1.1
Andrew Belt 2 years ago
parent
commit
92d3196ac0
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      src/app/ModuleWidget.cpp

+ 5
- 1
src/app/ModuleWidget.cpp View File

@@ -827,7 +827,11 @@ void ModuleWidget::cloneAction(bool cloneCables) {
INFO("Creating module widget %s", model->getFullName().c_str());
ModuleWidget* clonedModuleWidget = model->createModuleWidget(clonedModule);
APP->scene->rack->updateModuleOldPositions();
APP->scene->rack->addModuleAtMouse(clonedModuleWidget);
APP->scene->rack->addModule(clonedModuleWidget);
// Place module to the right of `this` module, by forcing it to 1 HP to the right.
math::Vec clonedPos = box.pos + math::Vec(RACK_GRID_WIDTH, 0);
clonedModuleWidget->box.pos = clonedPos;
APP->scene->rack->setModulePosForce(clonedModuleWidget, clonedPos);
h->push(APP->scene->rack->getModuleDragAction());

// history::ModuleAdd


Loading…
Cancel
Save