@meta2d/core 1.0.24 → 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';
@@ -169,6 +169,13 @@ var Meta2d = /** @class */ (function () {
169
169
  _this.onSizeUpdate();
170
170
  break;
171
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
+ }
172
179
  };
173
180
  this.doEvent = function (pen, eventName) {
174
181
  var _a, _b;
@@ -549,7 +556,7 @@ var Meta2d = /** @class */ (function () {
549
556
  this.events[EventAction.SendData] = function (pen, e) {
550
557
  var value = deepClone(e.value);
551
558
  if (value && typeof value === 'object') {
552
- if (e.targetType === 'action') {
559
+ if (e.targetType === 'id') {
553
560
  var _pen = e.params ? _this.findOne(e.params) : pen;
554
561
  for (var key in value) {
555
562
  if (!value[key]) {
@@ -605,18 +612,34 @@ var Meta2d = /** @class */ (function () {
605
612
  };
606
613
  Meta2d.prototype.sendDataToNetWork = function (value, network) {
607
614
  return __awaiter(this, void 0, void 0, function () {
608
- var res, clients_1, mqttClient_1, websockets, websocket_1;
615
+ var i, keys, params, res, clients_1, mqttClient_1, websockets, websocket_1;
609
616
  return __generator(this, function (_a) {
610
617
  switch (_a.label) {
611
618
  case 0:
612
619
  if (!network.url) {
613
620
  return [2 /*return*/];
614
621
  }
615
- if (!(network.type === 'http')) return [3 /*break*/, 2];
616
- return [4 /*yield*/, fetch(network.url, {
617
- 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 || {},
618
641
  method: network.method,
619
- body: value,
642
+ body: network.method === 'POST' ? JSON.stringify(value) : undefined,
620
643
  })];
621
644
  case 1:
622
645
  res = _a.sent();
@@ -625,7 +648,7 @@ var Meta2d = /** @class */ (function () {
625
648
  }
626
649
  return [3 /*break*/, 3];
627
650
  case 2:
628
- if (network.type === 'mqtt') {
651
+ if (network.protocol === 'mqtt') {
629
652
  clients_1 = this.mqttClients.filter(function (client) { return client.options.href === network.url; });
630
653
  if (clients_1 && clients_1.length) {
631
654
  if (clients_1[0].connected) {
@@ -645,7 +668,7 @@ var Meta2d = /** @class */ (function () {
645
668
  });
646
669
  }
647
670
  }
648
- else if (network.type === 'websocket') {
671
+ else if (network.protocol === 'websocket') {
649
672
  websockets = this.websockets.filter(function (socket) { return socket.url === network.url; });
650
673
  if (websockets && websockets.length) {
651
674
  if (websockets[0].readyState === 1) {
@@ -842,6 +865,7 @@ var Meta2d = /** @class */ (function () {
842
865
  }
843
866
  this.initBindDatas();
844
867
  this.initBinds();
868
+ this.initMessageEvents();
845
869
  this.render();
846
870
  this.listenSocket();
847
871
  this.connectSocket();
@@ -1008,6 +1032,9 @@ var Meta2d = /** @class */ (function () {
1008
1032
  pen.onMove && pen.onMove(pen);
1009
1033
  }
1010
1034
  });
1035
+ if (lock > 0) {
1036
+ this.initMessageEvents();
1037
+ }
1011
1038
  };
1012
1039
  // end - 当前鼠标位置,是否作为终点
1013
1040
  Meta2d.prototype.finishDrawLine = function (end) {
@@ -1117,6 +1144,10 @@ var Meta2d = /** @class */ (function () {
1117
1144
  clearStore(this.store);
1118
1145
  this.hideInput();
1119
1146
  this.canvas.tooltip.hide();
1147
+ if (this.map && this.map.isShow) {
1148
+ this.map.show();
1149
+ this.map.setView();
1150
+ }
1120
1151
  this.canvas.clearCanvas();
1121
1152
  sessionStorage.removeItem('page');
1122
1153
  this.store.clipboard = undefined;
@@ -1651,7 +1682,9 @@ var Meta2d = /** @class */ (function () {
1651
1682
  return __generator(this, function (_a) {
1652
1683
  switch (_a.label) {
1653
1684
  case 0: return [4 /*yield*/, fetch(item.http, {
1685
+ method: item.method || 'GET',
1654
1686
  headers: item.httpHeaders,
1687
+ body: item.method === 'POST' ? JSON.stringify(item.body) : undefined,
1655
1688
  })];
1656
1689
  case 1:
1657
1690
  res = _a.sent();
@@ -1937,6 +1970,28 @@ var Meta2d = /** @class */ (function () {
1937
1970
  }
1938
1971
  }
1939
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
+ };
1940
1995
  Meta2d.prototype.onNetworkConnect = function (https) {
1941
1996
  var _this = this;
1942
1997
  var enable = this.store.data.enableMock;
@@ -1950,15 +2005,31 @@ var Meta2d = /** @class */ (function () {
1950
2005
  _this.penMock(pen);
1951
2006
  });
1952
2007
  https.forEach(function (item) { return __awaiter(_this, void 0, void 0, function () {
1953
- var res, data;
2008
+ var i, keys, i, keys, res, data;
1954
2009
  return __generator(this, function (_a) {
1955
2010
  switch (_a.label) {
1956
2011
  case 0:
1957
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
+ }
1958
2029
  return [4 /*yield*/, fetch(item.url, {
1959
2030
  headers: item.headers,
1960
2031
  method: item.method,
1961
- body: item.method === 'GET' ? undefined : item.body,
2032
+ body: item.method === 'GET' ? undefined : JSON.stringify(item.body),
1962
2033
  })];
1963
2034
  case 1:
1964
2035
  res = _a.sent();
@@ -2228,6 +2299,23 @@ var Meta2d = /** @class */ (function () {
2228
2299
  Meta2d.prototype.clearDropdownList = function () {
2229
2300
  this.canvas.clearDropdownList();
2230
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
+ };
2231
2319
  Meta2d.prototype.judgeCondition = function (pen, key, condition) {
2232
2320
  var type = condition.type, target = condition.target, fnJs = condition.fnJs, fn = condition.fn, operator = condition.operator, valueType = condition.valueType;
2233
2321
  var can = false;
@@ -2348,6 +2436,9 @@ var Meta2d = /** @class */ (function () {
2348
2436
  if (containBkImg === void 0) { containBkImg = false; }
2349
2437
  return this.canvas.toPng(padding, callback, containBkImg);
2350
2438
  };
2439
+ Meta2d.prototype.activeToPng = function (padding) {
2440
+ return this.canvas.activeToPng(padding);
2441
+ };
2351
2442
  /**
2352
2443
  * 下载 png
2353
2444
  * @param name 传入参数自带文件后缀名 例如:'test.png'
@@ -2382,6 +2473,53 @@ var Meta2d = /** @class */ (function () {
2382
2473
  a.dispatchEvent(evt);
2383
2474
  });
2384
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
+ };
2385
2523
  Meta2d.prototype.getRect = function (pens) {
2386
2524
  if (pens === void 0) { pens = this.store.data.pens; }
2387
2525
  return getRect(pens);
@@ -2439,12 +2577,20 @@ var Meta2d = /** @class */ (function () {
2439
2577
  var w = (width - padding[1] - padding[3]) / _width;
2440
2578
  var h = (height - padding[0] - padding[2]) / _height;
2441
2579
  var ratio = w;
2442
- if (fit) {
2443
- // 完整显示取小的
2444
- ratio = w > h ? h : w;
2580
+ if (fit === 'width') {
2581
+ ratio = w;
2582
+ }
2583
+ else if (fit === 'height') {
2584
+ ratio = h;
2445
2585
  }
2446
2586
  else {
2447
- 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
+ }
2448
2594
  }
2449
2595
  // 该方法直接更改画布的 scale 属性,所以比率应该乘以当前 scale
2450
2596
  this.scale(ratio * this.store.data.scale);
@@ -2699,7 +2845,7 @@ var Meta2d = /** @class */ (function () {
2699
2845
  this.formatPainter();
2700
2846
  };
2701
2847
  Meta2d.prototype.alignNodes = function (align, pens, rect) {
2702
- var e_7, _a;
2848
+ var e_8, _a;
2703
2849
  if (pens === void 0) { pens = this.store.data.pens; }
2704
2850
  !rect && (rect = this.getPenRect(this.getRect(pens)));
2705
2851
  var initPens = deepClone(pens); // 原 pens ,深拷贝一下
@@ -2709,12 +2855,12 @@ var Meta2d = /** @class */ (function () {
2709
2855
  this.alignPen(align, item, rect);
2710
2856
  }
2711
2857
  }
2712
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
2858
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
2713
2859
  finally {
2714
2860
  try {
2715
2861
  if (pens_1_1 && !pens_1_1.done && (_a = pens_1.return)) _a.call(pens_1);
2716
2862
  }
2717
- finally { if (e_7) throw e_7.error; }
2863
+ finally { if (e_8) throw e_8.error; }
2718
2864
  }
2719
2865
  this.render();
2720
2866
  this.pushHistory({
@@ -2803,7 +2949,7 @@ var Meta2d = /** @class */ (function () {
2803
2949
  * @param distance 总的宽 or 高
2804
2950
  */
2805
2951
  Meta2d.prototype.spaceBetweenByDirection = function (direction, pens, distance) {
2806
- var e_8, _a;
2952
+ var e_9, _a;
2807
2953
  var _this = this;
2808
2954
  if (pens === void 0) { pens = this.store.data.pens; }
2809
2955
  !distance && (distance = this.getPenRect(this.getRect(pens))[direction]);
@@ -2837,12 +2983,12 @@ var Meta2d = /** @class */ (function () {
2837
2983
  this.setValue(__assign({ id: pen.id }, penRect), { render: false, doEvent: false });
2838
2984
  }
2839
2985
  }
2840
- catch (e_8_1) { e_8 = { error: e_8_1 }; }
2986
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
2841
2987
  finally {
2842
2988
  try {
2843
2989
  if (pens_2_1 && !pens_2_1.done && (_a = pens_2.return)) _a.call(pens_2);
2844
2990
  }
2845
- finally { if (e_8) throw e_8.error; }
2991
+ finally { if (e_9) throw e_9.error; }
2846
2992
  }
2847
2993
  this.render();
2848
2994
  this.pushHistory({
@@ -2959,7 +3105,7 @@ var Meta2d = /** @class */ (function () {
2959
3105
  * @param pens pen 置顶的画笔
2960
3106
  */
2961
3107
  Meta2d.prototype.top = function (pens) {
2962
- var e_9, _a;
3108
+ var e_10, _a;
2963
3109
  var _this = this;
2964
3110
  if (!pens)
2965
3111
  pens = this.store.active;
@@ -2987,12 +3133,12 @@ var Meta2d = /** @class */ (function () {
2987
3133
  _loop_3(pen);
2988
3134
  }
2989
3135
  }
2990
- catch (e_9_1) { e_9 = { error: e_9_1 }; }
3136
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
2991
3137
  finally {
2992
3138
  try {
2993
3139
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2994
3140
  }
2995
- finally { if (e_9) throw e_9.error; }
3141
+ finally { if (e_10) throw e_10.error; }
2996
3142
  }
2997
3143
  };
2998
3144
  /**
@@ -3008,7 +3154,7 @@ var Meta2d = /** @class */ (function () {
3008
3154
  * @param pens 画笔们,注意 pen 必须在该数组内才有效
3009
3155
  */
3010
3156
  Meta2d.prototype.bottom = function (pens) {
3011
- var e_10, _a;
3157
+ var e_11, _a;
3012
3158
  if (!pens)
3013
3159
  pens = this.store.active;
3014
3160
  if (!Array.isArray(pens))
@@ -3039,12 +3185,12 @@ var Meta2d = /** @class */ (function () {
3039
3185
  _loop_4(pen);
3040
3186
  }
3041
3187
  }
3042
- catch (e_10_1) { e_10 = { error: e_10_1 }; }
3188
+ catch (e_11_1) { e_11 = { error: e_11_1 }; }
3043
3189
  finally {
3044
3190
  try {
3045
3191
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
3046
3192
  }
3047
- finally { if (e_10) throw e_10.error; }
3193
+ finally { if (e_11) throw e_11.error; }
3048
3194
  }
3049
3195
  };
3050
3196
  /**
@@ -3053,7 +3199,7 @@ var Meta2d = /** @class */ (function () {
3053
3199
  * @param pen 画笔
3054
3200
  */
3055
3201
  Meta2d.prototype.upByArea = function (pen) {
3056
- var _a, e_11, _b;
3202
+ var _a, e_12, _b;
3057
3203
  var _this = this;
3058
3204
  var index = this.store.data.pens.findIndex(function (p) { return p.id === pen.id; });
3059
3205
  if (index === -1) {
@@ -3103,12 +3249,12 @@ var Meta2d = /** @class */ (function () {
3103
3249
  _loop_6(pen_2);
3104
3250
  }
3105
3251
  }
3106
- catch (e_11_1) { e_11 = { error: e_11_1 }; }
3252
+ catch (e_12_1) { e_12 = { error: e_12_1 }; }
3107
3253
  finally {
3108
3254
  try {
3109
3255
  if (allPens_1_1 && !allPens_1_1.done && (_b = allPens_1.return)) _b.call(allPens_1);
3110
3256
  }
3111
- finally { if (e_11) throw e_11.error; }
3257
+ finally { if (e_12) throw e_12.error; }
3112
3258
  }
3113
3259
  this.initImageCanvas([pen]);
3114
3260
  };
@@ -3149,7 +3295,7 @@ var Meta2d = /** @class */ (function () {
3149
3295
  * @param pens 画笔
3150
3296
  */
3151
3297
  Meta2d.prototype.up = function (pens) {
3152
- var e_12, _a;
3298
+ var e_13, _a;
3153
3299
  var _this = this;
3154
3300
  if (!pens)
3155
3301
  pens = this.store.active;
@@ -3202,12 +3348,12 @@ var Meta2d = /** @class */ (function () {
3202
3348
  _loop_7(pen);
3203
3349
  }
3204
3350
  }
3205
- catch (e_12_1) { e_12 = { error: e_12_1 }; }
3351
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
3206
3352
  finally {
3207
3353
  try {
3208
3354
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
3209
3355
  }
3210
- finally { if (e_12) throw e_12.error; }
3356
+ finally { if (e_13) throw e_13.error; }
3211
3357
  }
3212
3358
  };
3213
3359
  /**
@@ -3215,7 +3361,7 @@ var Meta2d = /** @class */ (function () {
3215
3361
  * @param pen 画笔
3216
3362
  */
3217
3363
  Meta2d.prototype.down = function (pens) {
3218
- var e_13, _a;
3364
+ var e_14, _a;
3219
3365
  var _this = this;
3220
3366
  if (!pens)
3221
3367
  pens = this.store.active;
@@ -3270,12 +3416,12 @@ var Meta2d = /** @class */ (function () {
3270
3416
  _loop_9(pen);
3271
3417
  }
3272
3418
  }
3273
- catch (e_13_1) { e_13 = { error: e_13_1 }; }
3419
+ catch (e_14_1) { e_14 = { error: e_14_1 }; }
3274
3420
  finally {
3275
3421
  try {
3276
3422
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
3277
3423
  }
3278
- finally { if (e_13) throw e_13.error; }
3424
+ finally { if (e_14) throw e_14.error; }
3279
3425
  }
3280
3426
  };
3281
3427
  Meta2d.prototype.setLayer = function (pen, toIndex, pens) {
@@ -3350,7 +3496,7 @@ var Meta2d = /** @class */ (function () {
3350
3496
  var nextNodes_1 = [];
3351
3497
  // 2. 遍历出线的 nextNode
3352
3498
  lines.forEach(function (line) {
3353
- var e_14, _a;
3499
+ var e_15, _a;
3354
3500
  var lineNextNode = _this.nextNode(line);
3355
3501
  var _loop_11 = function (node) {
3356
3502
  var have = nextNodes_1.find(function (next) { return next.id === node.id; });
@@ -3363,12 +3509,12 @@ var Meta2d = /** @class */ (function () {
3363
3509
  _loop_11(node);
3364
3510
  }
3365
3511
  }
3366
- catch (e_14_1) { e_14 = { error: e_14_1 }; }
3512
+ catch (e_15_1) { e_15 = { error: e_15_1 }; }
3367
3513
  finally {
3368
3514
  try {
3369
3515
  if (lineNextNode_1_1 && !lineNextNode_1_1.done && (_a = lineNextNode_1.return)) _a.call(lineNextNode_1);
3370
3516
  }
3371
- finally { if (e_14) throw e_14.error; }
3517
+ finally { if (e_15) throw e_15.error; }
3372
3518
  }
3373
3519
  });
3374
3520
  return nextNodes_1;
@@ -3391,7 +3537,7 @@ var Meta2d = /** @class */ (function () {
3391
3537
  var preNodes_1 = [];
3392
3538
  // 2. 遍历入线的 preNode
3393
3539
  lines.forEach(function (line) {
3394
- var e_15, _a;
3540
+ var e_16, _a;
3395
3541
  var linePreNode = _this.previousNode(line);
3396
3542
  var _loop_12 = function (node) {
3397
3543
  var have = preNodes_1.find(function (pre) { return pre.id === node.id; });
@@ -3404,12 +3550,12 @@ var Meta2d = /** @class */ (function () {
3404
3550
  _loop_12(node);
3405
3551
  }
3406
3552
  }
3407
- catch (e_15_1) { e_15 = { error: e_15_1 }; }
3553
+ catch (e_16_1) { e_16 = { error: e_16_1 }; }
3408
3554
  finally {
3409
3555
  try {
3410
3556
  if (linePreNode_1_1 && !linePreNode_1_1.done && (_a = linePreNode_1.return)) _a.call(linePreNode_1);
3411
3557
  }
3412
- finally { if (e_15) throw e_15.error; }
3558
+ finally { if (e_16) throw e_16.error; }
3413
3559
  }
3414
3560
  });
3415
3561
  return preNodes_1;
@@ -3685,7 +3831,7 @@ var Meta2d = /** @class */ (function () {
3685
3831
  : deepClone(__spreadArray([parent], __read(components), false));
3686
3832
  };
3687
3833
  Meta2d.prototype.setVisible = function (pen, visible, render) {
3688
- var e_16, _a;
3834
+ var e_17, _a;
3689
3835
  if (render === void 0) { render = true; }
3690
3836
  this.onSizeUpdate();
3691
3837
  this.setValue({ id: pen.id, visible: visible }, { render: false, doEvent: false });
@@ -3697,12 +3843,12 @@ var Meta2d = /** @class */ (function () {
3697
3843
  child && this.setVisible(child, visible, false);
3698
3844
  }
3699
3845
  }
3700
- catch (e_16_1) { e_16 = { error: e_16_1 }; }
3846
+ catch (e_17_1) { e_17 = { error: e_17_1 }; }
3701
3847
  finally {
3702
3848
  try {
3703
3849
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
3704
3850
  }
3705
- finally { if (e_16) throw e_16.error; }
3851
+ finally { if (e_17) throw e_17.error; }
3706
3852
  }
3707
3853
  }
3708
3854
  render && this.render();