@meta2d/core 1.0.91 → 1.0.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/canvas/canvas.js +15 -5
- package/src/canvas/canvas.js.map +1 -1
- package/src/core.js +19 -18
- package/src/core.js.map +1 -1
- package/src/pen/model.d.ts +4 -0
- package/src/pen/model.js.map +1 -1
- package/src/pen/render.js +6 -5
- package/src/pen/render.js.map +1 -1
package/package.json
CHANGED
package/src/canvas/canvas.js
CHANGED
|
@@ -3487,6 +3487,9 @@ export class Canvas {
|
|
|
3487
3487
|
this.store.data.pens.splice(pen.calculative?.layer !== -1
|
|
3488
3488
|
? pen.calculative?.layer
|
|
3489
3489
|
: this.store.data.pens.length, 0, pen);
|
|
3490
|
+
if (pen.path) {
|
|
3491
|
+
!this.store.data.paths[pen.pathId] && (this.store.data.paths[pen.pathId] = pen.path);
|
|
3492
|
+
}
|
|
3490
3493
|
// 先放进去,pens 可能是子节点在前,而父节点在后
|
|
3491
3494
|
this.store.pens[pen.id] = pen;
|
|
3492
3495
|
if (pen.type && pen.lastConnected) {
|
|
@@ -5940,15 +5943,15 @@ export class Canvas {
|
|
|
5940
5943
|
offset && (this.store.clipboard.offset = offset);
|
|
5941
5944
|
pos && (this.store.clipboard.pos = pos);
|
|
5942
5945
|
}
|
|
5946
|
+
const rootPens = this.store.clipboard.pens.filter((pen) => !pen.parentId);
|
|
5947
|
+
for (const pen of rootPens) {
|
|
5948
|
+
this.pastePen(pen, undefined);
|
|
5949
|
+
}
|
|
5943
5950
|
if (!this.keyOptions?.F) {
|
|
5944
5951
|
this.store.clipboard.pens.forEach((pen) => {
|
|
5945
5952
|
delete pen.copyIndex;
|
|
5946
5953
|
});
|
|
5947
5954
|
}
|
|
5948
|
-
const rootPens = this.store.clipboard.pens.filter((pen) => !pen.parentId);
|
|
5949
|
-
for (const pen of rootPens) {
|
|
5950
|
-
this.pastePen(pen, undefined);
|
|
5951
|
-
}
|
|
5952
5955
|
sessionStorage.setItem('page', clipboard.page);
|
|
5953
5956
|
this.active(rootPens);
|
|
5954
5957
|
this.pushHistory({ type: EditType.Add, pens: this.store.clipboard.pens });
|
|
@@ -6198,6 +6201,9 @@ export class Canvas {
|
|
|
6198
6201
|
if (delPen && delPen.calculative) {
|
|
6199
6202
|
delPen.calculative.active = undefined;
|
|
6200
6203
|
}
|
|
6204
|
+
if (delPen.pathId) {
|
|
6205
|
+
delPen.path = this.store.data.paths[pen.pathId];
|
|
6206
|
+
}
|
|
6201
6207
|
delPens.push(delPen);
|
|
6202
6208
|
}
|
|
6203
6209
|
if (pen.children) {
|
|
@@ -6230,7 +6236,11 @@ export class Canvas {
|
|
|
6230
6236
|
delete this.store.pens[pen.id];
|
|
6231
6237
|
// 删除svgpath的数据
|
|
6232
6238
|
if (pen.pathId) {
|
|
6233
|
-
|
|
6239
|
+
const hasP = this.store.data.pens.some((p) => p.pathId === pen.pathId);
|
|
6240
|
+
if (!hasP) {
|
|
6241
|
+
// 删除path
|
|
6242
|
+
delete this.store.data.paths[pen.pathId];
|
|
6243
|
+
}
|
|
6234
6244
|
}
|
|
6235
6245
|
}
|
|
6236
6246
|
this.store.animates.delete(pen);
|