Skip to content

Commit

Permalink
Don't delete inset-ROI on inset delete if insets remain
Browse files Browse the repository at this point in the history
  • Loading branch information
will-moore committed Nov 28, 2024
1 parent 1dfb138 commit a863f15
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/js/models/panel_model.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,12 @@
// delete or update the "inset" Rectangle
let updated = this.get('shapes');
if (panelDeleted) {
updated = updated.filter(shape => shape.id != insetRoiId);
// Delete the inset Rectangle IF there are NO other remaining insets
let insets = figureModel.panels.filter(p => p.get('insetRoiId') == insetRoiId);
if (insets.length == 0) {
updated = updated.filter(shape => shape.id != insetRoiId);
}
this.save('shapes', updated);
} else {
let rect = panel.getViewportAsRect();
updated = updated.map(shape => {
Expand All @@ -111,8 +116,8 @@
}
return shape;
});
this.save('shapes', updated);
}
this.save('shapes', updated);
this.silenceTriggers = false;
}
}
Expand Down

0 comments on commit a863f15

Please sign in to comment.