@meta2d/core 1.0.48 → 1.0.49
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 -0
- package/src/canvas/canvas.js +166 -47
- package/src/canvas/canvas.js.map +1 -1
- package/src/core.d.ts +2 -0
- package/src/core.js +28 -11
- package/src/core.js.map +1 -1
- package/src/data.js +1 -0
- package/src/data.js.map +1 -1
- package/src/diagrams/index.d.ts +3 -0
- package/src/diagrams/index.js +5 -1
- package/src/diagrams/index.js.map +1 -1
- package/src/diagrams/panel.d.ts +2 -0
- package/src/diagrams/panel.js +131 -0
- package/src/diagrams/panel.js.map +1 -0
- package/src/options.d.ts +1 -0
- package/src/options.js.map +1 -1
- package/src/pen/model.d.ts +4 -0
- package/src/pen/model.js.map +1 -1
- package/src/pen/render.d.ts +1 -0
- package/src/pen/render.js +50 -11
- package/src/pen/render.js.map +1 -1
- package/src/pen/text.js +6 -6
- package/src/pen/text.js.map +1 -1
- package/src/rect/rect.d.ts +3 -1
- package/src/rect/rect.js +17 -3
- package/src/rect/rect.js.map +1 -1
- package/src/store/store.d.ts +2 -0
- package/src/store/store.js.map +1 -1
- package/src/utils/url.js +1 -1
- package/src/utils/url.js.map +1 -1
package/package.json
CHANGED
package/src/canvas/canvas.d.ts
CHANGED
package/src/canvas/canvas.js
CHANGED
|
@@ -82,7 +82,7 @@ var __values = (this && this.__values) || function(o) {
|
|
|
82
82
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
83
83
|
};
|
|
84
84
|
import { KeydownType } from '../options';
|
|
85
|
-
import { addLineAnchor, calcIconRect, calcTextRect, calcWorldAnchors, calcWorldRects, LockState, nearestAnchor, PenType, pushPenAnchor, removePenAnchor, renderPen, scalePen, translateLine, deleteTempAnchor, connectLine, disconnectLine, getAnchor, calcAnchorDock, calcMoveDock, calcTextLines, setNodeAnimate, setLineAnimate, calcPenRect, setChildrenActive, getParent, setHover, randomId, getPensLock, getToAnchor, getFromAnchor, calcPadding, getPensDisableRotate, getPensDisableResize, needCalcTextRectProps, calcResizeDock, needPatchFlagsPenRectProps, needCalcIconRectProps, isDomShapes, renderPenRaw, needSetPenProps, getAllChildren, calcInView, isShowChild, getTextColor, getGlobalColor, clearLifeCycle, rotatePen, calcTextAutoWidth, getGradientAnimatePath, CanvasLayer, ctxFlip, ctxRotate, setGlobalAlpha, drawImage, setElemPosition, } from '../pen';
|
|
85
|
+
import { addLineAnchor, calcIconRect, calcTextRect, calcWorldAnchors, calcWorldRects, LockState, nearestAnchor, PenType, pushPenAnchor, removePenAnchor, renderPen, scalePen, translateLine, deleteTempAnchor, connectLine, disconnectLine, getAnchor, calcAnchorDock, calcMoveDock, calcTextLines, setNodeAnimate, setLineAnimate, calcPenRect, setChildrenActive, getParent, setHover, randomId, getPensLock, getToAnchor, getFromAnchor, calcPadding, getPensDisableRotate, getPensDisableResize, needCalcTextRectProps, calcResizeDock, needPatchFlagsPenRectProps, needCalcIconRectProps, isDomShapes, renderPenRaw, needSetPenProps, getAllChildren, calcInView, isShowChild, getTextColor, getGlobalColor, clearLifeCycle, rotatePen, calcTextAutoWidth, getGradientAnimatePath, CanvasLayer, ctxFlip, ctxRotate, setGlobalAlpha, drawImage, setElemPosition, getAllFollowers, } from '../pen';
|
|
86
86
|
import { calcRotate, distance, getDistance, hitPoint, PointType, PrevNextType, rotatePoint, samePoint, scalePoint, translatePoint, TwoWay, } from '../point';
|
|
87
87
|
import { calcCenter, calcRightBottom, calcRelativePoint, getRect, getRectOfPoints, pointInRect, pointInSimpleRect, rectInRect, rectToPoints, resizeRect, translateRect, pointInPolygon } from '../rect';
|
|
88
88
|
import { EditType, globalStore, } from '../store';
|
|
@@ -289,25 +289,33 @@ var Canvas = /** @class */ (function () {
|
|
|
289
289
|
return;
|
|
290
290
|
}
|
|
291
291
|
var scaleOff = 0.015;
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
if (
|
|
295
|
-
scaleOff
|
|
296
|
-
}
|
|
297
|
-
else if (e.deltaY > 0) {
|
|
298
|
-
scaleOff *= -1;
|
|
292
|
+
if (_this.store.options.scaleOff) {
|
|
293
|
+
scaleOff = _this.store.options.scaleOff;
|
|
294
|
+
if (e.deltaY > 0) {
|
|
295
|
+
scaleOff = -_this.store.options.scaleOff;
|
|
299
296
|
}
|
|
300
297
|
}
|
|
301
298
|
else {
|
|
302
|
-
var
|
|
303
|
-
if (
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
299
|
+
var isMac = /mac os /i.test(navigator.userAgent);
|
|
300
|
+
if (isMac) {
|
|
301
|
+
if (!e.ctrlKey) {
|
|
302
|
+
scaleOff *= e.wheelDeltaY / 240;
|
|
303
|
+
}
|
|
304
|
+
else if (e.deltaY > 0) {
|
|
305
|
+
scaleOff *= -1;
|
|
306
|
+
}
|
|
308
307
|
}
|
|
309
308
|
else {
|
|
310
|
-
|
|
309
|
+
var offset = 0.2;
|
|
310
|
+
if (e.deltaY.toString().indexOf('.') !== -1) {
|
|
311
|
+
offset = 0.01;
|
|
312
|
+
}
|
|
313
|
+
if (e.deltaY > 0) {
|
|
314
|
+
scaleOff = -offset;
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
scaleOff = offset;
|
|
318
|
+
}
|
|
311
319
|
}
|
|
312
320
|
}
|
|
313
321
|
var x = e.offsetX, y = e.offsetY;
|
|
@@ -719,6 +727,10 @@ var Canvas = /** @class */ (function () {
|
|
|
719
727
|
//置顶
|
|
720
728
|
_this.parent.top();
|
|
721
729
|
break;
|
|
730
|
+
case 'F':
|
|
731
|
+
case 'f':
|
|
732
|
+
_this.setFollowers();
|
|
733
|
+
break;
|
|
722
734
|
}
|
|
723
735
|
_this.render(false);
|
|
724
736
|
};
|
|
@@ -1145,10 +1157,12 @@ var Canvas = /** @class */ (function () {
|
|
|
1145
1157
|
_this.willInactivePen = pen;
|
|
1146
1158
|
}
|
|
1147
1159
|
else {
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1160
|
+
if (_this.store.active.length > 0) {
|
|
1161
|
+
pen.calculative.active = true;
|
|
1162
|
+
setChildrenActive(pen); // 子节点也设置为active
|
|
1163
|
+
_this.store.active.push(pen);
|
|
1164
|
+
_this.store.emitter.emit('active', _this.store.active);
|
|
1165
|
+
}
|
|
1152
1166
|
}
|
|
1153
1167
|
_this.patchFlags = true;
|
|
1154
1168
|
}
|
|
@@ -1156,10 +1170,12 @@ var Canvas = /** @class */ (function () {
|
|
|
1156
1170
|
_this.active([_this.store.hover]);
|
|
1157
1171
|
}
|
|
1158
1172
|
else {
|
|
1159
|
-
if (!
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
_this.
|
|
1173
|
+
if (!(_this.activeRect && pointInRect({ x: e.x, y: e.y }, _this.activeRect)) || _this.store.active.length == 1) {
|
|
1174
|
+
if (!pen.calculative.active) {
|
|
1175
|
+
_this.active([pen]);
|
|
1176
|
+
if (_this.store.options.resizeMode) {
|
|
1177
|
+
_this.hotkeyType = HotkeyType.Resize;
|
|
1178
|
+
}
|
|
1163
1179
|
}
|
|
1164
1180
|
}
|
|
1165
1181
|
}
|
|
@@ -1282,7 +1298,7 @@ var Canvas = /** @class */ (function () {
|
|
|
1282
1298
|
return;
|
|
1283
1299
|
}
|
|
1284
1300
|
// 框选
|
|
1285
|
-
if (e.buttons === 1 && !_this.hoverType && !_this.hotkeyType) {
|
|
1301
|
+
if (e.buttons === 1 && (e.ctrlKey || !_this.hoverType && !_this.hotkeyType)) {
|
|
1286
1302
|
_this.dragRect = {
|
|
1287
1303
|
x: Math.min(_this.mouseDown.x, e.x),
|
|
1288
1304
|
y: Math.min(_this.mouseDown.y, e.y),
|
|
@@ -1619,7 +1635,7 @@ var Canvas = /** @class */ (function () {
|
|
|
1619
1635
|
pen.parentId || pen.isRuleLine) {
|
|
1620
1636
|
return false;
|
|
1621
1637
|
}
|
|
1622
|
-
if (rectInRect(pen.calculative.worldRect, _this.dragRect, _this.store.options.dragAllIn)) {
|
|
1638
|
+
if (rectInRect(pen.calculative.worldRect, _this.dragRect, e.ctrlKey || _this.store.options.dragAllIn)) {
|
|
1623
1639
|
// 先判断在区域内,若不在区域内,则锚点肯定不在框选区域内,避免每条连线过度计算
|
|
1624
1640
|
if (pen.type === PenType.Line && !_this.store.options.dragAllIn) {
|
|
1625
1641
|
return lineInRect(pen, _this.dragRect);
|
|
@@ -1646,6 +1662,11 @@ var Canvas = /** @class */ (function () {
|
|
|
1646
1662
|
y: e.y,
|
|
1647
1663
|
pen: _this.store.hover,
|
|
1648
1664
|
});
|
|
1665
|
+
_this.store.emitter.emit('mouseup', {
|
|
1666
|
+
x: e.x,
|
|
1667
|
+
y: e.y,
|
|
1668
|
+
pen: _this.store.hoverContainer,
|
|
1669
|
+
});
|
|
1649
1670
|
}
|
|
1650
1671
|
if (_this.willInactivePen) {
|
|
1651
1672
|
_this.willInactivePen.calculative.active = undefined;
|
|
@@ -1721,6 +1742,7 @@ var Canvas = /** @class */ (function () {
|
|
|
1721
1742
|
if (_this.dragRect) {
|
|
1722
1743
|
return;
|
|
1723
1744
|
}
|
|
1745
|
+
_this.store.hoverContainer = undefined;
|
|
1724
1746
|
var containerPens = _this.store.data.pens.filter(function (pen) { var _a; return pen.container || ((_a = _this.store.options.containerShapes) === null || _a === void 0 ? void 0 : _a.includes(pen.name)); });
|
|
1725
1747
|
if (containerPens.length) {
|
|
1726
1748
|
for (var i = containerPens.length - 1; i >= 0; --i) {
|
|
@@ -1732,7 +1754,31 @@ var Canvas = /** @class */ (function () {
|
|
|
1732
1754
|
continue;
|
|
1733
1755
|
}
|
|
1734
1756
|
if (pointInRect(pt, pen.calculative.worldRect)) {
|
|
1757
|
+
_this.store.hoverContainer = pen;
|
|
1735
1758
|
(_a = pen === null || pen === void 0 ? void 0 : pen.onMouseMove) === null || _a === void 0 ? void 0 : _a.call(pen, pen, pt);
|
|
1759
|
+
if (_this.store.lastHoverContainer !== _this.store.hoverContainer) {
|
|
1760
|
+
_this.patchFlags = true;
|
|
1761
|
+
if (_this.store.lastHoverContainer) {
|
|
1762
|
+
_this.store.lastHoverContainer.calculative.containerHover = false;
|
|
1763
|
+
_this.store.emitter.emit('leave', _this.store.lastHoverContainer);
|
|
1764
|
+
}
|
|
1765
|
+
if (_this.store.hoverContainer) {
|
|
1766
|
+
_this.store.hoverContainer.calculative.containerHover = true;
|
|
1767
|
+
_this.store.emitter.emit('enter', _this.store.hoverContainer);
|
|
1768
|
+
}
|
|
1769
|
+
_this.store.lastHoverContainer = _this.store.hoverContainer;
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
else {
|
|
1773
|
+
_this.store.hoverContainer = undefined;
|
|
1774
|
+
if (_this.store.lastHoverContainer !== _this.store.hoverContainer) {
|
|
1775
|
+
_this.patchFlags = true;
|
|
1776
|
+
if (_this.store.lastHoverContainer) {
|
|
1777
|
+
_this.store.lastHoverContainer.calculative.containerHover = false;
|
|
1778
|
+
_this.store.emitter.emit('leave', _this.store.lastHoverContainer);
|
|
1779
|
+
}
|
|
1780
|
+
_this.store.lastHoverContainer = _this.store.hoverContainer;
|
|
1781
|
+
}
|
|
1736
1782
|
}
|
|
1737
1783
|
}
|
|
1738
1784
|
}
|
|
@@ -1765,7 +1811,7 @@ var Canvas = /** @class */ (function () {
|
|
|
1765
1811
|
y: _this.activeRect.y - 30,
|
|
1766
1812
|
};
|
|
1767
1813
|
if (_this.activeRect.rotate) {
|
|
1768
|
-
rotatePoint(rotatePt, _this.activeRect.rotate, _this.activeRect.center);
|
|
1814
|
+
rotatePoint(rotatePt, _this.activeRect.rotate, _this.activeRect.pivot || _this.activeRect.center);
|
|
1769
1815
|
}
|
|
1770
1816
|
// 旋转控制点
|
|
1771
1817
|
if (!_this.hotkeyType && hitPoint(pt, rotatePt, _this.pointSize)) {
|
|
@@ -2215,10 +2261,11 @@ var Canvas = /** @class */ (function () {
|
|
|
2215
2261
|
var ctx = _this.offscreen.getContext('2d');
|
|
2216
2262
|
ctx.save();
|
|
2217
2263
|
ctx.translate(0.5, 0.5);
|
|
2264
|
+
var pivot = _this.activeRect.pivot || _this.activeRect.center;
|
|
2218
2265
|
if (_this.activeRect.rotate) {
|
|
2219
|
-
ctx.translate(
|
|
2266
|
+
ctx.translate(pivot.x, pivot.y);
|
|
2220
2267
|
ctx.rotate((_this.activeRect.rotate * Math.PI) / 180);
|
|
2221
|
-
ctx.translate(-
|
|
2268
|
+
ctx.translate(-pivot.x, -pivot.y);
|
|
2222
2269
|
}
|
|
2223
2270
|
ctx.strokeStyle = _this.store.options.activeColor;
|
|
2224
2271
|
ctx.globalAlpha = _this.store.options.activeGlobalAlpha === undefined ? 0.3 : _this.store.options.activeGlobalAlpha;
|
|
@@ -3566,13 +3613,19 @@ var Canvas = /** @class */ (function () {
|
|
|
3566
3613
|
Canvas.prototype.movedActivePens = function (readyConnect) {
|
|
3567
3614
|
var _this = this;
|
|
3568
3615
|
// 鼠标松手才更新,此处是更新前的值
|
|
3569
|
-
|
|
3616
|
+
//follower
|
|
3617
|
+
var movedPens = this.getAllFollowersByPens(this.store.active, false);
|
|
3618
|
+
var initPens = deepClone(movedPens, true);
|
|
3570
3619
|
// const pens = deepClone(this.store.active, true);
|
|
3571
3620
|
var gridSize = this.store.data.gridSize || this.store.options.gridSize;
|
|
3572
3621
|
var _a = this.store.data, origin = _a.origin, scale = _a.scale;
|
|
3573
3622
|
var autoAlignGrid = this.store.options.autoAlignGrid && this.store.data.grid;
|
|
3574
|
-
|
|
3623
|
+
movedPens.forEach(function (pen) {
|
|
3575
3624
|
var _a;
|
|
3625
|
+
var i = _this.movingPens.findIndex(function (item) { return item.id === pen.id + movingSuffix; });
|
|
3626
|
+
if (i < 0) {
|
|
3627
|
+
return;
|
|
3628
|
+
}
|
|
3576
3629
|
var _b = _this.movingPens[i], x = _b.x, y = _b.y;
|
|
3577
3630
|
var obj = { x: x, y: y };
|
|
3578
3631
|
// 根据是否开启了自动网格对齐,来修正坐标
|
|
@@ -4816,10 +4869,10 @@ var Canvas = /** @class */ (function () {
|
|
|
4816
4869
|
: pen.textHeight * scale;
|
|
4817
4870
|
pen.calculative.textLeft =
|
|
4818
4871
|
pen.textLeft < 1 && pen.textLeft > -1
|
|
4819
|
-
? pen.textLeft
|
|
4872
|
+
? pen.textLeft * pen.calculative.worldRect.width
|
|
4820
4873
|
: pen.textLeft * scale;
|
|
4821
4874
|
pen.calculative.textTop =
|
|
4822
|
-
pen.textTop < 1 && pen.textTop > -1 ? pen.textTop : pen.textTop * scale;
|
|
4875
|
+
pen.textTop < 1 && pen.textTop > -1 ? pen.textTop * pen.calculative.worldRect.height : pen.textTop * scale;
|
|
4823
4876
|
if (pen.type === PenType.Line && pen.borderWidth) {
|
|
4824
4877
|
pen.calculative.borderWidth = pen.borderWidth * scale;
|
|
4825
4878
|
}
|
|
@@ -5374,6 +5427,7 @@ var Canvas = /** @class */ (function () {
|
|
|
5374
5427
|
}
|
|
5375
5428
|
}
|
|
5376
5429
|
this.movingPens = deepClone(this.store.active, true);
|
|
5430
|
+
this.movingPens = this.getAllFollowersByPens(this.movingPens);
|
|
5377
5431
|
var containChildPens = this.getAllByPens(this.movingPens);
|
|
5378
5432
|
var copyContainChildPens = deepClone(containChildPens, true);
|
|
5379
5433
|
// 考虑父子关系,修改 id
|
|
@@ -6463,6 +6517,71 @@ var Canvas = /** @class */ (function () {
|
|
|
6463
6517
|
}
|
|
6464
6518
|
return retPens.concat(pens);
|
|
6465
6519
|
};
|
|
6520
|
+
Canvas.prototype.getAllFollowersByPens = function (pens, deep) {
|
|
6521
|
+
var e_22, _a, e_23, _b;
|
|
6522
|
+
if (deep === void 0) { deep = true; }
|
|
6523
|
+
var retPens = pens;
|
|
6524
|
+
try {
|
|
6525
|
+
for (var pens_10 = __values(pens), pens_10_1 = pens_10.next(); !pens_10_1.done; pens_10_1 = pens_10.next()) {
|
|
6526
|
+
var pen = pens_10_1.value;
|
|
6527
|
+
var followers = getAllFollowers(pen, this.store);
|
|
6528
|
+
if (deep) {
|
|
6529
|
+
followers = deepClone(followers, true);
|
|
6530
|
+
}
|
|
6531
|
+
var _loop_6 = function (follower) {
|
|
6532
|
+
if (!retPens.find(function (p) { return p.id === follower.id; })) {
|
|
6533
|
+
retPens.push(follower);
|
|
6534
|
+
}
|
|
6535
|
+
};
|
|
6536
|
+
try {
|
|
6537
|
+
for (var followers_1 = (e_23 = void 0, __values(followers)), followers_1_1 = followers_1.next(); !followers_1_1.done; followers_1_1 = followers_1.next()) {
|
|
6538
|
+
var follower = followers_1_1.value;
|
|
6539
|
+
_loop_6(follower);
|
|
6540
|
+
}
|
|
6541
|
+
}
|
|
6542
|
+
catch (e_23_1) { e_23 = { error: e_23_1 }; }
|
|
6543
|
+
finally {
|
|
6544
|
+
try {
|
|
6545
|
+
if (followers_1_1 && !followers_1_1.done && (_b = followers_1.return)) _b.call(followers_1);
|
|
6546
|
+
}
|
|
6547
|
+
finally { if (e_23) throw e_23.error; }
|
|
6548
|
+
}
|
|
6549
|
+
}
|
|
6550
|
+
}
|
|
6551
|
+
catch (e_22_1) { e_22 = { error: e_22_1 }; }
|
|
6552
|
+
finally {
|
|
6553
|
+
try {
|
|
6554
|
+
if (pens_10_1 && !pens_10_1.done && (_a = pens_10.return)) _a.call(pens_10);
|
|
6555
|
+
}
|
|
6556
|
+
finally { if (e_22) throw e_22.error; }
|
|
6557
|
+
}
|
|
6558
|
+
return retPens;
|
|
6559
|
+
};
|
|
6560
|
+
Canvas.prototype.setFollowers = function (pens) {
|
|
6561
|
+
if (pens === void 0) { pens = this.store.active; }
|
|
6562
|
+
if (!pens) {
|
|
6563
|
+
return;
|
|
6564
|
+
}
|
|
6565
|
+
if (pens.length < 2) {
|
|
6566
|
+
pens[0].followers = [];
|
|
6567
|
+
}
|
|
6568
|
+
else {
|
|
6569
|
+
//以最后一个
|
|
6570
|
+
var ids = pens.map(function (pen) { return pen.id; });
|
|
6571
|
+
ids.pop();
|
|
6572
|
+
var lastPen_1 = pens[pens.length - 1];
|
|
6573
|
+
if (!lastPen_1.followers) {
|
|
6574
|
+
lastPen_1.followers = ids;
|
|
6575
|
+
}
|
|
6576
|
+
else {
|
|
6577
|
+
ids.forEach(function (id) {
|
|
6578
|
+
if (!lastPen_1.followers.includes(id)) {
|
|
6579
|
+
lastPen_1.followers.push(id);
|
|
6580
|
+
}
|
|
6581
|
+
});
|
|
6582
|
+
}
|
|
6583
|
+
}
|
|
6584
|
+
};
|
|
6466
6585
|
/**
|
|
6467
6586
|
* 修改对应连线的 anchors
|
|
6468
6587
|
* @param oldId 老 id
|
|
@@ -6473,7 +6592,7 @@ var Canvas = /** @class */ (function () {
|
|
|
6473
6592
|
if (!Array.isArray(pen.connectedLines)) {
|
|
6474
6593
|
return;
|
|
6475
6594
|
}
|
|
6476
|
-
var
|
|
6595
|
+
var _loop_7 = function (index) {
|
|
6477
6596
|
var lineId = pen.connectedLines[index].lineId;
|
|
6478
6597
|
var line = pastePens.find(function (pen) { return pen.id === lineId; });
|
|
6479
6598
|
if (line) {
|
|
@@ -6491,7 +6610,7 @@ var Canvas = /** @class */ (function () {
|
|
|
6491
6610
|
};
|
|
6492
6611
|
var out_index_1;
|
|
6493
6612
|
for (var index = 0; index < pen.connectedLines.length; index++) {
|
|
6494
|
-
|
|
6613
|
+
_loop_7(index);
|
|
6495
6614
|
index = out_index_1;
|
|
6496
6615
|
}
|
|
6497
6616
|
};
|
|
@@ -6502,13 +6621,13 @@ var Canvas = /** @class */ (function () {
|
|
|
6502
6621
|
* @param pastePens 此处复制的全部 pens (包含子节点)
|
|
6503
6622
|
*/
|
|
6504
6623
|
Canvas.prototype.changeNodeConnectedLine = function (oldId, line, pastePens) {
|
|
6505
|
-
var
|
|
6624
|
+
var e_24, _a;
|
|
6506
6625
|
var _b;
|
|
6507
6626
|
var from = line.anchors[0];
|
|
6508
6627
|
var to = line.anchors[line.anchors.length - 1];
|
|
6509
6628
|
// 修改对应节点的 connectedLines
|
|
6510
6629
|
var anchors = [from, to];
|
|
6511
|
-
var
|
|
6630
|
+
var _loop_8 = function (anchor) {
|
|
6512
6631
|
var nodeId = anchor.connectTo;
|
|
6513
6632
|
if (nodeId) {
|
|
6514
6633
|
var node = pastePens.find(function (pen) { return pen.id === nodeId; });
|
|
@@ -6535,15 +6654,15 @@ var Canvas = /** @class */ (function () {
|
|
|
6535
6654
|
try {
|
|
6536
6655
|
for (var anchors_1 = __values(anchors), anchors_1_1 = anchors_1.next(); !anchors_1_1.done; anchors_1_1 = anchors_1.next()) {
|
|
6537
6656
|
var anchor = anchors_1_1.value;
|
|
6538
|
-
|
|
6657
|
+
_loop_8(anchor);
|
|
6539
6658
|
}
|
|
6540
6659
|
}
|
|
6541
|
-
catch (
|
|
6660
|
+
catch (e_24_1) { e_24 = { error: e_24_1 }; }
|
|
6542
6661
|
finally {
|
|
6543
6662
|
try {
|
|
6544
6663
|
if (anchors_1_1 && !anchors_1_1.done && (_a = anchors_1.return)) _a.call(anchors_1);
|
|
6545
6664
|
}
|
|
6546
|
-
finally { if (
|
|
6665
|
+
finally { if (e_24) throw e_24.error; }
|
|
6547
6666
|
}
|
|
6548
6667
|
};
|
|
6549
6668
|
Canvas.prototype.delete = function (pens, canDelLocked, history) {
|
|
@@ -6686,7 +6805,7 @@ var Canvas = /** @class */ (function () {
|
|
|
6686
6805
|
var _this = this;
|
|
6687
6806
|
var _a;
|
|
6688
6807
|
if (pen.connectedLines) {
|
|
6689
|
-
var
|
|
6808
|
+
var _loop_9 = function (i) {
|
|
6690
6809
|
var _b = pen.connectedLines[i], lineId = _b.lineId, lineAnchor = _b.lineAnchor;
|
|
6691
6810
|
var line = this_2.store.pens[lineId];
|
|
6692
6811
|
if (line) {
|
|
@@ -6708,7 +6827,7 @@ var Canvas = /** @class */ (function () {
|
|
|
6708
6827
|
};
|
|
6709
6828
|
var this_2 = this;
|
|
6710
6829
|
for (var i = 0; i < pen.connectedLines.length; i++) {
|
|
6711
|
-
|
|
6830
|
+
_loop_9(i);
|
|
6712
6831
|
}
|
|
6713
6832
|
}
|
|
6714
6833
|
if (!pen.type) {
|
|
@@ -7161,7 +7280,7 @@ var Canvas = /** @class */ (function () {
|
|
|
7161
7280
|
};
|
|
7162
7281
|
};
|
|
7163
7282
|
Canvas.prototype.toPng = function (padding, callback, containBkImg, maxWidth) {
|
|
7164
|
-
var
|
|
7283
|
+
var e_25, _a;
|
|
7165
7284
|
if (padding === void 0) { padding = 2; }
|
|
7166
7285
|
if (containBkImg === void 0) { containBkImg = false; }
|
|
7167
7286
|
var rect = getRect(this.store.data.pens);
|
|
@@ -7293,12 +7412,12 @@ var Canvas = /** @class */ (function () {
|
|
|
7293
7412
|
pen.calculative.active = active;
|
|
7294
7413
|
}
|
|
7295
7414
|
}
|
|
7296
|
-
catch (
|
|
7415
|
+
catch (e_25_1) { e_25 = { error: e_25_1 }; }
|
|
7297
7416
|
finally {
|
|
7298
7417
|
try {
|
|
7299
7418
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
7300
7419
|
}
|
|
7301
|
-
finally { if (
|
|
7420
|
+
finally { if (e_25) throw e_25.error; }
|
|
7302
7421
|
}
|
|
7303
7422
|
if (callback) {
|
|
7304
7423
|
canvas.toBlob(callback);
|
|
@@ -7311,7 +7430,7 @@ var Canvas = /** @class */ (function () {
|
|
|
7311
7430
|
return this.pensToPng(this.store.active, padding);
|
|
7312
7431
|
};
|
|
7313
7432
|
Canvas.prototype.pensToPng = function (pens, padding) {
|
|
7314
|
-
var
|
|
7433
|
+
var e_26, _a;
|
|
7315
7434
|
if (pens === void 0) { pens = this.store.active; }
|
|
7316
7435
|
if (padding === void 0) { padding = 2; }
|
|
7317
7436
|
if (pens.length === 0) {
|
|
@@ -7365,12 +7484,12 @@ var Canvas = /** @class */ (function () {
|
|
|
7365
7484
|
}
|
|
7366
7485
|
}
|
|
7367
7486
|
}
|
|
7368
|
-
catch (
|
|
7487
|
+
catch (e_26_1) { e_26 = { error: e_26_1 }; }
|
|
7369
7488
|
finally {
|
|
7370
7489
|
try {
|
|
7371
7490
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
7372
7491
|
}
|
|
7373
|
-
finally { if (
|
|
7492
|
+
finally { if (e_26) throw e_26.error; }
|
|
7374
7493
|
}
|
|
7375
7494
|
return canvas.toDataURL();
|
|
7376
7495
|
};
|