@meta2d/core 1.0.23 → 1.0.25

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/src/core.js CHANGED
@@ -83,7 +83,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
83
83
  };
84
84
  import { commonAnchors, commonPens, cube } from './diagrams';
85
85
  import { Canvas } from './canvas';
86
- import { calcInView, calcTextDrawRect, calcTextLines, calcTextRect, facePen, formatAttrs, getAllChildren, getFromAnchor, getParent, getToAnchor, getWords, LockState, PenType, renderPenRaw, setElemPosition, connectLine, nearestAnchor, setChildValue, isAncestor, } from './pen';
86
+ import { calcInView, calcTextDrawRect, calcTextLines, calcTextRect, facePen, formatAttrs, getAllChildren, getFromAnchor, getParent, getToAnchor, getWords, LockState, PenType, renderPenRaw, setElemPosition, connectLine, nearestAnchor, setChildValue, isAncestor, isShowChild, } from './pen';
87
87
  import { rotatePoint } from './point';
88
88
  import { clearStore, EditType, globalStore, register, registerAnchors, registerCanvasDraw, useStore, } from './store';
89
89
  import { formatPadding, loadCss, s8, valueInArray, valueInRange, } from './utils';
@@ -95,6 +95,7 @@ import * as mqtt from 'mqtt/dist/mqtt.min.js';
95
95
  import pkg from '../package.json';
96
96
  import { lockedError } from './utils/error';
97
97
  import { Scroll } from './scroll';
