@meta2d/core 1.0.21 → 1.0.23
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.d.ts +2 -1
- package/src/canvas/canvas.js +14 -7
- package/src/canvas/canvas.js.map +1 -1
- package/src/canvas/canvasImage.js +8 -6
- package/src/canvas/canvasImage.js.map +1 -1
- package/src/core.d.ts +2 -2
- package/src/core.js +155 -74
- package/src/core.js.map +1 -1
- package/src/event/event.d.ts +3 -1
- package/src/pen/model.d.ts +0 -1
- package/src/pen/model.js.map +1 -1
- package/src/pen/render.js +81 -73
- package/src/pen/render.js.map +1 -1
- package/src/store/store.d.ts +5 -3
- package/src/store/store.js +2 -2
- package/src/store/store.js.map +1 -1
package/package.json
CHANGED
package/src/canvas/canvas.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ export declare class Canvas {
|
|
|
75
75
|
renderTimer: number;
|
|
76
76
|
initPens?: Pen[];
|
|
77
77
|
pointSize: 8;
|
|
78
|
-
pasteOffset:
|
|
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;
|
package/src/canvas/canvas.js
CHANGED
|
@@ -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 =
|
|
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
|
};
|
|
@@ -988,7 +989,7 @@ var Canvas = /** @class */ (function () {
|
|
|
988
989
|
_this.store.data.rule &&
|
|
989
990
|
!_this.store.options.disableRuleLine &&
|
|
990
991
|
_this.addRuleLine(e);
|
|
991
|
-
|
|
992
|
+
// this.inactive();
|
|
992
993
|
break;
|
|
993
994
|
case HoverType.Node:
|
|
994
995
|
case HoverType.Line:
|
|
@@ -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
|
|
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) {
|
|
@@ -1723,7 +1725,7 @@ var Canvas = /** @class */ (function () {
|
|
|
1723
1725
|
if (pen.children) {
|
|
1724
1726
|
var pens_1 = []; // TODO: 只考虑了一级子
|
|
1725
1727
|
pen.children.forEach(function (id) {
|
|
1726
|
-
pens_1.push(_this.store.pens[id]);
|
|
1728
|
+
_this.store.pens[id] && pens_1.push(_this.store.pens[id]);
|
|
1727
1729
|
});
|
|
1728
1730
|
hoverType = _this.inPens(pt, pens_1);
|
|
1729
1731
|
if (hoverType) {
|
|
@@ -3146,6 +3148,7 @@ var Canvas = /** @class */ (function () {
|
|
|
3146
3148
|
},
|
|
3147
3149
|
],
|
|
3148
3150
|
});
|
|
3151
|
+
this.inactive();
|
|
3149
3152
|
};
|
|
3150
3153
|
/**
|
|
3151
3154
|
* 拖拽结束,数据更新到 active.pens
|
|
@@ -3256,7 +3259,7 @@ var Canvas = /** @class */ (function () {
|
|
|
3256
3259
|
return __assign(__assign({}, pen), { x: x, y: y });
|
|
3257
3260
|
}));
|
|
3258
3261
|
// 偏移量 0
|
|
3259
|
-
this.pasteOffset =
|
|
3262
|
+
this.pasteOffset = false;
|
|
3260
3263
|
this.paste();
|
|
3261
3264
|
};
|
|
3262
3265
|
/**
|
|
@@ -3706,6 +3709,7 @@ var Canvas = /** @class */ (function () {
|
|
|
3706
3709
|
var pen = deepClone(aPen, true);
|
|
3707
3710
|
var i = _this.store.data.pens.findIndex(function (item) { return item.id === pen.id; });
|
|
3708
3711
|
if (i > -1) {
|
|
3712
|
+
(_a = pen.onDestroy) === null || _a === void 0 ? void 0 : _a.call(pen, _this.store.pens[pen.id]);
|
|
3709
3713
|
_this.store.data.pens.splice(i, 1);
|
|
3710
3714
|
_this.store.pens[pen.id] = undefined;
|
|
3711
3715
|
if (!pen.calculative) {
|
|
@@ -3714,7 +3718,6 @@ var Canvas = /** @class */ (function () {
|
|
|
3714
3718
|
pen.calculative.canvas = _this;
|
|
3715
3719
|
_this.store.animates.delete(pen);
|
|
3716
3720
|
_this.store.animateMap.delete(pen);
|
|
3717
|
-
(_a = pen.onDestroy) === null || _a === void 0 ? void 0 : _a.call(pen, pen);
|
|
3718
3721
|
}
|
|
3719
3722
|
});
|
|
3720
3723
|
action.type = EditType.Delete;
|
|
@@ -5141,8 +5144,8 @@ var Canvas = /** @class */ (function () {
|
|
|
5141
5144
|
}
|
|
5142
5145
|
translatePoint(lineAnchor, penAnchor.x - lineAnchor.x + offsetX, penAnchor.y - lineAnchor.y + offsetY);
|
|
5143
5146
|
if (_this.store.options.autoPolyline &&
|
|
5147
|
+
!_this.autoPolylineFlag &&
|
|
5144
5148
|
line.autoPolyline !== false &&
|
|
5145
|
-
line.calculative.autoPolylineFlag === true &&
|
|
5146
5149
|
line.lineName === 'polyline') {
|
|
5147
5150
|
var from = getFromAnchor(line);
|
|
5148
5151
|
var to = getToAnchor(line);
|
|
@@ -5529,6 +5532,10 @@ var Canvas = /** @class */ (function () {
|
|
|
5529
5532
|
this.store.clipboard.pos = { x: this.mousePos.x, y: this.mousePos.y };
|
|
5530
5533
|
this.store.clipboard.offset = 0;
|
|
5531
5534
|
}
|
|
5535
|
+
else if (!this.pasteOffset) {
|
|
5536
|
+
this.store.clipboard.offset = 0;
|
|
5537
|
+
this.pasteOffset = true;
|
|
5538
|
+
}
|
|
5532
5539
|
else {
|
|
5533
5540
|
offset && (this.store.clipboard.offset = offset);
|
|
5534
5541
|
pos && (this.store.clipboard.pos = pos);
|