delete shapes
This commit is contained in:
parent
ab59209da5
commit
af26bd1eeb
17
src/main.js
17
src/main.js
|
|
@ -366,14 +366,19 @@ let actions = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
deleteObjects: {
|
deleteObjects: {
|
||||||
create: (objects) => {
|
create: (objects, shapes) => {
|
||||||
redoStack.length = 0
|
redoStack.length = 0
|
||||||
let serializableObjects = []
|
let serializableObjects = []
|
||||||
|
let serializableShapes = []
|
||||||
for (let object of objects) {
|
for (let object of objects) {
|
||||||
serializableObjects.push(object.idx)
|
serializableObjects.push(object.idx)
|
||||||
}
|
}
|
||||||
|
for (let shape of shapes) {
|
||||||
|
serializableShapes.push(shape.idx)
|
||||||
|
}
|
||||||
let action = {
|
let action = {
|
||||||
objects: serializableObjects,
|
objects: serializableObjects,
|
||||||
|
shapes: serializableShapes,
|
||||||
frame: context.activeObject.currentFrame.idx,
|
frame: context.activeObject.currentFrame.idx,
|
||||||
oldState: structuredClone(context.activeObject.currentFrame.keys)
|
oldState: structuredClone(context.activeObject.currentFrame.keys)
|
||||||
}
|
}
|
||||||
|
|
@ -386,6 +391,9 @@ let actions = {
|
||||||
for (let object of action.objects) {
|
for (let object of action.objects) {
|
||||||
delete frame.keys[object]
|
delete frame.keys[object]
|
||||||
}
|
}
|
||||||
|
for (let shape of action.shapes) {
|
||||||
|
frame.shapes.splice(frame.shapes.indexOf(pointerList[shape]),1)
|
||||||
|
}
|
||||||
updateUI()
|
updateUI()
|
||||||
},
|
},
|
||||||
rollback: (action) => {
|
rollback: (action) => {
|
||||||
|
|
@ -393,6 +401,9 @@ let actions = {
|
||||||
for (let object of action.objects) {
|
for (let object of action.objects) {
|
||||||
frame.keys[object] = action.oldState[object]
|
frame.keys[object] = action.oldState[object]
|
||||||
}
|
}
|
||||||
|
for (let shape of action.shapes) {
|
||||||
|
frame.shapes.push(pointerList[shape])
|
||||||
|
}
|
||||||
updateUI()
|
updateUI()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -2097,8 +2108,8 @@ function paste() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function delete_action() {
|
function delete_action() {
|
||||||
if (context.selection) {
|
if (context.selection.length || context.shapeselection.length) {
|
||||||
actions.deleteObjects.create(context.selection)
|
actions.deleteObjects.create(context.selection, context.shapeselection)
|
||||||
context.selection = []
|
context.selection = []
|
||||||
}
|
}
|
||||||
updateUI()
|
updateUI()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue