@meta2d/core 1.0.91 → 1.0.93

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meta2d/core",
3
- "version": "1.0.91",
3
+ "version": "1.0.93",
4
4
  "description": "@meta2d/core: Powerful, Beautiful, Simple, Open - Web-Based 2D At Its Best .",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -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
- delete this.store.data.paths[pen.pathId];
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);