98
+ import { getter } from './utils/object';
98
99
  var Meta2d = /** @class */ (function () {
99
100
  function Meta2d(parent, opts) {
100
101
  var _this = this;
@@ -168,6 +169,13 @@ var Meta2d = /** @class */ (function () {
168
169
  _this.onSizeUpdate();
169
170
  break;
170
171
  }
172
+ if (_this.store.messageEvents[eventName]) {
173
+ _this.store.messageEvents[eventName].forEach(function (item) {
174
+ item.event.actions.forEach(function (action) {
175
+ _this.events[action.action](item.pen, action);
176
+ });
177
+ });
178
+ }
171
179
  };
172
180
  this.doEvent = function (pen, eventName) {
173
181
  var _a, _b;
@@ -548,7 +556,7 @@ var Meta2d = /** @class */ (function () {
548
556
  this.events[EventAction.SendData] = function (pen, e) {
549
557
  var value = deepClone(e.value);
550
558
  if (value && typeof value === 'object') {
551
- if (e.targetType === 'action') {
559
+ if (e.targetType === 'id') {
552
560
  var _pen = e.params ? _this.findOne(e.params) : pen;
553
561
  for (var key in value) {
554
562
  if (!value[key]) {
@@ -604,18 +612,34 @@ var Meta2d = /** @class */ (function () {
604
612
  };
605
613
  Meta2d.prototype.sendDataToNetWork = function (value, network) {
606
614
  return __awaiter(this, void 0, void 0, function () {
607
- var res, clients_1, mqttClient_1, websockets, websocket_1;
615
+ var i, keys, params, res, clients_1, mqttClient_1, websockets, websocket_1;
608
616
  return __generator(this, function (_a) {
609
617
  switch (_a.label) {
610
618
  case 0:
611
619
  if (!network.url) {
612
620
  return [2 /*return*/];
613
621
  }
614
- if (!(network.type === 'http')) return [3 /*break*/, 2];
615
- return [4 /*yield*/, fetch(network.url, {
616
- headers: network.headers,
622
+ if (!(network.protocol === 'http')) return [3 /*break*/, 2];
623
+ if (typeof network.headers === 'object') {
624
+ for (i in network.headers) {
625
+ keys = network.headers[i].match(/(?<=\$\{).*?(?=\})/g);
626
+ if (keys) {
627
+ network.headers[i] = network.headers[i].replace("${" + keys[0] + "}", this.getDynamicParam(keys[0]));
628
+ }
629
+ }
630
+ }
631
+ params = undefined;
632
+ if (network.method === 'GET') {
633
+ params =
634
+ '?' +
635
+ Object.keys(value)
636
+ .map(function (key) { return key + '=' + value[key]; })
637
+ .join('&');
638
+ }
639
+ return [4 /*yield*/, fetch(network.url + (params ? params : ''), {
640
+ headers: network.headers || {},
617
641
  method: network.method,
618
- body: value,
642
+ body: network.method === 'POST' ? JSON.stringify(value) : undefined,
619
643
  })];
620
644
  case 1:
621
645
  res = _a.sent();
@@ -624,7 +648,7 @@ var Meta2d = /** @class */ (function () {
624
648
  }
625
649
  return [3 /*break*/, 3];
626
650
  case 2:
627
- if (network.type === 'mqtt') {
651
+ if (network.protocol === 'mqtt') {
628
652
  clients_1 = this.mqttClients.filter(function (client) { return client.options.href === network.url; });
629
653
  if (clients_1 && clients_1.length) {
630
654
  if (clients_1[0].connected) {
@@ -644,7 +668,7 @@ var Meta2d = /** @class */ (function () {
644
668
  });
645
669
  }
646
670
  }
647
- else if (network.type === 'websocket') {
671
+ else if (network.protocol === 'websocket') {
648
672
  websockets = this.websockets.filter(function (socket) { return socket.url === network.url; });
649
673
  if (websockets && websockets.length) {
650
674
  if (websockets[0].readyState === 1) {
@@ -831,11 +855,17 @@ var Meta2d = /** @class */ (function () {
831
855
  finally { if (e_3) throw e_3.error; }
832
856
  }
833
857
  }
858
+ this.canvas.patchFlagsLines.forEach(function (pen) {
859
+ if (pen.type) {
860
+ _this.canvas.initLineRect(pen);
861
+ }
862
+ });
834
863
  if (!render) {
835
864
  this.canvas.opening = true;
836
865
  }
837
866
  this.initBindDatas();
838
867
  this.initBinds();
868
+ this.initMessageEvents();
839
869
  this.render();
840
870
  this.listenSocket();
841
871
  this.connectSocket();
@@ -1002,6 +1032,9 @@ var Meta2d = /** @class */ (function () {
1002
1032
  pen.onMove && pen.onMove(pen);
1003
1033
  }
1004
1034
  });
1035
+ if (lock > 0) {
1036
+ this.initMessageEvents();
1037
+ }
1005
1038
  };
1006
1039
  // end - 当前鼠标位置,是否作为终点
1007
1040
  Meta2d.prototype.finishDrawLine = function (end) {
@@ -1111,6 +1144,10 @@ var Meta2d = /** @class */ (function () {
1111
1144
  clearStore(this.store);
1112
1145
  this.hideInput();
1113
1146
  this.canvas.tooltip.hide();
1147
+ if (this.map && this.map.isShow) {
1148
+ this.map.show();
1149
+ this.map.setView();
1150
+ }
1114
1151
  this.canvas.clearCanvas();
1115
1152
  sessionStorage.removeItem('page');
1116
1153
  this.store.clipboard = undefined;
@@ -1645,7 +1682,9 @@ var Meta2d = /** @class */ (function () {
1645
1682
  return __generator(this, function (_a) {
1646
1683
  switch (_a.label) {
1647
1684
  case 0: return [4 /*yield*/, fetch(item.http, {
1685
+ method: item.method || 'GET',
1648
1686
  headers: item.httpHeaders,
1687
+ body: item.method === 'POST' ? JSON.stringify(item.body) : undefined,
1649
1688
  })];
1650
1689
  case 1:
1651
1690
  res = _a.sent();
@@ -1931,6 +1970,28 @@ var Meta2d = /** @class */ (function () {
1931
1970
  }
1932
1971
  }
1933
1972
  };
1973
+ //获取动态参数
1974
+ Meta2d.prototype.getDynamicParam = function (key) {
1975
+ function queryURLParams() {
1976
+ var url = window.location.href.split('?')[1];
1977
+ var urlSearchParams = new URLSearchParams(url);
1978
+ var params = Object.fromEntries(urlSearchParams.entries());
1979
+ return params;
1980
+ }
1981
+ function getCookie(name) {
1982
+ var arr;
1983
+ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)');
1984
+ if ((arr = document.cookie.match(reg))) {
1985
+ return decodeURIComponent(arr[2]);
1986
+ }
1987
+ else {
1988
+ return '';
1989
+ }
1990
+ }
1991
+ var params = queryURLParams();
1992
+ var value = params[key] || localStorage[key] || getCookie(key) || '';
1993
+ return value;
1994
+ };
1934
1995
  Meta2d.prototype.onNetworkConnect = function (https) {
1935
1996
  var _this = this;
1936
1997
  var enable = this.store.data.enableMock;
@@ -1944,15 +2005,31 @@ var Meta2d = /** @class */ (function () {
1944
2005
  _this.penMock(pen);
1945
2006
  });
1946
2007
  https.forEach(function (item) { return __awaiter(_this, void 0, void 0, function () {
1947
- var res, data;
2008
+ var i, keys, i, keys, res, data;
1948
2009
  return __generator(this, function (_a) {
1949
2010
  switch (_a.label) {
1950
2011
  case 0:
1951
2012
  if (!item.url) return [3 /*break*/, 3];
2013
+ if (typeof item.headers === 'object') {
2014
+ for (i in item.headers) {
2015
+ keys = item.headers[i].match(/(?<=\$\{).*?(?=\})/g);
2016
+ if (keys) {
2017
+ item.headers[i] = item.headers[i].replace("${" + keys[0] + "}", this.getDynamicParam(keys[0]));
2018
+ }
2019
+ }
2020
+ }
2021
+ if (typeof item.body === 'object') {
2022
+ for (i in item.body) {
2023
+ keys = item.body[i].match(/(?<=\$\{).*?(?=\})/g);
2024
+ if (keys) {
2025
+ item.body[i] = item.body[i].replace("${" + keys[0] + "}", this.getDynamicParam(keys[0]));
2026
+ }
2027
+ }
2028
+ }
1952
2029
  return [4 /*yield*/, fetch(item.url, {
1953
2030
  headers: item.headers,
1954
2031
  method: item.method,
1955
- body: item.method === 'GET' ? undefined : item.body,
2032
+ body: item.method === 'GET' ? undefined : JSON.stringify(item.body),
1956
2033
  })];
1957
2034
  case 1:
1958
2035
  res = _a.sent();
@@ -2016,6 +2093,9 @@ var Meta2d = /** @class */ (function () {
2016
2093
  if (!Array.isArray(data)) {
2017
2094
  data = [data];
2018
2095
  }
2096
+ if (!data.length) {
2097
+ return;
2098
+ }
2019
2099
  if (data[0].dataId) {
2020
2100
  this.setDatas(data);
2021
2101
  }
@@ -2219,6 +2299,23 @@ var Meta2d = /** @class */ (function () {
2219
2299
  Meta2d.prototype.clearDropdownList = function () {
2220
2300
  this.canvas.clearDropdownList();
2221
2301
  };
2302
+ Meta2d.prototype.initMessageEvents = function () {
2303
+ var _this = this;
2304
+ this.store.data.pens.forEach(function (pen) {
2305
+ var _a;
2306
+ (_a = pen.events) === null || _a === void 0 ? void 0 : _a.forEach(function (event) {
2307
+ if (event.name === 'message' && event.message) {
2308
+ if (!_this.store.messageEvents[event.message]) {
2309
+ _this.store.messageEvents[event.message] = [];
2310
+ }
2311
+ _this.store.messageEvents[event.message].push({
2312
+ pen: pen,
2313
+ event: event,
2314
+ });
2315
+ }
2316
+ });
2317
+ });
2318
+ };
2222
2319
  Meta2d.prototype.judgeCondition = function (pen, key, condition) {
2223
2320
  var type = condition.type, target = condition.target, fnJs = condition.fnJs, fn = condition.fn, operator = condition.operator, valueType = condition.valueType;
2224
2321
  var can = false;
@@ -2245,37 +2342,38 @@ var Meta2d = /** @class */ (function () {
2245
2342
  if (valueType === 'prop') {
2246
2343
  value = this.store.pens[target][condition.value];
2247
2344
  }
2345
+ var compareValue = getter(pen, key);
2248
2346
  switch (operator) {
2249
2347
  case '>':
2250
- can = pen[key] > +value;
2348
+ can = compareValue > +value;
2251
2349
  break;
2252
2350
  case '>=':
2253
- can = pen[key] >= +value;
2351
+ can = compareValue >= +value;
2254
2352
  break;
2255
2353
  case '<':
2256
- can = pen[key] < +value;
2354
+ can = compareValue < +value;
2257
2355
  break;
2258
2356
  case '<=':
2259
- can = pen[key] <= +value;
2357
+ can = compareValue <= +value;
2260
2358
  break;
2261
2359
  case '=':
2262
2360
  case '==':
2263
- can = pen[key] == value;
2361
+ can = compareValue == value;
2264
2362
  break;
2265
2363
  case '!=':
2266
- can = pen[key] != value;
2364
+ can = compareValue != value;
2267
2365
  break;
2268
2366
  case '[)':
2269
- can = valueInRange(+pen[key], value);
2367
+ can = valueInRange(+compareValue, value);
2270
2368
  break;
2271
2369
  case '![)':
2272
- can = !valueInRange(+pen[key], value);
2370
+ can = !valueInRange(+compareValue, value);
2273
2371
  break;
2274
2372
  case '[]':
2275
- can = valueInArray(+pen[key], value);
2373
+ can = valueInArray(+compareValue, value);
2276
2374
  break;
2277
2375
  case '![]':
2278
- can = !valueInArray(+pen[key], value);
2376
+ can = !valueInArray(+compareValue, value);
2279
2377
  break;
2280
2378
  }
2281
2379
  }
@@ -2338,6 +2436,9 @@ var Meta2d = /** @class */ (function () {
2338
2436
  if (containBkImg === void 0) { containBkImg = false; }
2339
2437
  return this.canvas.toPng(padding, callback, containBkImg);
2340
2438
  };
2439
+ Meta2d.prototype.activeToPng = function (padding) {
2440
+ return this.canvas.activeToPng(padding);
2441
+ };
2341
2442
  /**
2342
2443
  * 下载 png
2343
2444
  * @param name 传入参数自带文件后缀名 例如:'test.png'
@@ -2372,6 +2473,53 @@ var Meta2d = /** @class */ (function () {
2372
2473
  a.dispatchEvent(evt);
2373
2474
  });
2374
2475
  };
2476
+ Meta2d.prototype.downloadSvg = function () {
2477
+ var e_7, _a;
2478
+ if (!window.C2S) {
2479
+ console.error('请先加载乐吾乐官网下的canvas2svg.js', 'https://assets.le5lecdn.com/2d/canvas2svg.js');
2480
+ throw new Error('请先加载乐吾乐官网下的canvas2svg.js');
2481
+ }
2482
+ var rect = this.getRect();
2483
+ rect.x -= 10;
2484
+ rect.y -= 10;
2485
+ var ctx = new window.C2S(rect.width + 20, rect.height + 20);
2486
+ ctx.textBaseline = 'middle';
2487
+ try {
2488
+ for (var _b = __values(this.store.data.pens), _c = _b.next(); !_c.done; _c = _b.next()) {
2489
+ var pen = _c.value;
2490
+ if (pen.visible == false || !isShowChild(pen, this.store)) {
2491
+ continue;
2492
+ }
2493
+ renderPenRaw(ctx, pen, rect);
2494
+ }
2495
+ }
2496
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
2497
+ finally {
2498
+ try {
2499
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2500
+ }
2501
+ finally { if (e_7) throw e_7.error; }
2502
+ }
2503
+ var mySerializedSVG = ctx.getSerializedSvg();
2504
+ if (this.store.data.background) {
2505
+ mySerializedSVG = mySerializedSVG.replace('{{bk}}', '');
2506
+ mySerializedSVG = mySerializedSVG.replace('{{bkRect}}', "<rect x=\"0\" y=\"0\" width=\"100%\" height=\"100%\" fill=\"" + this.store.data.background + "\"></rect>");
2507
+ }
2508
+ else {
2509
+ mySerializedSVG = mySerializedSVG.replace('{{bk}}', '');
2510
+ mySerializedSVG = mySerializedSVG.replace('{{bkRect}}', '');
2511
+ }
2512
+ mySerializedSVG = mySerializedSVG.replace(/--le5le--/g, '&#x');
2513
+ var urlObject = window.URL;
2514
+ var export_blob = new Blob([mySerializedSVG]);
2515
+ var url = urlObject.createObjectURL(export_blob);
2516
+ var a = document.createElement('a');
2517
+ a.setAttribute('download', (this.store.data.name || 'le5le.meta2d') + ".svg");
2518
+ a.setAttribute('href', url);
2519
+ var evt = document.createEvent('MouseEvents');
2520
+ evt.initEvent('click', true, true);
2521
+ a.dispatchEvent(evt);
2522
+ };
2375
2523
  Meta2d.prototype.getRect = function (pens) {
2376
2524
  if (pens === void 0) { pens = this.store.data.pens; }
2377
2525
  return getRect(pens);
@@ -2429,12 +2577,20 @@ var Meta2d = /** @class */ (function () {
2429
2577
  var w = (width - padding[1] - padding[3]) / _width;
2430
2578
  var h = (height - padding[0] - padding[2]) / _height;
2431
2579
  var ratio = w;
2432
- if (fit) {
2433
- // 完整显示取小的
2434
- ratio = w > h ? h : w;
2580
+ if (fit === 'width') {
2581
+ ratio = w;
2582
+ }
2583
+ else if (fit === 'height') {
2584
+ ratio = h;
2435
2585
  }
2436
2586
  else {
2437
- ratio = w > h ? w : h;
2587
+ if (fit) {
2588
+ // 完整显示取小的
2589
+ ratio = w > h ? h : w;
2590
+ }
2591
+ else {
2592
+ ratio = w > h ? w : h;
2593
+ }
2438
2594
  }
2439
2595
  // 该方法直接更改画布的 scale 属性,所以比率应该乘以当前 scale
2440
2596
  this.scale(ratio * this.store.data.scale);
@@ -2689,7 +2845,7 @@ var Meta2d = /** @class */ (function () {
2689
2845
  this.formatPainter();
2690
2846
  };
2691
2847
  Meta2d.prototype.alignNodes = function (align, pens, rect) {
2692
- var e_7, _a;
2848
+ var e_8, _a;
2693
2849
  if (pens === void 0) { pens = this.store.data.pens; }
2694
2850
  !rect && (rect = this.getPenRect(this.getRect(pens)));
2695
2851
  var initPens = deepClone(pens); // 原 pens ,深拷贝一下
@@ -2699,12 +2855,12 @@ var Meta2d = /** @class */ (function () {
2699
2855
  this.alignPen(align, item, rect);
2700
2856
  }
2701
2857
  }
2702
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
2858
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
2703
2859
  finally {
2704
2860
  try {
2705
2861
  if (pens_1_1 && !pens_1_1.done && (_a = pens_1.return)) _a.call(pens_1);
2706
2862
  }
2707
- finally { if (e_7) throw e_7.error; }
2863
+ finally { if (e_8) throw e_8.error; }
2708
2864
  }
2709
2865
  this.render();
2710
2866
  this.pushHistory({
@@ -2793,7 +2949,7 @@ var Meta2d = /** @class */ (function () {
2793
2949
  * @param distance 总的宽 or 高
2794
2950
  */
2795
2951
  Meta2d.prototype.spaceBetweenByDirection = function (direction, pens, distance) {
2796
- var e_8, _a;
2952
+ var e_9, _a;
2797
2953
  var _this = this;
2798
2954
  if (pens === void 0) { pens = this.store.data.pens; }
2799
2955
  !distance && (distance = this.getPenRect(this.getRect(pens))[direction]);
@@ -2827,12 +2983,12 @@ var Meta2d = /** @class */ (function () {
2827
2983
  this.setValue(__assign({ id: pen.id }, penRect), { render: false, doEvent: false });
2828
2984
  }
2829
2985
  }
2830
- catch (e_8_1) { e_8 = { error: e_8_1 }; }
2986
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
2831
2987
  finally {
2832
2988
  try {
2833
2989
  if (pens_2_1 && !pens_2_1.done && (_a = pens_2.return)) _a.call(pens_2);
2834
2990
  }
2835
- finally { if (e_8) throw e_8.error; }
2991
+ finally { if (e_9) throw e_9.error; }
2836
2992
  }
2837
2993
  this.render();
2838
2994
  this.pushHistory({
@@ -2949,7 +3105,7 @@ var Meta2d = /** @class */ (function () {
2949
3105
  * @param pens pen 置顶的画笔
2950
3106
  */
2951
3107
  Meta2d.prototype.top = function (pens) {
2952
- var e_9, _a;
3108
+ var e_10, _a;
2953
3109
  var _this = this;
2954
3110
  if (!pens)
2955
3111
  pens = this.store.active;
@@ -2977,12 +3133,12 @@ var Meta2d = /** @class */ (function () {
2977
3133
  _loop_3(pen);
2978
3134
  }
2979
3135
  }
2980
- catch (e_9_1) { e_9 = { error: e_9_1 }; }
3136
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
2981
3137
  finally {
2982
3138
  try {
2983
3139
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2984
3140
  }
2985
- finally { if (e_9) throw e_9.error; }
3141
+ finally { if (e_10) throw e_10.error; }
2986
3142
  }
2987
3143
  };
2988
3144
  /**
@@ -2998,7 +3154,7 @@ var Meta2d = /** @class */ (function () {
2998
3154
  * @param pens 画笔们,注意 pen 必须在该数组内才有效
2999
3155
  */
3000
3156
  Meta2d.prototype.bottom = function (pens) {
3001
- var e_10, _a;
3157
+ var e_11, _a;
3002
3158
  if (!pens)
3003
3159
  pens = this.store.active;
3004
3160
  if (!Array.isArray(pens))
@@ -3029,12 +3185,12 @@ var Meta2d = /** @class */ (function () {
3029
3185
  _loop_4(pen);
3030
3186
  }
3031
3187
  }
3032
- catch (e_10_1) { e_10 = { error: e_10_1 }; }
3188
+ catch (e_11_1) { e_11 = { error: e_11_1 }; }
3033
3189
  finally {
3034
3190
  try {
3035
3191
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
3036
3192
  }
3037
- finally { if (e_10) throw e_10.error; }
3193
+ finally { if (e_11) throw e_11.error; }
3038
3194
  }
3039
3195
  };
3040
3196
  /**
@@ -3043,7 +3199,7 @@ var Meta2d = /** @class */ (function () {
3043
3199
  * @param pen 画笔
3044
3200
  */
3045
3201
  Meta2d.prototype.upByArea = function (pen) {
3046
- var _a, e_11, _b;
3202
+ var _a, e_12, _b;
3047
3203
  var _this = this;
3048
3204
  var index = this.store.data.pens.findIndex(function (p) { return p.id === pen.id; });
3049
3205
  if (index === -1) {
@@ -3093,12 +3249,12 @@ var Meta2d = /** @class */ (function () {
3093
3249
  _loop_6(pen_2);
3094
3250
  }
3095
3251
  }
3096
- catch (e_11_1) { e_11 = { error: e_11_1 }; }
3252
+ catch (e_12_1) { e_12 = { error: e_12_1 }; }
3097
3253
  finally {
3098
3254
  try {
3099
3255
  if (allPens_1_1 && !allPens_1_1.done && (_b = allPens_1.return)) _b.call(allPens_1);
3100
3256
  }
3101
- finally { if (e_11) throw e_11.error; }
3257
+ finally { if (e_12) throw e_12.error; }
3102
3258
  }
3103
3259
  this.initImageCanvas([pen]);
3104
3260
  };
@@ -3139,7 +3295,7 @@ var Meta2d = /** @class */ (function () {
3139
3295
  * @param pens 画笔
3140
3296
  */
3141
3297
  Meta2d.prototype.up = function (pens) {
3142
- var e_12, _a;
3298
+ var e_13, _a;
3143
3299
  var _this = this;
3144
3300
  if (!pens)
3145
3301
  pens = this.store.active;
@@ -3192,12 +3348,12 @@ var Meta2d = /** @class */ (function () {
3192
3348
  _loop_7(pen);
3193
3349
  }
3194
3350
  }
3195
- catch (e_12_1) { e_12 = { error: e_12_1 }; }
3351
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
3196
3352
  finally {
3197
3353
  try {
3198
3354
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
3199
3355
  }
3200
- finally { if (e_12) throw e_12.error; }
3356
+ finally { if (e_13) throw e_13.error; }
3201
3357
  }
3202
3358
  };
3203
3359
  /**
@@ -3205,7 +3361,7 @@ var Meta2d = /** @class */ (function () {
3205
3361
  * @param pen 画笔
3206
3362
  */
3207
3363
  Meta2d.prototype.down = function (pens) {
3208
- var e_13, _a;
3364
+ var e_14, _a;
3209
3365
  var _this = this;
3210
3366
  if (!pens)
3211
3367
  pens = this.store.active;
@@ -3260,12 +3416,12 @@ var Meta2d = /** @class */ (function () {
3260
3416
  _loop_9(pen);
3261
3417
  }
3262
3418
  }
3263
- catch (e_13_1) { e_13 = { error: e_13_1 }; }
3419
+ catch (e_14_1) { e_14 = { error: e_14_1 }; }
3264
3420
  finally {
3265
3421
  try {
3266
3422
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
3267
3423
  }
3268
- finally { if (e_13) throw e_13.error; }
3424
+ finally { if (e_14) throw e_14.error; }
3269
3425
  }
3270
3426
  };
3271
3427
  Meta2d.prototype.setLayer = function (pen, toIndex, pens) {
@@ -3340,7 +3496,7 @@ var Meta2d = /** @class */ (function () {
3340
3496
  var nextNodes_1 = [];
3341
3497
  // 2. 遍历出线的 nextNode
3342
3498
  lines.forEach(function (line) {
3343
- var e_14, _a;
3499
+ var e_15, _a;
3344
3500
  var lineNextNode = _this.nextNode(line);
3345
3501
  var _loop_11 = function (node) {
3346
3502
  var have = nextNodes_1.find(function (next) { return next.id === node.id; });
@@ -3353,12 +3509,12 @@ var Meta2d = /** @class */ (function () {
3353
3509
  _loop_11(node);
3354
3510
  }
3355
3511
  }
3356
- catch (e_14_1) { e_14 = { error: e_14_1 }; }
3512
+ catch (e_15_1) { e_15 = { error: e_15_1 }; }
3357
3513
  finally {
3358
3514
  try {
3359
3515
  if (lineNextNode_1_1 && !lineNextNode_1_1.done && (_a = lineNextNode_1.return)) _a.call(lineNextNode_1);
3360
3516
  }
3361
- finally { if (e_14) throw e_14.error; }
3517
+ finally { if (e_15) throw e_15.error; }
3362
3518
  }
3363
3519
  });
3364
3520
  return nextNodes_1;
@@ -3381,7 +3537,7 @@ var Meta2d = /** @class */ (function () {
3381
3537
  var preNodes_1 = [];
3382
3538
  // 2. 遍历入线的 preNode
3383
3539
  lines.forEach(function (line) {
3384
- var e_15, _a;
3540
+ var e_16, _a;
3385
3541
  var linePreNode = _this.previousNode(line);
3386
3542
  var _loop_12 = function (node) {
3387
3543
  var have = preNodes_1.find(function (pre) { return pre.id === node.id; });
@@ -3394,12 +3550,12 @@ var Meta2d = /** @class */ (function () {
3394
3550
  _loop_12(node);
3395
3551
  }
3396
3552
  }
3397
- catch (e_15_1) { e_15 = { error: e_15_1 }; }
3553
+ catch (e_16_1) { e_16 = { error: e_16_1 }; }
3398
3554
  finally {
3399
3555
  try {
3400
3556
  if (linePreNode_1_1 && !linePreNode_1_1.done && (_a = linePreNode_1.return)) _a.call(linePreNode_1);
3401
3557
  }
3402
- finally { if (e_15) throw e_15.error; }
3558
+ finally { if (e_16) throw e_16.error; }
3403
3559
  }
3404
3560
  });
3405
3561
  return preNodes_1;
@@ -3675,7 +3831,7 @@ var Meta2d = /** @class */ (function () {
3675
3831
  : deepClone(__spreadArray([parent], __read(components), false));
3676
3832
  };
3677
3833
  Meta2d.prototype.setVisible = function (pen, visible, render) {
3678
- var e_16, _a;
3834
+ var e_17, _a;
3679
3835
  if (render === void 0) { render = true; }
3680
3836
  this.onSizeUpdate();
3681
3837
  this.setValue({ id: pen.id, visible: visible }, { render: false, doEvent: false });
@@ -3687,12 +3843,12 @@ var Meta2d = /** @class */ (function () {
3687
3843
  child && this.setVisible(child, visible, false);
3688
3844
  }
3689
3845
  }
3690
- catch (e_16_1) { e_16 = { error: e_16_1 }; }
3846
+ catch (e_17_1) { e_17 = { error: e_17_1 }; }
3691
3847
  finally {
3692
3848
  try {
3693
3849
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
3694
3850
  }
3695
- finally { if (e_16) throw e_16.error; }
3851
+ finally { if (e_17) throw e_17.error; }
3696
3852
  }
3697
3853
  }
3698
3854
  render && this.render();