Browse Source

Don't re-adjust module positions based on patch bounding box when serializing RackWidget.

tags/v2.1.0
Andrew Belt 2 years ago
parent
commit
7032be4725
1 changed files with 1 additions and 7 deletions
  1. +1
    -7
      src/app/RackWidget.cpp

+ 1
- 7
src/app/RackWidget.cpp View File

@@ -273,12 +273,6 @@ static void RackWidget_updateExpanders(RackWidget* that) {
}

void RackWidget::mergeJson(json_t* rootJ) {
// Get module offset so modules are aligned to (0, 0) when the patch is loaded.
math::Vec moduleOffset = internal->moduleContainer->getChildrenBoundingBox().pos;
if (!moduleOffset.isFinite()) {
moduleOffset = RACK_OFFSET;
}

// modules
json_t* modulesJ = json_object_get(rootJ, "modules");
if (!modulesJ)
@@ -299,7 +293,7 @@ void RackWidget::mergeJson(json_t* rootJ) {
}

// pos
math::Vec pos = mw->box.pos.minus(moduleOffset);
math::Vec pos = mw->box.pos.minus(RACK_OFFSET);
pos = pos.div(RACK_GRID_SIZE).round();
json_t* posJ = json_pack("[i, i]", (int) pos.x, (int) pos.y);
json_object_set_new(moduleJ, "pos", posJ);


Loading…
Cancel
Save