From af26bd1eebda843e8abdd5560eb4a796d40a6713 Mon Sep 17 00:00:00 2001 From: Skyler Lehmkuhl Date: Fri, 6 Dec 2024 01:19:14 -0500 Subject: [PATCH] delete shapes --- src/main.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main.js b/src/main.js index a5a14a7..c6fb60b 100644 --- a/src/main.js +++ b/src/main.js @@ -366,14 +366,19 @@ let actions = { } }, deleteObjects: { - create: (objects) => { + create: (objects, shapes) => { redoStack.length = 0 let serializableObjects = [] + let serializableShapes = [] for (let object of objects) { serializableObjects.push(object.idx) } + for (let shape of shapes) { + serializableShapes.push(shape.idx) + } let action = { objects: serializableObjects, + shapes: serializableShapes, frame: context.activeObject.currentFrame.idx, oldState: structuredClone(context.activeObject.currentFrame.keys) } @@ -386,6 +391,9 @@ let actions = { for (let object of action.objects) { delete frame.keys[object] } + for (let shape of action.shapes) { + frame.shapes.splice(frame.shapes.indexOf(pointerList[shape]),1) + } updateUI() }, rollback: (action) => { @@ -393,6 +401,9 @@ let actions = { for (let object of action.objects) { frame.keys[object] = action.oldState[object] } + for (let shape of action.shapes) { + frame.shapes.push(pointerList[shape]) + } updateUI() } }, @@ -2097,8 +2108,8 @@ function paste() { } function delete_action() { - if (context.selection) { - actions.deleteObjects.create(context.selection) + if (context.selection.length || context.shapeselection.length) { + actions.deleteObjects.create(context.selection, context.shapeselection) context.selection = [] } updateUI()