@meta2d/core 1.0.48 → 1.0.50

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.48",
3
+ "version": "1.0.50",
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",
@@ -371,6 +371,8 @@ export declare class Canvas {
371
371
  * @param pens 不包含子节点
372
372
  */
373
373
  getAllByPens(pens: Pen[]): Pen[];
374
+ getAllFollowersByPens(pens: Pen[], deep?: boolean): Pen[];
375
+ setFollowers(pens?: Pen[]): void;
374
376
  /**
375
377
  *
376
378
  * @param pen 当前复制的画笔
@@ -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
- var isMac = /mac os /i.test(navigator.userAgent);
293
- if (isMac) {
294
- if (!e.ctrlKey) {
295
- scaleOff *= e.wheelDeltaY / 240;
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 offset = 0.2;
303
- if (e.deltaY.toString().indexOf('.') !== -1) {
304
- offset = 0.01;
305
- }
306
- if (e.deltaY > 0) {
307
- scaleOff = -offset;
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
- scaleOff = offset;
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
- pen.calculative.active = true;
1149
- setChildrenActive(pen); // 子节点也设置为active
1150
- _this.store.active.push(pen);
1151
- _this.store.emitter.emit('active', _this.store.active);
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 (!pen.calculative.active) {
1160
- _this.active([pen]);
1161
- if (_this.store.options.resizeMode) {
1162
- _this.hotkeyType = HotkeyType.Resize;
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(_this.activeRect.center.x, _this.activeRect.center.y);
2266
+ ctx.translate(pivot.x, pivot.y);
2220
2267
  ctx.rotate((_this.activeRect.rotate * Math.PI) / 180);
2221
- ctx.translate(-_this.activeRect.center.x, -_this.activeRect.center.y);
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;
@@ -3142,7 +3189,7 @@ var Canvas = /** @class */ (function () {
3142
3189
  Canvas.prototype.dropPens = function (pens, e) {
3143
3190
  var _a;
3144
3191
  return __awaiter(this, void 0, void 0, function () {
3145
- var pens_2, pens_2_1, pen, pens_3, pens_3_1, pen, pens_4, pens_4_1, pen, pens_5, pens_5_1, pen, width, height, rect_1, flag, pens_6, pens_6_1, pen, points;
3192
+ var pens_2, pens_2_1, pen, pens_3, pens_3_1, pen, pens_4, pens_4_1, pen, num, lastH, lastW, pens_5, pens_5_1, pen, width, height, rect_1, flag, pens_6, pens_6_1, pen, points;
3146
3193
  var e_7, _b, e_8, _c, e_9, _d, e_10, _e, e_11, _f;
3147
3194
  var _this = this;
3148
3195
  return __generator(this, function (_g) {
@@ -3206,23 +3253,33 @@ var Canvas = /** @class */ (function () {
3206
3253
  }
3207
3254
  finally { if (e_9) throw e_9.error; }
3208
3255
  }
3256
+ num = 0;
3257
+ lastH = 0;
3258
+ lastW = 0;
3209
3259
  try {
3210
- // // 计算区域
3211
- // for (const pen of pens) {
3212
- // // 组合节点才需要提前计算
3213
- // Array.isArray(pen.children) && pen.children.length > 0 && this.updatePenRect(pen);
3214
- // }
3215
3260
  for (pens_5 = __values(pens), pens_5_1 = pens_5.next(); !pens_5_1.done; pens_5_1 = pens_5.next()) {
3216
3261
  pen = pens_5_1.value;
3217
3262
  if (!pen.parentId) {
3218
3263
  pen.width *= this.store.data.scale;
3219
3264
  pen.height *= this.store.data.scale;
3220
- pen.x = e.x - pen.width / 2;
3221
- pen.y = e.y - pen.height / 2;
3265
+ pen.x = e.x - pen.width / 2 + lastW;
3266
+ pen.y = e.y - pen.height / 2 + lastH;
3222
3267
  if (pen.tags && pen.tags.includes('meta3d')) {
3223
3268
  pen.x = this.store.data.origin.x;
3224
3269
  pen.y = this.store.data.origin.y;
3225
3270
  }
3271
+ if (pen.dataset) {
3272
+ if (num % 2 === 0) {
3273
+ lastW = pen.width + 10;
3274
+ }
3275
+ else {
3276
+ lastW = 0;
3277
+ }
3278
+ num++;
3279
+ if (num % 2 === 0) {
3280
+ lastH += pen.height + 10;
3281
+ }
3282
+ }
3226
3283
  }
3227
3284
  }
3228
3285
  }
@@ -3566,13 +3623,19 @@ var Canvas = /** @class */ (function () {
3566
3623
  Canvas.prototype.movedActivePens = function (readyConnect) {
3567
3624
  var _this = this;
3568
3625
  // 鼠标松手才更新,此处是更新前的值
3569
- var initPens = deepClone(this.store.active, true);
3626
+ //follower
3627
+ var movedPens = this.getAllFollowersByPens(this.store.active, false);
3628
+ var initPens = deepClone(movedPens, true);
3570
3629
  // const pens = deepClone(this.store.active, true);
3571
3630
  var gridSize = this.store.data.gridSize || this.store.options.gridSize;
3572
3631
  var _a = this.store.data, origin = _a.origin, scale = _a.scale;
3573
3632
  var autoAlignGrid = this.store.options.autoAlignGrid && this.store.data.grid;
3574
- this.store.active.forEach(function (pen, i) {
3633
+ movedPens.forEach(function (pen) {
3575
3634
  var _a;
3635
+ var i = _this.movingPens.findIndex(function (item) { return item.id === pen.id + movingSuffix; });
3636
+ if (i < 0) {
3637
+ return;
3638
+ }
3576
3639
  var _b = _this.movingPens[i], x = _b.x, y = _b.y;
3577
3640
  var obj = { x: x, y: y };
3578
3641
  // 根据是否开启了自动网格对齐,来修正坐标
@@ -4816,10 +4879,10 @@ var Canvas = /** @class */ (function () {
4816
4879
  : pen.textHeight * scale;
4817
4880
  pen.calculative.textLeft =
4818
4881
  pen.textLeft < 1 && pen.textLeft > -1
4819
- ? pen.textLeft
4882
+ ? pen.textLeft * pen.calculative.worldRect.width
4820
4883
  : pen.textLeft * scale;
4821
4884
  pen.calculative.textTop =
4822
- pen.textTop < 1 && pen.textTop > -1 ? pen.textTop : pen.textTop * scale;
4885
+ pen.textTop < 1 && pen.textTop > -1 ? pen.textTop * pen.calculative.worldRect.height : pen.textTop * scale;
4823
4886
  if (pen.type === PenType.Line && pen.borderWidth) {
4824
4887
  pen.calculative.borderWidth = pen.borderWidth * scale;
4825
4888
  }
@@ -5374,6 +5437,7 @@ var Canvas = /** @class */ (function () {
5374
5437
  }
5375
5438
  }
5376
5439
  this.movingPens = deepClone(this.store.active, true);
5440
+ this.movingPens = this.getAllFollowersByPens(this.movingPens);
5377
5441
  var containChildPens = this.getAllByPens(this.movingPens);
5378
5442
  var copyContainChildPens = deepClone(containChildPens, true);
5379
5443
  // 考虑父子关系,修改 id
@@ -6463,6 +6527,71 @@ var Canvas = /** @class */ (function () {
6463
6527
  }
6464
6528
  return retPens.concat(pens);
6465
6529
  };
6530
+ Canvas.prototype.getAllFollowersByPens = function (pens, deep) {
6531
+ var e_22, _a, e_23, _b;
6532
+ if (deep === void 0) { deep = true; }
6533
+ var retPens = pens;
6534
+ try {
6535
+ for (var pens_10 = __values(pens), pens_10_1 = pens_10.next(); !pens_10_1.done; pens_10_1 = pens_10.next()) {
6536
+ var pen = pens_10_1.value;
6537
+ var followers = getAllFollowers(pen, this.store);
6538
+ if (deep) {
6539
+ followers = deepClone(followers, true);
6540
+ }
6541
+ var _loop_6 = function (follower) {
6542
+ if (!retPens.find(function (p) { return p.id === follower.id; })) {
6543
+ retPens.push(follower);
6544
+ }
6545
+ };
6546
+ try {
6547
+ 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()) {
6548
+ var follower = followers_1_1.value;
6549
+ _loop_6(follower);
6550
+ }
6551
+ }
6552
+ catch (e_23_1) { e_23 = { error: e_23_1 }; }
6553
+ finally {
6554
+ try {
6555
+ if (followers_1_1 && !followers_1_1.done && (_b = followers_1.return)) _b.call(followers_1);
6556
+ }
6557
+ finally { if (e_23) throw e_23.error; }
6558
+ }
6559
+ }
6560
+ }
6561
+ catch (e_22_1) { e_22 = { error: e_22_1 }; }
6562
+ finally {
6563
+ try {
6564
+ if (pens_10_1 && !pens_10_1.done && (_a = pens_10.return)) _a.call(pens_10);
6565
+ }
6566
+ finally { if (e_22) throw e_22.error; }
6567
+ }
6568
+ return retPens;
6569
+ };
6570
+ Canvas.prototype.setFollowers = function (pens) {
6571
+ if (pens === void 0) { pens = this.store.active; }
6572
+ if (!pens) {
6573
+ return;
6574
+ }
6575
+ if (pens.length < 2) {
6576
+ pens[0].followers = [];
6577
+ }
6578
+ else {
6579
+ //以最后一个
6580
+ var ids = pens.map(function (pen) { return pen.id; });
6581
+ ids.pop();
6582
+ var lastPen_1 = pens[pens.length - 1];
6583
+ if (!lastPen_1.followers) {
6584
+ lastPen_1.followers = ids;
6585
+ }
6586
+ else {
6587
+ ids.forEach(function (id) {
6588
+ if (!lastPen_1.followers.includes(id)) {
6589
+ lastPen_1.followers.push(id);
6590
+ }
6591
+ });
6592
+ }
6593
+ }
6594
+ };
6466
6595
  /**
6467
6596
  * 修改对应连线的 anchors
6468
6597
  * @param oldId 老 id
@@ -6473,7 +6602,7 @@ var Canvas = /** @class */ (function () {
6473
6602
  if (!Array.isArray(pen.connectedLines)) {
6474
6603
  return;
6475
6604
  }
6476
- var _loop_6 = function (index) {
6605
+ var _loop_7 = function (index) {
6477
6606
  var lineId = pen.connectedLines[index].lineId;
6478
6607
  var line = pastePens.find(function (pen) { return pen.id === lineId; });
6479
6608
  if (line) {
@@ -6491,7 +6620,7 @@ var Canvas = /** @class */ (function () {
6491
6620
  };
6492
6621
  var out_index_1;
6493
6622
  for (var index = 0; index < pen.connectedLines.length; index++) {
6494
- _loop_6(index);
6623
+ _loop_7(index);
6495
6624
  index = out_index_1;
6496
6625
  }
6497
6626
  };
@@ -6502,13 +6631,13 @@ var Canvas = /** @class */ (function () {
6502
6631
  * @param pastePens 此处复制的全部 pens (包含子节点)
6503
6632
  */
6504
6633
  Canvas.prototype.changeNodeConnectedLine = function (oldId, line, pastePens) {
6505
- var e_22, _a;
6634
+ var e_24, _a;
6506
6635
  var _b;
6507
6636
  var from = line.anchors[0];
6508
6637
  var to = line.anchors[line.anchors.length - 1];
6509
6638
  // 修改对应节点的 connectedLines
6510
6639
  var anchors = [from, to];
6511
- var _loop_7 = function (anchor) {
6640
+ var _loop_8 = function (anchor) {
6512
6641
  var nodeId = anchor.connectTo;
6513
6642
  if (nodeId) {
6514
6643
  var node = pastePens.find(function (pen) { return pen.id === nodeId; });
@@ -6535,15 +6664,15 @@ var Canvas = /** @class */ (function () {
6535
6664
  try {
6536
6665
  for (var anchors_1 = __values(anchors), anchors_1_1 = anchors_1.next(); !anchors_1_1.done; anchors_1_1 = anchors_1.next()) {
6537
6666
  var anchor = anchors_1_1.value;
6538
- _loop_7(anchor);
6667
+ _loop_8(anchor);
6539
6668
  }
6540
6669
  }
6541
- catch (e_22_1) { e_22 = { error: e_22_1 }; }
6670
+ catch (e_24_1) { e_24 = { error: e_24_1 }; }
6542
6671
  finally {
6543
6672
  try {
6544
6673
  if (anchors_1_1 && !anchors_1_1.done && (_a = anchors_1.return)) _a.call(anchors_1);
6545
6674
  }
6546
- finally { if (e_22) throw e_22.error; }
6675
+ finally { if (e_24) throw e_24.error; }
6547
6676
  }
6548
6677
  };
6549
6678
  Canvas.prototype.delete = function (pens, canDelLocked, history) {
@@ -6686,7 +6815,7 @@ var Canvas = /** @class */ (function () {
6686
6815
  var _this = this;
6687
6816
  var _a;
6688
6817
  if (pen.connectedLines) {
6689
- var _loop_8 = function (i) {
6818
+ var _loop_9 = function (i) {
6690
6819
  var _b = pen.connectedLines[i], lineId = _b.lineId, lineAnchor = _b.lineAnchor;
6691
6820
  var line = this_2.store.pens[lineId];
6692
6821
  if (line) {
@@ -6708,7 +6837,7 @@ var Canvas = /** @class */ (function () {
6708
6837
  };
6709
6838
  var this_2 = this;
6710
6839
  for (var i = 0; i < pen.connectedLines.length; i++) {
6711
- _loop_8(i);
6840
+ _loop_9(i);
6712
6841
  }
6713
6842
  }
6714
6843
  if (!pen.type) {
@@ -7161,7 +7290,7 @@ var Canvas = /** @class */ (function () {
7161
7290
  };
7162
7291
  };
7163
7292
  Canvas.prototype.toPng = function (padding, callback, containBkImg, maxWidth) {
7164
- var e_23, _a;
7293
+ var e_25, _a;
7165
7294
  if (padding === void 0) { padding = 2; }
7166
7295
  if (containBkImg === void 0) { containBkImg = false; }
7167
7296
  var rect = getRect(this.store.data.pens);
@@ -7293,12 +7422,12 @@ var Canvas = /** @class */ (function () {
7293
7422
  pen.calculative.active = active;
7294
7423
  }
7295
7424
  }
7296
- catch (e_23_1) { e_23 = { error: e_23_1 }; }
7425
+ catch (e_25_1) { e_25 = { error: e_25_1 }; }
7297
7426
  finally {
7298
7427
  try {
7299
7428
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
7300
7429
  }
7301
- finally { if (e_23) throw e_23.error; }
7430
+ finally { if (e_25) throw e_25.error; }
7302
7431
  }
7303
7432
  if (callback) {
7304
7433
  canvas.toBlob(callback);
@@ -7311,7 +7440,7 @@ var Canvas = /** @class */ (function () {
7311
7440
  return this.pensToPng(this.store.active, padding);
7312
7441
  };
7313
7442
  Canvas.prototype.pensToPng = function (pens, padding) {
7314
- var e_24, _a;
7443
+ var e_26, _a;
7315
7444
  if (pens === void 0) { pens = this.store.active; }
7316
7445
  if (padding === void 0) { padding = 2; }
7317
7446
  if (pens.length === 0) {
@@ -7365,12 +7494,12 @@ var Canvas = /** @class */ (function () {
7365
7494
  }
7366
7495
  }
7367
7496
  }
7368
- catch (e_24_1) { e_24 = { error: e_24_1 }; }
7497
+ catch (e_26_1) { e_26 = { error: e_26_1 }; }
7369
7498
  finally {
7370
7499
  try {
7371
7500
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
7372
7501
  }
7373
- finally { if (e_24) throw e_24.error; }
7502
+ finally { if (e_26) throw e_26.error; }
7374
7503
  }
7375
7504
  return canvas.toDataURL();
7376
7505
  };