@meta2d/core 1.0.25 → 1.0.27

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.
@@ -394,6 +394,7 @@ var Canvas = /** @class */ (function () {
394
394
  if (e.ctrlKey || e.metaKey) {
395
395
  x = -10;
396
396
  }
397
+ x = x * _this.store.data.scale;
397
398
  _this.translatePens(_this.store.active, x, 0);
398
399
  break;
399
400
  case 'ArrowUp':
@@ -408,6 +409,7 @@ var Canvas = /** @class */ (function () {
408
409
  if (e.ctrlKey || e.metaKey) {
409
410
  y = -10;
410
411
  }
412
+ y = y * _this.store.data.scale;
411
413
  _this.translatePens(_this.store.active, 0, y);
412
414
  break;
413
415
  case 'ArrowRight':
@@ -422,6 +424,7 @@ var Canvas = /** @class */ (function () {
422
424
  if (e.ctrlKey || e.metaKey) {
423
425
  x = 10;
424
426
  }
427
+ x = x * _this.store.data.scale;
425
428
  _this.translatePens(_this.store.active, x, 0);
426
429
  break;
427
430
  case 'ArrowDown':
@@ -436,6 +439,7 @@ var Canvas = /** @class */ (function () {
436
439
  if (e.ctrlKey || e.metaKey) {
437
440
  y = 10;
438
441
  }
442
+ y = y * _this.store.data.scale;
439
443
  _this.translatePens(_this.store.active, 0, y);
440
444
  break;
441
445
  case 'd':
@@ -1571,6 +1575,7 @@ var Canvas = /** @class */ (function () {
1571
1575
  var hoverType = HoverType.None;
1572
1576
  _this.store.hover = undefined;
1573
1577
  _this.store.hoverAnchor = undefined;
1578
+ _this.title.hide();
1574
1579
  _this.store.pointAt = undefined;
1575
1580
  _this.store.pointAtIndex = undefined;
1576
1581
  var activeLine = _this.store.active.length === 1 && _this.store.active[0].type;
@@ -1662,7 +1667,7 @@ var Canvas = /** @class */ (function () {
1662
1667
  this.inPens = function (pt, pens) {
1663
1668
  var hoverType = HoverType.None;
1664
1669
  var _loop_2 = function (i) {
1665
- var e_1, _a, e_2, _b, e_3, _c;
1670
+ var e_1, _a, e_2, _b;
1666
1671
  var pen = pens[i];
1667
1672
  if (pen.visible == false ||
1668
1673
  pen.calculative.inView == false ||
@@ -1676,47 +1681,48 @@ var Canvas = /** @class */ (function () {
1676
1681
  return "continue";
1677
1682
  }
1678
1683
  //anchor title
1679
- if (_this.store.data.locked) {
1680
- // locked>0
1681
- if (pen.calculative.worldAnchors) {
1682
- try {
1683
- for (var _d = (e_1 = void 0, __values(pen.calculative.worldAnchors)), _e = _d.next(); !_e.done; _e = _d.next()) {
1684
- var anchor = _e.value;
1685
- if (hitPoint(pt, anchor, _this.pointSize, anchor.penId ? _this.store.pens[anchor.penId] : undefined)) {
1686
- _this.title.show(anchor, pen);
1687
- if (anchor.title) {
1688
- return "break-outer";
1689
- }
1690
- }
1691
- }
1692
- }
1693
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1694
- finally {
1695
- try {
1696
- if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
1697
- }
1698
- finally { if (e_1) throw e_1.error; }
1699
- }
1700
- }
1701
- }
1684
+ // if (this.store.data.locked) {
1685
+ // // locked>0
1686
+ // if (pen.calculative.worldAnchors) {
1687
+ // for (const anchor of pen.calculative.worldAnchors) {
1688
+ // if (
1689
+ // hitPoint(
1690
+ // pt,
1691
+ // anchor,
1692
+ // this.pointSize,
1693
+ // anchor.penId ? this.store.pens[anchor.penId] : undefined
1694
+ // )
1695
+ // ) {
1696
+ // this.title.show(anchor, pen);
1697
+ // if (anchor.title) {
1698
+ // break outer;
1699
+ // }
1700
+ // }
1701
+ // }
1702
+ // }
1703
+ // }
1702
1704
  // 锚点
1703
1705
  if (!_this.store.data.locked && _this.hotkeyType !== HotkeyType.Resize) {
1704
1706
  if (pen.calculative.worldAnchors) {
1705
1707
  try {
1706
- for (var _f = (e_2 = void 0, __values(pen.calculative.worldAnchors)), _g = _f.next(); !_g.done; _g = _f.next()) {
1707
- var anchor = _g.value;
1708
+ for (var _c = (e_1 = void 0, __values(pen.calculative.worldAnchors)), _d = _c.next(); !_d.done; _d = _c.next()) {
1709
+ var anchor = _d.value;
1708
1710
  hoverType = _this.inAnchor(pt, pen, anchor);
1709
1711
  if (hoverType) {
1712
+ //title显示
1713
+ var _anchor = deepClone(anchor);
1714
+ Object.assign(_anchor, pt);
1715
+ _this.title.show(_anchor, pen);
1710
1716
  return "break-outer";
1711
1717
  }
1712
1718
  }
1713
1719
  }
1714
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
1720
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1715
1721
  finally {
1716
1722
  try {
1717
- if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
1723
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
1718
1724
  }
1719
- finally { if (e_2) throw e_2.error; }
1725
+ finally { if (e_1) throw e_1.error; }
1720
1726
  }
1721
1727
  }
1722
1728
  }
@@ -1777,7 +1783,7 @@ var Canvas = /** @class */ (function () {
1777
1783
  _this.store.pointAt = pt;
1778
1784
  // 锚点贴边吸附
1779
1785
  if (!pt.ctrlKey) {
1780
- var _h = _this.store.hover.calculative.worldRect, x = _h.x, y = _h.y, ex = _h.ex, ey = _h.ey, rotate_1 = _h.rotate, center_1 = _h.center;
1786
+ var _e = _this.store.hover.calculative.worldRect, x = _e.x, y = _e.y, ex = _e.ex, ey = _e.ey, rotate_1 = _e.rotate, center_1 = _e.center;
1781
1787
  if (rotate_1) {
1782
1788
  var pts = [
1783
1789
  { x: x, y: y },
@@ -1790,7 +1796,7 @@ var Canvas = /** @class */ (function () {
1790
1796
  });
1791
1797
  var last = pts[pts.length - 1];
1792
1798
  try {
1793
- for (var pts_1 = (e_3 = void 0, __values(pts)), pts_1_1 = pts_1.next(); !pts_1_1.done; pts_1_1 = pts_1.next()) {
1799
+ for (var pts_1 = (e_2 = void 0, __values(pts)), pts_1_1 = pts_1.next(); !pts_1_1.done; pts_1_1 = pts_1.next()) {
1794
1800
  var item = pts_1_1.value;
1795
1801
  if (last.y > pt.y !== item.y > pt.y) {
1796
1802
  var tempx = item.x +
@@ -1802,12 +1808,12 @@ var Canvas = /** @class */ (function () {
1802
1808
  last = item;
1803
1809
  }
1804
1810
  }
1805
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
1811
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
1806
1812
  finally {
1807
1813
  try {
1808
- if (pts_1_1 && !pts_1_1.done && (_c = pts_1.return)) _c.call(pts_1);
1814
+ if (pts_1_1 && !pts_1_1.done && (_b = pts_1.return)) _b.call(pts_1);
1809
1815
  }
1810
- finally { if (e_3) throw e_3.error; }
1816
+ finally { if (e_2) throw e_2.error; }
1811
1817
  }
1812
1818
  }
1813
1819
  else {
@@ -1840,7 +1846,7 @@ var Canvas = /** @class */ (function () {
1840
1846
  return hoverType;
1841
1847
  };
1842
1848
  this.dockInAnchor = function (pt) {
1843
- var e_4, _a;
1849
+ var e_3, _a;
1844
1850
  var _b, _c;
1845
1851
  _this.store.hover = undefined;
1846
1852
  for (var i = _this.store.data.pens.length - 1; i >= 0; --i) {
@@ -1860,7 +1866,7 @@ var Canvas = /** @class */ (function () {
1860
1866
  if (_this.hotkeyType !== HotkeyType.Resize) {
1861
1867
  if (pen.calculative.worldAnchors) {
1862
1868
  try {
1863
- for (var _d = (e_4 = void 0, __values(pen.calculative.worldAnchors)), _e = _d.next(); !_e.done; _e = _d.next()) {
1869
+ for (var _d = (e_3 = void 0, __values(pen.calculative.worldAnchors)), _e = _d.next(); !_e.done; _e = _d.next()) {
1864
1870
  var anchor = _e.value;
1865
1871
  if (anchor.twoWay === TwoWay.In) {
1866
1872
  var to = getToAnchor(_this.store.active[0]);
@@ -1880,17 +1886,21 @@ var Canvas = /** @class */ (function () {
1880
1886
  ((_c = _this.store.activeAnchor) === null || _c === void 0 ? void 0 : _c.twoWay) === TwoWay.Disable) {
1881
1887
  continue;
1882
1888
  }
1889
+ _this.title.hide();
1883
1890
  if (_this.inAnchor(pt, pen, anchor)) {
1891
+ var _anchor = deepClone(anchor);
1892
+ Object.assign(_anchor, pt);
1893
+ _this.title.show(_anchor, pen);
1884
1894
  return true;
1885
1895
  }
1886
1896
  }
1887
1897
  }
1888
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
1898
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
1889
1899
  finally {
1890
1900
  try {
1891
1901
  if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
1892
1902
  }
1893
- finally { if (e_4) throw e_4.error; }
1903
+ finally { if (e_3) throw e_3.error; }
1894
1904
  }
1895
1905
  }
1896
1906
  }
@@ -1945,7 +1955,7 @@ var Canvas = /** @class */ (function () {
1945
1955
  _this.patchFlags = false;
1946
1956
  };
1947
1957
  this.renderPens = function () {
1948
- var e_5, _a;
1958
+ var e_4, _a;
1949
1959
  var ctx = _this.offscreen.getContext('2d');
1950
1960
  ctx.strokeStyle = getGlobalColor(_this.store);
1951
1961
  try {
@@ -1959,12 +1969,12 @@ var Canvas = /** @class */ (function () {
1959
1969
  }
1960
1970
  }
1961
1971
  }
1962
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
1972
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
1963
1973
  finally {
1964
1974
  try {
1965
1975
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1966
1976
  }
1967
- finally { if (e_5) throw e_5.error; }
1977
+ finally { if (e_4) throw e_4.error; }
1968
1978
  }
1969
1979
  if (_this.drawingLine) {
1970
1980
  renderPen(ctx, _this.drawingLine);
@@ -2001,9 +2011,13 @@ var Canvas = /** @class */ (function () {
2001
2011
  ctx.translate(-_this.activeRect.center.x, -_this.activeRect.center.y);
2002
2012
  }
2003
2013
  ctx.strokeStyle = _this.store.options.activeColor;
2004
- ctx.globalAlpha = 0.3;
2014
+ ctx.globalAlpha = _this.store.options.activeGlobalAlpha || 0.3;
2005
2015
  ctx.beginPath();
2016
+ ctx.lineWidth = _this.store.options.activeLineWidth || 1;
2017
+ ctx.setLineDash(_this.store.options.activeLineDash || []);
2006
2018
  ctx.strokeRect(_this.activeRect.x, _this.activeRect.y, _this.activeRect.width, _this.activeRect.height);
2019
+ ctx.setLineDash([]);
2020
+ ctx.lineWidth = 1;
2007
2021
  ctx.globalAlpha = 1;
2008
2022
  if (getPensLock(_this.store.active) ||
2009
2023
  getPensDisableRotate(_this.store.active) ||
@@ -2075,7 +2089,7 @@ var Canvas = /** @class */ (function () {
2075
2089
  }
2076
2090
  if (anchor.type === PointType.Line) {
2077
2091
  //旋转的情况
2078
- var _rotate = _this.store.pens[anchor.penId].rotate;
2092
+ var _rotate = _this.store.pens[anchor.penId].rotate || 0;
2079
2093
  if (_this.store.pens[anchor.penId].calculative.flipX) {
2080
2094
  _rotate *= -1;
2081
2095
  }
@@ -2204,7 +2218,7 @@ var Canvas = /** @class */ (function () {
2204
2218
  * @returns 复制后的画笔
2205
2219
  */
2206
2220
  this.pastePen = function (pen, parentId) {
2207
- var e_6, _a;
2221
+ var e_5, _a;
2208
2222
  var oldId = pen.id;
2209
2223
  randomId(pen);
2210
2224
  pen.parentId = parentId;
@@ -2245,12 +2259,12 @@ var Canvas = /** @class */ (function () {
2245
2259
  _loop_3(childId);
2246
2260
  }
2247
2261
  }
2248
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
2262
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
2249
2263
  finally {
2250
2264
  try {
2251
2265
  if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
2252
2266
  }
2253
- finally { if (e_6) throw e_6.error; }
2267
+ finally { if (e_5) throw e_5.error; }
2254
2268
  }
2255
2269
  }
2256
2270
  pen.children = newChildren;
@@ -2545,7 +2559,7 @@ var Canvas = /** @class */ (function () {
2545
2559
  _this.render();
2546
2560
  };
2547
2561
  this.setDropdownList = function (search) {
2548
- var e_7, _a;
2562
+ var e_6, _a;
2549
2563
  _this.clearDropdownList();
2550
2564
  if (!_this.store.data.locked) {
2551
2565
  return;
@@ -2592,12 +2606,12 @@ var Canvas = /** @class */ (function () {
2592
2606
  ++i;
2593
2607
  }
2594
2608
  }
2595
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
2609
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
2596
2610
  finally {
2597
2611
  try {
2598
2612
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2599
2613
  }
2600
- finally { if (e_7) throw e_7.error; }
2614
+ finally { if (e_6) throw e_6.error; }
2601
2615
  }
2602
2616
  if (!_this.dropdown.hasChildNodes()) {
2603
2617
  var none = document.createElement('div');
@@ -2894,7 +2908,7 @@ var Canvas = /** @class */ (function () {
2894
2908
  Canvas.prototype.dropPens = function (pens, e) {
2895
2909
  return __awaiter(this, void 0, void 0, function () {
2896
2910
  var pens_2, pens_2_1, pen, pens_3, pens_3_1, pen, pens_4, pens_4_1, pen, width, height, rect_1, flag, pens_5, pens_5_1, pen, points;
2897
- var e_8, _a, e_9, _b, e_10, _c, e_11, _d;
2911
+ var e_7, _a, e_8, _b, e_9, _c, e_10, _d;
2898
2912
  return __generator(this, function (_e) {
2899
2913
  switch (_e.label) {
2900
2914
  case 0:
@@ -2905,12 +2919,12 @@ var Canvas = /** @class */ (function () {
2905
2919
  !pen.parentId && this.randomCombineId(pen, pens);
2906
2920
  }
2907
2921
  }
2908
- catch (e_8_1) { e_8 = { error: e_8_1 }; }
2922
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
2909
2923
  finally {
2910
2924
  try {
2911
2925
  if (pens_2_1 && !pens_2_1.done && (_a = pens_2.return)) _a.call(pens_2);
2912
2926
  }
2913
- finally { if (e_8) throw e_8.error; }
2927
+ finally { if (e_7) throw e_7.error; }
2914
2928
  }
2915
2929
  try {
2916
2930
  for (pens_3 = __values(pens), pens_3_1 = pens_3.next(); !pens_3_1.done; pens_3_1 = pens_3.next()) {
@@ -2923,12 +2937,12 @@ var Canvas = /** @class */ (function () {
2923
2937
  this.store.pens[pen.id] = pen;
2924
2938
  }
2925
2939
  }
2926
- catch (e_9_1) { e_9 = { error: e_9_1 }; }
2940
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
2927
2941
  finally {
2928
2942
  try {
2929
2943
  if (pens_3_1 && !pens_3_1.done && (_b = pens_3.return)) _b.call(pens_3);
2930
2944
  }
2931
- finally { if (e_9) throw e_9.error; }
2945
+ finally { if (e_8) throw e_8.error; }
2932
2946
  }
2933
2947
  try {
2934
2948
  // // 计算区域
@@ -2950,12 +2964,12 @@ var Canvas = /** @class */ (function () {
2950
2964
  }
2951
2965
  }
2952
2966
  }
2953
- catch (e_10_1) { e_10 = { error: e_10_1 }; }
2967
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
2954
2968
  finally {
2955
2969
  try {
2956
2970
  if (pens_4_1 && !pens_4_1.done && (_c = pens_4.return)) _c.call(pens_4);
2957
2971
  }
2958
- finally { if (e_10) throw e_10.error; }
2972
+ finally { if (e_9) throw e_9.error; }
2959
2973
  }
2960
2974
  width = this.store.data.width || this.store.options.width;
2961
2975
  height = this.store.data.height || this.store.options.height;
@@ -2988,12 +3002,12 @@ var Canvas = /** @class */ (function () {
2988
3002
  }
2989
3003
  }
2990
3004
  }
2991
- catch (e_11_1) { e_11 = { error: e_11_1 }; }
3005
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
2992
3006
  finally {
2993
3007
  try {
2994
3008
  if (pens_5_1 && !pens_5_1.done && (_d = pens_5.return)) _d.call(pens_5);
2995
3009
  }
2996
- finally { if (e_11) throw e_11.error; }
3010
+ finally { if (e_10) throw e_10.error; }
2997
3011
  }
2998
3012
  if (flag) {
2999
3013
  console.info('画笔在大屏范围外');
@@ -3012,7 +3026,7 @@ var Canvas = /** @class */ (function () {
3012
3026
  });
3013
3027
  };
3014
3028
  Canvas.prototype.randomCombineId = function (pen, pens, parentId) {
3015
- var e_12, _a;
3029
+ var e_11, _a;
3016
3030
  randomId(pen);
3017
3031
  pen.parentId = parentId;
3018
3032
  var newChildren = [];
@@ -3029,12 +3043,12 @@ var Canvas = /** @class */ (function () {
3029
3043
  _loop_4(childId);
3030
3044
  }
3031
3045
  }
3032
- catch (e_12_1) { e_12 = { error: e_12_1 }; }
3046
+ catch (e_11_1) { e_11 = { error: e_11_1 }; }
3033
3047
  finally {
3034
3048
  try {
3035
3049
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
3036
3050
  }
3037
- finally { if (e_12) throw e_12.error; }
3051
+ finally { if (e_11) throw e_11.error; }
3038
3052
  }
3039
3053
  }
3040
3054
  pen.children = newChildren;
@@ -3043,7 +3057,7 @@ var Canvas = /** @class */ (function () {
3043
3057
  Canvas.prototype.addPens = function (pens, history) {
3044
3058
  return __awaiter(this, void 0, void 0, function () {
3045
3059
  var _a, list, pens_6, pens_6_1, pen;
3046
- var e_13, _b;
3060
+ var e_12, _b;
3047
3061
  return __generator(this, function (_c) {
3048
3062
  switch (_c.label) {
3049
3063
  case 0:
@@ -3068,12 +3082,12 @@ var Canvas = /** @class */ (function () {
3068
3082
  list.push(pen);
3069
3083
  }
3070
3084
  }
3071
- catch (e_13_1) { e_13 = { error: e_13_1 }; }
3085
+ catch (e_12_1) { e_12 = { error: e_12_1 }; }
3072
3086
  finally {
3073
3087
  try {
3074
3088
  if (pens_6_1 && !pens_6_1.done && (_b = pens_6.return)) _b.call(pens_6);
3075
3089
  }
3076
- finally { if (e_13) throw e_13.error; }
3090
+ finally { if (e_12) throw e_12.error; }
3077
3091
  }
3078
3092
  this.render();
3079
3093
  this.store.emitter.emit('add', list);
@@ -3343,7 +3357,7 @@ var Canvas = /** @class */ (function () {
3343
3357
  this.patchFlags = true;
3344
3358
  };
3345
3359
  Canvas.prototype.active = function (pens, emit) {
3346
- var e_14, _a, _b;
3360
+ var e_13, _a, _b;
3347
3361
  if (emit === void 0) { emit = true; }
3348
3362
  if (this.store.active) {
3349
3363
  emit && this.store.emitter.emit('inactive', this.store.active);
@@ -3355,12 +3369,12 @@ var Canvas = /** @class */ (function () {
3355
3369
  setChildrenActive(pen, false);
3356
3370
  }
3357
3371
  }
3358
- catch (e_14_1) { e_14 = { error: e_14_1 }; }
3372
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
3359
3373
  finally {
3360
3374
  try {
3361
3375
  if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
3362
3376
  }
3363
- finally { if (e_14) throw e_14.error; }
3377
+ finally { if (e_13) throw e_13.error; }
3364
3378
  }
3365
3379
  }
3366
3380
  this.store.active = [];
@@ -3546,7 +3560,7 @@ var Canvas = /** @class */ (function () {
3546
3560
  return HoverType.None;
3547
3561
  };
3548
3562
  Canvas.prototype.resize = function (w, h) {
3549
- var e_15, _a;
3563
+ var e_14, _a;
3550
3564
  w = w || this.parentElement.clientWidth;
3551
3565
  h = h || this.parentElement.clientHeight;
3552
3566
  this.width = w;
@@ -3587,12 +3601,12 @@ var Canvas = /** @class */ (function () {
3587
3601
  calcInView(pen);
3588
3602
  }
3589
3603
  }
3590
- catch (e_15_1) { e_15 = { error: e_15_1 }; }
3604
+ catch (e_14_1) { e_14 = { error: e_14_1 }; }
3591
3605
  finally {
3592
3606
  try {
3593
3607
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
3594
3608
  }
3595
- finally { if (e_15) throw e_15.error; }
3609
+ finally { if (e_14) throw e_14.error; }
3596
3610
  }
3597
3611
  };
3598
3612
  Canvas.prototype.clearCanvas = function () {
@@ -3657,7 +3671,7 @@ var Canvas = /** @class */ (function () {
3657
3671
  this.store.histories.splice(this.store.historyIndex + 1, this.store.histories.length - this.store.historyIndex - 1);
3658
3672
  }
3659
3673
  (_a = action.pens) === null || _a === void 0 ? void 0 : _a.forEach(function (pen) {
3660
- var e_16, _a;
3674
+ var e_15, _a;
3661
3675
  var found;
3662
3676
  if (action.initPens) {
3663
3677
  try {
@@ -3668,12 +3682,12 @@ var Canvas = /** @class */ (function () {
3668
3682
  }
3669
3683
  }
3670
3684
  }
3671
- catch (e_16_1) { e_16 = { error: e_16_1 }; }
3685
+ catch (e_15_1) { e_15 = { error: e_15_1 }; }
3672
3686
  finally {
3673
3687
  try {
3674
3688
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
3675
3689
  }
3676
- finally { if (e_16) throw e_16.error; }
3690
+ finally { if (e_15) throw e_15.error; }
3677
3691
  }
3678
3692
  }
3679
3693
  if (found) {
@@ -4322,7 +4336,7 @@ var Canvas = /** @class */ (function () {
4322
4336
  this.onMovePens();
4323
4337
  };
4324
4338
  Canvas.prototype.onMovePens = function () {
4325
- var e_17, _a;
4339
+ var e_16, _a;
4326
4340
  var _b;
4327
4341
  var map = this.parent.map;
4328
4342
  if (map && map.isShow) {
@@ -4347,12 +4361,12 @@ var Canvas = /** @class */ (function () {
4347
4361
  }
4348
4362
  }
4349
4363
  }
4350
- catch (e_17_1) { e_17 = { error: e_17_1 }; }
4364
+ catch (e_16_1) { e_16 = { error: e_16_1 }; }
4351
4365
  finally {
4352
4366
  try {
4353
4367
  if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
4354
4368
  }
4355
- finally { if (e_17) throw e_17.error; }
4369
+ finally { if (e_16) throw e_16.error; }
4356
4370
  }
4357
4371
  };
4358
4372
  /**
@@ -4364,7 +4378,8 @@ var Canvas = /** @class */ (function () {
4364
4378
  var _this = this;
4365
4379
  var _a;
4366
4380
  if (center === void 0) { center = { x: 0, y: 0 }; }
4367
- var _b = this.store.options, minScale = _b.minScale, maxScale = _b.maxScale;
4381
+ var minScale = this.store.data.minScale || this.store.options.minScale;
4382
+ var maxScale = this.store.data.maxScale || this.store.options.maxScale;
4368
4383
  if (!(scale >= minScale && scale <= maxScale)) {
4369
4384
  return;
4370
4385
  }
@@ -4412,7 +4427,7 @@ var Canvas = /** @class */ (function () {
4412
4427
  });
4413
4428
  };
4414
4429
  Canvas.prototype.rotatePens = function (e) {
4415
- var e_18, _a;
4430
+ var e_17, _a;
4416
4431
  var _this = this;
4417
4432
  if (!this.initPens) {
4418
4433
  this.initPens = deepClone(this.getAllByPens(this.store.active));
@@ -4439,12 +4454,12 @@ var Canvas = /** @class */ (function () {
4439
4454
  this.updateLines(pen);
4440
4455
  }
4441
4456
  }
4442
- catch (e_18_1) { e_18 = { error: e_18_1 }; }
4457
+ catch (e_17_1) { e_17 = { error: e_17_1 }; }
4443
4458
  finally {
4444
4459
  try {
4445
4460
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
4446
4461
  }
4447
- finally { if (e_18) throw e_18.error; }
4462
+ finally { if (e_17) throw e_17.error; }
4448
4463
  }
4449
4464
  this.lastRotate = this.activeRect.rotate;
4450
4465
  this.getSizeCPs();
@@ -4977,8 +4992,6 @@ var Canvas = /** @class */ (function () {
4977
4992
  Canvas.prototype.translatePens = function (pens, x, y, doing) {
4978
4993
  var _this = this;
4979
4994
  if (pens === void 0) { pens = this.store.active; }
4980
- x = x * this.store.data.scale;
4981
- y = y * this.store.data.scale;
4982
4995
  if (!pens || !pens.length) {
4983
4996
  return;
4984
4997
  }
@@ -5342,7 +5355,7 @@ var Canvas = /** @class */ (function () {
5342
5355
  return;
5343
5356
  }
5344
5357
  requestAnimationFrame(function () {
5345
- var e_19, _a;
5358
+ var e_18, _a;
5346
5359
  var now = Date.now();
5347
5360
  if (now - _this.lastAnimateRender < _this.store.options.animateInterval) {
5348
5361
  if (_this.store.animates.size > 0) {
@@ -5427,12 +5440,12 @@ var Canvas = /** @class */ (function () {
5427
5440
  _loop_5(pen);
5428
5441
  }
5429
5442
  }
5430
- catch (e_19_1) { e_19 = { error: e_19_1 }; }
5443
+ catch (e_18_1) { e_18 = { error: e_18_1 }; }
5431
5444
  finally {
5432
5445
  try {
5433
5446
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
5434
5447
  }
5435
- finally { if (e_19) throw e_19.error; }
5448
+ finally { if (e_18) throw e_18.error; }
5436
5449
  }
5437
5450
  if (active) {
5438
5451
  _this.calcActiveRect();
@@ -5519,7 +5532,7 @@ var Canvas = /** @class */ (function () {
5519
5532
  var _a;
5520
5533
  return __awaiter(this, void 0, void 0, function () {
5521
5534
  var clipboardText, clipboard, _b, _c, offset, pos, curPage, rootPens, rootPens_1, rootPens_1_1, pen;
5522
- var e_20, _d;
5535
+ var e_19, _d;
5523
5536
  return __generator(this, function (_e) {
5524
5537
  switch (_e.label) {
5525
5538
  case 0:
@@ -5592,12 +5605,12 @@ var Canvas = /** @class */ (function () {
5592
5605
  this.pastePen(pen, undefined);
5593
5606
  }
5594
5607
  }
5595
- catch (e_20_1) { e_20 = { error: e_20_1 }; }
5608
+ catch (e_19_1) { e_19 = { error: e_19_1 }; }
5596
5609
  finally {
5597
5610
  try {
5598
5611
  if (rootPens_1_1 && !rootPens_1_1.done && (_d = rootPens_1.return)) _d.call(rootPens_1);
5599
5612
  }
5600
- finally { if (e_20) throw e_20.error; }
5613
+ finally { if (e_19) throw e_19.error; }
5601
5614
  }
5602
5615
  sessionStorage.setItem('page', clipboard.page);
5603
5616
  this.active(rootPens);
@@ -5615,7 +5628,7 @@ var Canvas = /** @class */ (function () {
5615
5628
  * @param pens 不包含子节点
5616
5629
  */
5617
5630
  Canvas.prototype.getAllByPens = function (pens) {
5618
- var e_21, _a;
5631
+ var e_20, _a;
5619
5632
  var retPens = [];
5620
5633
  try {
5621
5634
  for (var pens_8 = __values(pens), pens_8_1 = pens_8.next(); !pens_8_1.done; pens_8_1 = pens_8.next()) {
@@ -5623,12 +5636,12 @@ var Canvas = /** @class */ (function () {
5623
5636
  retPens.push.apply(retPens, __spreadArray([], __read(deepClone(getAllChildren(pen, this.store), true)), false));
5624
5637
  }
5625
5638
  }
5626
- catch (e_21_1) { e_21 = { error: e_21_1 }; }
5639
+ catch (e_20_1) { e_20 = { error: e_20_1 }; }
5627
5640
  finally {
5628
5641
  try {
5629
5642
  if (pens_8_1 && !pens_8_1.done && (_a = pens_8.return)) _a.call(pens_8);
5630
5643
  }
5631
- finally { if (e_21) throw e_21.error; }
5644
+ finally { if (e_20) throw e_20.error; }
5632
5645
  }
5633
5646
  return retPens.concat(pens);
5634
5647
  };
@@ -5671,7 +5684,7 @@ var Canvas = /** @class */ (function () {
5671
5684
  * @param pastePens 此处复制的全部 pens (包含子节点)
5672
5685
  */
5673
5686
  Canvas.prototype.changeNodeConnectedLine = function (oldId, line, pastePens) {
5674
- var e_22, _a;
5687
+ var e_21, _a;
5675
5688
  var _b;
5676
5689
  var from = line.anchors[0];
5677
5690
  var to = line.anchors[line.anchors.length - 1];
@@ -5707,12 +5720,12 @@ var Canvas = /** @class */ (function () {
5707
5720
  _loop_7(anchor);
5708
5721
  }
5709
5722
  }
5710
- catch (e_22_1) { e_22 = { error: e_22_1 }; }
5723
+ catch (e_21_1) { e_21 = { error: e_21_1 }; }
5711
5724
  finally {
5712
5725
  try {
5713
5726
  if (anchors_1_1 && !anchors_1_1.done && (_a = anchors_1.return)) _a.call(anchors_1);
5714
5727
  }
5715
- finally { if (e_22) throw e_22.error; }
5728
+ finally { if (e_21) throw e_21.error; }
5716
5729
  }
5717
5730
  };
5718
5731
  Canvas.prototype.delete = function (pens, canDelLocked, history) {
@@ -6226,7 +6239,7 @@ var Canvas = /** @class */ (function () {
6226
6239
  };
6227
6240
  };
6228
6241
  Canvas.prototype.toPng = function (padding, callback, containBkImg) {
6229
- var e_23, _a;
6242
+ var e_22, _a;
6230
6243
  if (padding === void 0) { padding = 2; }
6231
6244
  if (containBkImg === void 0) { containBkImg = false; }
6232
6245
  var rect = getRect(this.store.data.pens);
@@ -6314,12 +6327,12 @@ var Canvas = /** @class */ (function () {
6314
6327
  pen.calculative.active = active;
6315
6328
  }
6316
6329
  }
6317
- catch (e_23_1) { e_23 = { error: e_23_1 }; }
6330
+ catch (e_22_1) { e_22 = { error: e_22_1 }; }
6318
6331
  finally {
6319
6332
  try {
6320
6333
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
6321
6334
  }
6322
- finally { if (e_23) throw e_23.error; }
6335
+ finally { if (e_22) throw e_22.error; }
6323
6336
  }
6324
6337
  if (callback) {
6325
6338
  canvas.toBlob(callback);
@@ -6328,7 +6341,7 @@ var Canvas = /** @class */ (function () {
6328
6341
  return canvas.toDataURL();
6329
6342
  };
6330
6343
  Canvas.prototype.activeToPng = function (padding) {
6331
- var e_24, _a;
6344
+ var e_23, _a;
6332
6345
  if (padding === void 0) { padding = 2; }
6333
6346
  var allPens = this.getAllByPens(this.store.active);
6334
6347
  var ids = allPens.map(function (pen) { return pen.id; });
@@ -6378,12 +6391,12 @@ var Canvas = /** @class */ (function () {
6378
6391
  }
6379
6392
  }
6380
6393
  }
6381
- catch (e_24_1) { e_24 = { error: e_24_1 }; }
6394
+ catch (e_23_1) { e_23 = { error: e_23_1 }; }
6382
6395
  finally {
6383
6396
  try {
6384
6397
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
6385
6398
  }
6386
- finally { if (e_24) throw e_24.error; }
6399
+ finally { if (e_23) throw e_23.error; }
6387
6400
  }
6388
6401
  return canvas.toDataURL();
6389
6402
  };