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");
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") {
// Send the full stack trace for errors
@ -1322,12 +1322,14 @@ let actions = {
for (let frameObj of action.selectedFrames) {
let layer = object.layers[frameObj.layer];
let frame = layer.frames[frameObj.frameNum];
frameBuffer.push({
frame: frame,
frameNum: frameObj.frameNum,
layer: frameObj.layer,
});
layer.deleteFrame(frame.idx, undefined, frameObj.replacementUuid);
if (frameObj) {
frameBuffer.push({
frame: frame,
frameNum: frameObj.frameNum,
layer: frameObj.layer,
});
layer.deleteFrame(frame.idx, undefined, frameObj.replacementUuid);
}
}
for (let frameObj of frameBuffer) {
const layer_idx = frameObj.layer + action.offset.layers;
@ -1443,6 +1445,7 @@ let actions = {
let serializableShapes = [];
let serializableObjects = [];
let bbox;
const frame = context.activeObject.currentFrame
for (let shape of context.shapeselection) {
serializableShapes.push(shape.idx);
if (bbox == undefined) {
@ -1452,12 +1455,14 @@ let actions = {
}
}
for (let object of context.selection) {
serializableObjects.push(object.idx);
// TODO: rotated bbox
if (bbox == undefined) {
bbox = object.bbox();
} else {
growBoundingBox(bbox, object.bbox());
if (object.idx in frame.keys) {
serializableObjects.push(object.idx);
// TODO: rotated bbox
if (bbox == undefined) {
bbox = object.bbox();
} else {
growBoundingBox(bbox, object.bbox());
}
}
}
context.shapeselection = [];
@ -1467,7 +1472,7 @@ let actions = {
objects: serializableObjects,
groupUuid: uuidv4(),
parent: context.activeObject.idx,
frame: context.activeObject.currentFrame.idx,
frame: frame.idx,
layer: context.activeObject.activeLayer.idx,
position: {
x: (bbox.x.min + bbox.x.max) / 2,
@ -2632,14 +2637,14 @@ class Layer extends Widget {
ctx.setTransform(transform)
}
}
}
if (this.activeShape) {
this.activeShape.draw(cxt)
}
if (context.activeCurve) {
if (frame.shapes.indexOf(context.activeCurve.shape) != -1) {
cxt.selected = true
if (this.activeShape) {
this.activeShape.draw(cxt)
}
if (context.activeCurve) {
if (frame.shapes.indexOf(context.activeCurve.shape) != -1) {
cxt.selected = true
}
}
}
}
@ -4111,7 +4116,9 @@ class GraphicsObject extends Widget {
for (let layer of this.layers) {
layer.children = layer.children.filter(child => child.idx !== idx);
for (let frame of layer.frames) {
delete frame[idx];
if (frame) {
delete frame[idx];
}
}
}
// 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++) {
newWindow(window.openedFiles[i])
}
}
}