fix(layers): deleting a non-empty layer warns and removes its objects (#237)

Deleting a layer only dropped the layer record, leaving its objects in the
file still tagged with the (now-gone) layer name. Now:

- Empty layer → deleted straight away.
- Non-empty layer → a warning modal ("Layer X is not empty — N objects;
  deleting also removes them. Continue?") with Delete Objects / Cancel.
  Confirming erases every object on the layer, then removes the layer, as
  one undo step. The layer record is dropped before the erase so the
  locked-layer guard can't keep its objects.
- Layer "0" and the current layer can't be deleted (reported on the
  command line) instead of silently leaving a broken state.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-07-01 17:23:32 +03:00
1 parent e3d1780a69
commit 2712bb80e4
5 files changed
+146 -17

No files matched your search

+1
View File
@@ -1370,6 +1370,7 @@ impl OpenCADStudio {
SaveDialog => (560, 480),
PointStyle => (360, 470),
AttributeEditor => (640, 500),
LayerDeleteWarning => (440, 200),
};
Some((w as f32 + EXTRA_W, h as f32 + EXTRA_H))
}