fix a few errors

This commit is contained in:
Skyler Lehmkuhl 2025-01-23 05:23:26 -05:00
parent f88c1f1408
commit 139aedd5de
1 changed files with 30 additions and 23 deletions

View File

@ -93,7 +93,7 @@ function forwardConsole(fnName, dest) {
const stackLines = error.stack.split("\n"); const stackLines = error.stack.split("\n");
let message = args.join(" "); // Join all arguments into a single string let message = args.join(" "); // Join all arguments into a single string
const location = stackLines[1].match(/([a-zA-Z0-9_-]+\.js:\d+)/); const location = stackLines.length>1 ? stackLines[1].match(/([a-zA-Z0-9_-]+\.js:\d+)/) : stackLines.toString();
if (fnName === "error") { if (fnName === "error") {
// Send the full stack trace for errors // Send the full stack trace for errors
@ -1322,12 +1322,14 @@ let actions = {
for (let frameObj of action.selectedFrames) { for (let frameObj of action.selectedFrames) {
let layer = object.layers[frameObj.layer]; let layer = object.layers[frameObj.layer];
let frame = layer.frames[frameObj.frameNum]; let frame = layer.frames[frameObj.frameNum];
frameBuffer.push({ if (frameObj) {
frame: frame, frameBuffer.push({
frameNum: frameObj.frameNum, frame: frame,
layer: frameObj.layer, frameNum: frameObj.frameNum,
}); layer: frameObj.layer,
layer.deleteFrame(frame.idx, undefined, frameObj.replacementUuid); });
layer.deleteFrame(frame.idx, undefined, frameObj.replacementUuid);
}
} }
for (let frameObj of frameBuffer) { for (let frameObj of frameBuffer) {
const layer_idx = frameObj.layer + action.offset.layers; const layer_idx = frameObj.layer + action.offset.layers;
@ -1443,6 +1445,7 @@ let actions = {
let serializableShapes = []; let serializableShapes = [];
let serializableObjects = []; let serializableObjects = [];
let bbox; let bbox;
const frame = context.activeObject.currentFrame
for (let shape of context.shapeselection) { for (let shape of context.shapeselection) {
serializableShapes.push(shape.idx); serializableShapes.push(shape.idx);
if (bbox == undefined) { if (bbox == undefined) {
@ -1452,12 +1455,14 @@ let actions = {
} }
} }
for (let object of context.selection) { for (let object of context.selection) {
serializableObjects.push(object.idx); if (object.idx in frame.keys) {
// TODO: rotated bbox serializableObjects.push(object.idx);
if (bbox == undefined) { // TODO: rotated bbox
bbox = object.bbox(); if (bbox == undefined) {
} else { bbox = object.bbox();
growBoundingBox(bbox, object.bbox()); } else {
growBoundingBox(bbox, object.bbox());
}
} }
} }
context.shapeselection = []; context.shapeselection = [];
@ -1467,7 +1472,7 @@ let actions = {
objects: serializableObjects, objects: serializableObjects,
groupUuid: uuidv4(), groupUuid: uuidv4(),
parent: context.activeObject.idx, parent: context.activeObject.idx,
frame: context.activeObject.currentFrame.idx, frame: frame.idx,
layer: context.activeObject.activeLayer.idx, layer: context.activeObject.activeLayer.idx,
position: { position: {
x: (bbox.x.min + bbox.x.max) / 2, x: (bbox.x.min + bbox.x.max) / 2,
@ -2632,14 +2637,14 @@ class Layer extends Widget {
ctx.setTransform(transform) ctx.setTransform(transform)
} }
} }
} if (this.activeShape) {
if (this.activeShape) { this.activeShape.draw(cxt)
this.activeShape.draw(cxt) }
} if (context.activeCurve) {
if (context.activeCurve) { if (frame.shapes.indexOf(context.activeCurve.shape) != -1) {
if (frame.shapes.indexOf(context.activeCurve.shape) != -1) { cxt.selected = true
cxt.selected = true
}
} }
} }
} }
@ -4111,7 +4116,9 @@ class GraphicsObject extends Widget {
for (let layer of this.layers) { for (let layer of this.layers) {
layer.children = layer.children.filter(child => child.idx !== idx); layer.children = layer.children.filter(child => child.idx !== idx);
for (let frame of layer.frames) { for (let frame of layer.frames) {
delete frame[idx]; if (frame) {
delete frame[idx];
}
} }
} }
// this.children.splice(this.children.indexOf(childObject), 1); // this.children.splice(this.children.indexOf(childObject), 1);
@ -8368,4 +8375,4 @@ if (window.openedFiles?.length>0) {
for (let i=1; i<window.openedFiles.length; i++) { for (let i=1; i<window.openedFiles.length; i++) {
newWindow(window.openedFiles[i]) newWindow(window.openedFiles[i])
} }
} }