fix import from earlier versions

This commit is contained in:
Skyler Lehmkuhl 2025-01-04 00:20:11 -05:00
parent 35ce690f22
commit 6223d6c50d
1 changed files with 13 additions and 1 deletions

View File

@ -1085,6 +1085,7 @@ let actions = {
}, },
execute: (action) => { execute: (action) => {
let frame = pointerList[action.frame]; let frame = pointerList[action.frame];
if (frame == undefined) return;
frame.keys = structuredClone(action.newState); frame.keys = structuredClone(action.newState);
updateUI(); updateUI();
}, },
@ -1189,6 +1190,7 @@ let actions = {
let action = { let action = {
frame: frame.idx, frame: frame.idx,
layer: layer.idx, layer: layer.idx,
replacementUuid: uuidv4(),
}; };
undoStack.push({ name: "deleteFrame", action: action }); undoStack.push({ name: "deleteFrame", action: action });
actions.deleteFrame.execute(action); actions.deleteFrame.execute(action);
@ -1196,7 +1198,11 @@ let actions = {
}, },
execute: (action) => { execute: (action) => {
let layer = pointerList[action.layer]; let layer = pointerList[action.layer];
layer.deleteFrame(action.frame); layer.deleteFrame(
action.frame,
undefined,
action.replacementUuid ? action.replacementUuid : uuidv4(),
);
updateLayers(); updateLayers();
updateUI(); updateUI();
}, },
@ -2334,6 +2340,7 @@ class Layer {
this.addFrame(num, newKeyframe, addedFrames); this.addFrame(num, newKeyframe, addedFrames);
} }
deleteFrame(uuid, destinationType, replacementUuid) { deleteFrame(uuid, destinationType, replacementUuid) {
console.log(replacementUuid);
let frame = pointerList[uuid]; let frame = pointerList[uuid];
let i = this.frames.indexOf(frame); let i = this.frames.indexOf(frame);
if (i != -1) { if (i != -1) {
@ -3782,6 +3789,10 @@ async function _open(path, returnJson = false) {
if (key in objectOffsets) { if (key in objectOffsets) {
action.action.newState[key].x += objectOffsets[key].x; action.action.newState[key].x += objectOffsets[key].x;
action.action.newState[key].y += objectOffsets[key].y; action.action.newState[key].y += objectOffsets[key].y;
}
}
for (let key in action.action.oldState) {
if (key in objectOffsets) {
action.action.oldState[key].x += objectOffsets[key].x; action.action.oldState[key].x += objectOffsets[key].x;
action.action.oldState[key].y += objectOffsets[key].y; action.action.oldState[key].y += objectOffsets[key].y;
} }
@ -5012,6 +5023,7 @@ function stage() {
context.dragDirection = undefined; context.dragDirection = undefined;
context.selectionRect = undefined; context.selectionRect = undefined;
let mouse = getMousePos(stage, e); let mouse = getMousePos(stage, e);
mouse = context.activeObject.transformMouse(mouse);
modeswitcher: switch (mode) { modeswitcher: switch (mode) {
case "select": case "select":
for (let i = context.activeObject.children.length - 1; i >= 0; i--) { for (let i = context.activeObject.children.length - 1; i >= 0; i--) {