@meta2d/core 1.0.21 → 1.0.22

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.21",
3
+ "version": "1.0.22",
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",
@@ -75,7 +75,7 @@ export declare class Canvas {
75
75
  renderTimer: number;
76
76
  initPens?: Pen[];
77
77
  pointSize: 8;
78
- pasteOffset: number;
78
+ pasteOffset: boolean;
79
79
  opening: boolean;
80
80
  maxZindex: number;
81
81
  canMoveLine: boolean;
@@ -108,6 +108,7 @@ export declare class Canvas {
108
108
  canvasImageBottom: CanvasImage;
109
109
  magnifierCanvas: MagnifierCanvas;
110
110
  dialog: Dialog;
111
+ autoPolylineFlag: boolean;
111
112
  stopPropagation: (e: MouseEvent) => void;
112
113
  constructor(parent: Meta2d, parentElement: HTMLElement, store: Meta2dStore);
113
114
  curve: typeof curve;
@@ -124,7 +124,7 @@ var Canvas = /** @class */ (function () {
124
124
  this.lastAnimateRender = 0;
125
125
  this.animateRendering = false;
126
126
  this.pointSize = 8;
127
- this.pasteOffset = 10;
127
+ this.pasteOffset = true;
128
128
  this.opening = false;
129
129
  this.maxZindex = 4;
130
130
  this.canMoveLine = false; //moveConnectedLine=false
@@ -134,6 +134,7 @@ var Canvas = /** @class */ (function () {
134
134
  this.inputRight = document.createElement('div');
135
135
  this.dropdown = document.createElement('ul');
136
136
  this.mousePos = { x: 0, y: 0 };
137
+ this.autoPolylineFlag = false; //标记open不自动计算
137
138
  this.stopPropagation = function (e) {
138
139
  e.stopPropagation();
139
140
  };
@@ -1440,7 +1441,7 @@ var Canvas = /** @class */ (function () {
1440
1441
  if (_this.dragRect) {
1441
1442
  var pens = _this.store.data.pens.filter(function (pen) {
1442
1443
  if (pen.visible === false ||
1443
- pen.locked === LockState.Disable ||
1444
+ pen.locked >= LockState.DisableMove ||
1444
1445
  pen.parentId) {
1445
1446
  return false;
1446
1447
  }
@@ -1452,6 +1453,7 @@ var Canvas = /** @class */ (function () {
1452
1453
  return true;
1453
1454
  }
1454
1455
  });
1456
+ //框选
1455
1457
  _this.active(pens);
1456
1458
  }
1457
1459
  if (e.button !== 2) {
@@ -3256,7 +3258,7 @@ var Canvas = /** @class */ (function () {
3256
3258
  return __assign(__assign({}, pen), { x: x, y: y });
3257
3259
  }));
3258
3260
  // 偏移量 0
3259
- this.pasteOffset = 0;
3261
+ this.pasteOffset = false;
3260
3262
  this.paste();
3261
3263
  };
3262
3264
  /**
@@ -3706,6 +3708,7 @@ var Canvas = /** @class */ (function () {
3706
3708
  var pen = deepClone(aPen, true);
3707
3709
  var i = _this.store.data.pens.findIndex(function (item) { return item.id === pen.id; });
3708
3710
  if (i > -1) {
3711
+ (_a = pen.onDestroy) === null || _a === void 0 ? void 0 : _a.call(pen, _this.store.pens[pen.id]);
3709
3712
  _this.store.data.pens.splice(i, 1);
3710
3713
  _this.store.pens[pen.id] = undefined;
3711
3714
  if (!pen.calculative) {
@@ -3714,7 +3717,6 @@ var Canvas = /** @class */ (function () {
3714
3717
  pen.calculative.canvas = _this;
3715
3718
  _this.store.animates.delete(pen);
3716
3719
  _this.store.animateMap.delete(pen);
3717
- (_a = pen.onDestroy) === null || _a === void 0 ? void 0 : _a.call(pen, pen);
3718
3720
  }
3719
3721
  });
3720
3722
  action.type = EditType.Delete;
@@ -5141,8 +5143,8 @@ var Canvas = /** @class */ (function () {
5141
5143
  }
5142
5144
  translatePoint(lineAnchor, penAnchor.x - lineAnchor.x + offsetX, penAnchor.y - lineAnchor.y + offsetY);
5143
5145
  if (_this.store.options.autoPolyline &&
5146
+ !_this.autoPolylineFlag &&
5144
5147
  line.autoPolyline !== false &&
5145
- line.calculative.autoPolylineFlag === true &&
5146
5148
  line.lineName === 'polyline') {
5147
5149
  var from = getFromAnchor(line);
5148
5150
  var to = getToAnchor(line);
@@ -5529,6 +5531,10 @@ var Canvas = /** @class */ (function () {
5529
5531
  this.store.clipboard.pos = { x: this.mousePos.x, y: this.mousePos.y };
5530
5532
  this.store.clipboard.offset = 0;
5531
5533
  }
5534
+ else if (!this.pasteOffset) {
5535
+ this.store.clipboard.offset = 0;
5536
+ this.pasteOffset = true;
5537
+ }
5532
5538
  else {
5533
5539
  offset && (this.store.clipboard.offset = offset);
5534
5540
  pos && (this.store.clipboard.pos = pos);