fix a few errors
This commit is contained in:
parent
f88c1f1408
commit
139aedd5de
13
src/main.js
13
src/main.js
|
|
@ -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,6 +1322,7 @@ 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];
|
||||||
|
if (frameObj) {
|
||||||
frameBuffer.push({
|
frameBuffer.push({
|
||||||
frame: frame,
|
frame: frame,
|
||||||
frameNum: frameObj.frameNum,
|
frameNum: frameObj.frameNum,
|
||||||
|
|
@ -1329,6 +1330,7 @@ let actions = {
|
||||||
});
|
});
|
||||||
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;
|
||||||
let layer = object.layers[layer_idx];
|
let layer = object.layers[layer_idx];
|
||||||
|
|
@ -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,6 +1455,7 @@ let actions = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (let object of context.selection) {
|
for (let object of context.selection) {
|
||||||
|
if (object.idx in frame.keys) {
|
||||||
serializableObjects.push(object.idx);
|
serializableObjects.push(object.idx);
|
||||||
// TODO: rotated bbox
|
// TODO: rotated bbox
|
||||||
if (bbox == undefined) {
|
if (bbox == undefined) {
|
||||||
|
|
@ -1460,6 +1464,7 @@ let actions = {
|
||||||
growBoundingBox(bbox, object.bbox());
|
growBoundingBox(bbox, object.bbox());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
context.shapeselection = [];
|
context.shapeselection = [];
|
||||||
context.selection = [];
|
context.selection = [];
|
||||||
let action = {
|
let action = {
|
||||||
|
|
@ -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,7 +2637,6 @@ class Layer extends Widget {
|
||||||
ctx.setTransform(transform)
|
ctx.setTransform(transform)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (this.activeShape) {
|
if (this.activeShape) {
|
||||||
this.activeShape.draw(cxt)
|
this.activeShape.draw(cxt)
|
||||||
}
|
}
|
||||||
|
|
@ -2643,6 +2647,7 @@ class Layer extends Widget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
bbox() {
|
bbox() {
|
||||||
let bbox = super.bbox()
|
let bbox = super.bbox()
|
||||||
const frameInfo = this.getFrameValue(this.frameNum);
|
const frameInfo = this.getFrameValue(this.frameNum);
|
||||||
|
|
@ -4111,9 +4116,11 @@ 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) {
|
||||||
|
if (frame) {
|
||||||
delete frame[idx];
|
delete frame[idx];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// this.children.splice(this.children.indexOf(childObject), 1);
|
// this.children.splice(this.children.indexOf(childObject), 1);
|
||||||
}
|
}
|
||||||
addLayer(layer) {
|
addLayer(layer) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue