@meta2d/core 1.0.16 → 1.0.17

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.d.ts CHANGED
@@ -16,8 +16,11 @@ export declare class Meta2d {
16
16
  mqttClient: MqttClient;
17
17
  websockets: WebSocket[];
18
18
  mqttClients: MqttClient[];
19
- socketFn: (e: string, topic: string, context?: {
20
- meta2d: Meta2d;
19
+ socketFn: (e: string, context?: {
20
+ meta2d?: Meta2d;
21
+ type?: string;
22
+ topic?: string;
23
+ url?: string;
21
24
  }) => boolean;
22
25
  events: Record<number, (pen: Pen, e: Event) => void>;
23
26
  map: ViewMap;
@@ -72,7 +75,7 @@ export declare class Meta2d {
72
75
  rule?: boolean;
73
76
  ruleColor?: string;
74
77
  }): void;
75
- open(data?: Meta2dData): void;
78
+ open(data?: Meta2dData, render?: boolean): void;
76
79
  initBindDatas(): void;
77
80
  connectSocket(): void;
78
81
  /**
@@ -186,11 +189,17 @@ export declare class Meta2d {
186
189
  connectHttp(): void;
187
190
  sendDatabyHttp(data: string): Promise<void>;
188
191
  closeHttp(): void;
189
- networkTimer: any;
192
+ updateTimer: any;
190
193
  connectNetwork(): void;
194
+ randomString(e: number): string;
195
+ penMock(pen: Pen): void;
191
196
  onNetworkConnect(https: Network[]): void;
192
197
  closeNetwork(): void;
193
- socketCallback(message: string, topic?: string): void;
198
+ socketCallback(message: string, context?: {
199
+ type?: string;
200
+ topic?: string;
201
+ url?: string;
202
+ }): void;
194
203
  setDatas(datas: {
195
204
  dataId: string;
196
205
  value: any;
package/src/core.js CHANGED
@@ -756,7 +756,7 @@ var Meta2d = /** @class */ (function () {
756
756
  this.store.patchFlagsBackground = true;
757
757
  };
758
758
  Meta2d.prototype.setGrid = function (_a) {
759
- var _b = _a === void 0 ? {} : _a, _c = _b.grid, grid = _c === void 0 ? this.store.data.grid : _c, _d = _b.gridColor, gridColor = _d === void 0 ? this.store.data.gridColor : _d, _e = _b.gridSize, gridSize = _e === void 0 ? this.store.data.gridSize : _e, _f = _b.gridRotate, gridRotate = _f === void 0 ? this.store.data.gridRotate : _f;
759
+ var _b = _a === void 0 ? {} : _a, _c = _b.grid, grid = _c === void 0 ? this.store.data.grid : _c, _e = _b.gridColor, gridColor = _e === void 0 ? this.store.data.gridColor : _e, _f = _b.gridSize, gridSize = _f === void 0 ? this.store.data.gridSize : _f, _g = _b.gridRotate, gridRotate = _g === void 0 ? this.store.data.gridRotate : _g;
760
760
  this.store.data.grid = grid;
761
761
  this.store.data.gridColor = gridColor;
762
762
  this.store.data.gridSize = gridSize;
@@ -764,13 +764,14 @@ var Meta2d = /** @class */ (function () {
764
764
  this.store.patchFlagsBackground = true;
765
765
  };
766
766
  Meta2d.prototype.setRule = function (_a) {
767
- var _b = _a === void 0 ? {} : _a, _c = _b.rule, rule = _c === void 0 ? this.store.data.rule : _c, _d = _b.ruleColor, ruleColor = _d === void 0 ? this.store.data.ruleColor : _d;
767
+ var _b = _a === void 0 ? {} : _a, _c = _b.rule, rule = _c === void 0 ? this.store.data.rule : _c, _e = _b.ruleColor, ruleColor = _e === void 0 ? this.store.data.ruleColor : _e;
768
768
  this.store.data.rule = rule;
769
769
  this.store.data.ruleColor = ruleColor;
770
770
  this.store.patchFlagsTop = true;
771
771
  };
772
- Meta2d.prototype.open = function (data) {
772
+ Meta2d.prototype.open = function (data, render) {
773
773
  var e_1, _a, e_2, _b;
774
+ if (render === void 0) { render = true; }
774
775
  this.clear(false);
775
776
  if (data) {
776
777
  this.setBackgroundImage(data.bkImage);
@@ -778,8 +779,8 @@ var Meta2d = /** @class */ (function () {
778
779
  this.store.data.pens = [];
779
780
  try {
780
781
  // 第一遍赋初值
781
- for (var _c = __values(data.pens), _d = _c.next(); !_d.done; _d = _c.next()) {
782
- var pen = _d.value;
782
+ for (var _c = __values(data.pens), _e = _c.next(); !_e.done; _e = _c.next()) {
783
+ var pen = _e.value;
783
784
  if (!pen.id) {
784
785
  pen.id = s8();
785
786
  }
@@ -790,24 +791,27 @@ var Meta2d = /** @class */ (function () {
790
791
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
791
792
  finally {
792
793
  try {
793
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
794
+ if (_e && !_e.done && (_a = _c.return)) _a.call(_c);
794
795
  }
795
796
  finally { if (e_1) throw e_1.error; }
796
797
  }
797
798
  try {
798
- for (var _e = __values(data.pens), _f = _e.next(); !_f.done; _f = _e.next()) {
799
- var pen = _f.value;
799
+ for (var _f = __values(data.pens), _g = _f.next(); !_g.done; _g = _f.next()) {
800
+ var pen = _g.value;
800
801
  this.canvas.makePen(pen);
801
802
  }
802
803
  }
803
804
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
804
805
  finally {
805
806
  try {
806
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
807
+ if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
807
808
  }
808
809
  finally { if (e_2) throw e_2.error; }
809
810
  }
810
811
  }
812
+ if (!render) {
813
+ this.canvas.opening = true;
814
+ }
811
815
  this.initBindDatas();
812
816
  this.render();
813
817
  this.listenSocket();
@@ -982,15 +986,15 @@ var Meta2d = /** @class */ (function () {
982
986
  var _b;
983
987
  if (render === void 0) { render = true; }
984
988
  try {
985
- for (var _c = __values(this.store.data.pens), _d = _c.next(); !_d.done; _d = _c.next()) {
986
- var pen = _d.value;
989
+ for (var _c = __values(this.store.data.pens), _e = _c.next(); !_e.done; _e = _c.next()) {
990
+ var pen = _e.value;
987
991
  (_b = pen.onDestroy) === null || _b === void 0 ? void 0 : _b.call(pen, pen);
988
992
  }
989
993
  }
990
994
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
991
995
  finally {
992
996
  try {
993
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
997
+ if (_e && !_e.done && (_a = _c.return)) _a.call(_c);
994
998
  }
995
999
  finally { if (e_3) throw e_3.error; }
996
1000
  }
@@ -1449,7 +1453,7 @@ var Meta2d = /** @class */ (function () {
1449
1453
  var socketFn = void 0;
1450
1454
  var socketCbJs = this.store.data.socketCbJs;
1451
1455
  if (socketCbJs) {
1452
- socketFn = new Function('e', 'topic', 'context', socketCbJs);
1456
+ socketFn = new Function('e', 'context', socketCbJs);
1453
1457
  }
1454
1458
  if (!socketFn) {
1455
1459
  return false;
@@ -1471,7 +1475,10 @@ var Meta2d = /** @class */ (function () {
1471
1475
  if (this.store.data.websocket) {
1472
1476
  this.websocket = new WebSocket(this.store.data.websocket, this.store.data.websocketProtocols);
1473
1477
  this.websocket.onmessage = function (e) {
1474
- _this.socketCallback(e.data);
1478
+ _this.socketCallback(e.data, {
1479
+ type: 'websocket',
1480
+ url: _this.store.data.websocket,
1481
+ });
1475
1482
  };
1476
1483
  this.websocket.onclose = function () {
1477
1484
  console.info('Canvas websocket closed and reconneting...');
@@ -1501,7 +1508,11 @@ var Meta2d = /** @class */ (function () {
1501
1508
  }
1502
1509
  this.mqttClient = mqtt.connect(this.store.data.mqtt, this.store.data.mqttOptions);
1503
1510
  this.mqttClient.on('message', function (topic, message) {
1504
- _this.socketCallback(message.toString(), topic);
1511
+ _this.socketCallback(message.toString(), {
1512
+ topic: topic,
1513
+ type: 'mqtt',
1514
+ url: _this.store.data.mqtt,
1515
+ });
1505
1516
  });
1506
1517
  if (this.store.data.mqttTopics) {
1507
1518
  this.mqttClient.subscribe(this.store.data.mqttTopics.split(','));
@@ -1532,7 +1543,7 @@ var Meta2d = /** @class */ (function () {
1532
1543
  return [4 /*yield*/, res.text()];
1533
1544
  case 2:
1534
1545
  data = _a.sent();
1535
- this.socketCallback(data);
1546
+ this.socketCallback(data, { type: 'http', url: item.http });
1536
1547
  _a.label = 3;
1537
1548
  case 3: return [2 /*return*/];
1538
1549
  }
@@ -1557,7 +1568,7 @@ var Meta2d = /** @class */ (function () {
1557
1568
  return [4 /*yield*/, res.text()];
1558
1569
  case 2:
1559
1570
  data = _a.sent();
1560
- this.socketCallback(data);
1571
+ this.socketCallback(data, { type: 'http', url: http_1 });
1561
1572
  _a.label = 3;
1562
1573
  case 3: return [2 /*return*/];
1563
1574
  }
@@ -1642,7 +1653,11 @@ var Meta2d = /** @class */ (function () {
1642
1653
  }
1643
1654
  _this.mqttClients[mqttIndex_1] = mqtt.connect(net.url, net.options);
1644
1655
  _this.mqttClients[mqttIndex_1].on('message', function (topic, message) {
1645
- _this.socketCallback(message.toString(), topic);
1656
+ _this.socketCallback(message.toString(), {
1657
+ topic: topic,
1658
+ type: 'mqtt',
1659
+ url: net.url,
1660
+ });
1646
1661
  });
1647
1662
  if (net.topics) {
1648
1663
  _this.mqttClients[mqttIndex_1].subscribe(net.topics.split(','));
@@ -1652,7 +1667,7 @@ var Meta2d = /** @class */ (function () {
1652
1667
  else if (net.type === 'websocket') {
1653
1668
  _this.websockets[websocketIndex_1] = new WebSocket(net.url, net.protocols);
1654
1669
  _this.websockets[websocketIndex_1].onmessage = function (e) {
1655
- _this.socketCallback(e.data);
1670
+ _this.socketCallback(e.data, { type: 'websocket', url: net.url });
1656
1671
  };
1657
1672
  websocketIndex_1 += 1;
1658
1673
  }
@@ -1663,9 +1678,90 @@ var Meta2d = /** @class */ (function () {
1663
1678
  this.onNetworkConnect(https_1);
1664
1679
  }
1665
1680
  };
1681
+ Meta2d.prototype.randomString = function (e) {
1682
+ e = e || 32;
1683
+ var t = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678', a = t.length, n = '';
1684
+ for (var i = 0; i < e; i++) {
1685
+ n += t.charAt(Math.floor(Math.random() * a));
1686
+ }
1687
+ return n;
1688
+ };
1689
+ Meta2d.prototype.penMock = function (pen) {
1690
+ var _this = this;
1691
+ var _a;
1692
+ if (pen.realTimes) {
1693
+ var _d_1 = {};
1694
+ pen.realTimes.forEach(function (realTime) {
1695
+ if (!realTime.binds || !realTime.binds.length) {
1696
+ if (realTime.type === 'number') {
1697
+ if (realTime.value && realTime.value.indexOf(',') !== -1) {
1698
+ var arr = realTime.value.split(',');
1699
+ var rai = Math.floor(Math.random() * arr.length);
1700
+ _d_1[realTime.key] = parseFloat(arr[rai]);
1701
+ }
1702
+ else if (realTime.value && realTime.value.indexOf('-') !== -1) {
1703
+ var arr = realTime.value.split('-');
1704
+ var max = parseFloat(arr[1]);
1705
+ var min = parseFloat(arr[0]);
1706
+ _d_1[realTime.key] = Math.random() * (max - min) + min;
1707
+ }
1708
+ else {
1709
+ _d_1[realTime.key] = parseFloat(realTime.value);
1710
+ }
1711
+ }
1712
+ else if (realTime.type === 'bool') {
1713
+ if (typeof realTime.value === 'boolean') {
1714
+ _d_1[realTime.key] = realTime.value;
1715
+ }
1716
+ else if ('true' === realTime.value) {
1717
+ _d_1[realTime.key] = true;
1718
+ }
1719
+ else if ('false' === realTime.value) {
1720
+ _d_1[realTime.key] = false;
1721
+ }
1722
+ else {
1723
+ _d_1[realTime.key] = Math.random() < 0.5;
1724
+ }
1725
+ }
1726
+ else if (realTime.type === 'object' || realTime.type === 'array') {
1727
+ _d_1[realTime.key] = realTime.value;
1728
+ }
1729
+ else {
1730
+ //if (realTime.type === 'string')
1731
+ if (realTime.value &&
1732
+ realTime.value.startsWith('{') &&
1733
+ realTime.value.endsWith('}')) {
1734
+ var str = realTime.value.substring(1, realTime.value.length - 1);
1735
+ var arr = str.split(',');
1736
+ var rai = Math.floor(Math.random() * arr.length);
1737
+ _d_1[realTime.key] = arr[rai];
1738
+ }
1739
+ else if (realTime.value &&
1740
+ realTime.value.startsWith('[') &&
1741
+ realTime.value.endsWith(']')) {
1742
+ var len = parseInt(realTime.value.substring(1, realTime.value.length - 1));
1743
+ _d_1[realTime.key] = _this.randomString(len);
1744
+ }
1745
+ else {
1746
+ _d_1[realTime.key] = realTime.value;
1747
+ }
1748
+ }
1749
+ }
1750
+ });
1751
+ if (Object.keys(_d_1).length) {
1752
+ this.canvas.updateValue(pen, _d_1);
1753
+ this.store.emitter.emit('valueUpdate', pen);
1754
+ (_a = pen.onValue) === null || _a === void 0 ? void 0 : _a.call(pen, pen);
1755
+ }
1756
+ }
1757
+ };
1666
1758
  Meta2d.prototype.onNetworkConnect = function (https) {
1667
1759
  var _this = this;
1668
- this.networkTimer = setInterval(function () {
1760
+ this.updateTimer = setInterval(function () {
1761
+ //模拟数据
1762
+ _this.store.data.pens.forEach(function (pen) {
1763
+ _this.penMock(pen);
1764
+ });
1669
1765
  https.forEach(function (item) { return __awaiter(_this, void 0, void 0, function () {
1670
1766
  var res, data;
1671
1767
  return __generator(this, function (_a) {
@@ -1683,14 +1779,13 @@ var Meta2d = /** @class */ (function () {
1683
1779
  return [4 /*yield*/, res.text()];
1684
1780
  case 2:
1685
1781
  data = _a.sent();
1686
- this.socketCallback(data);
1782
+ this.socketCallback(data, { type: 'http', url: item.url });
1687
1783
  _a.label = 3;
1688
1784
  case 3: return [2 /*return*/];
1689
1785
  }
1690
1786
  });
1691
1787
  }); });
1692
- //模拟数据
1693
- _this.store.data.mockData && _this.store.data.mockData();
1788
+ _this.render();
1694
1789
  }, this.store.data.networkInterval || 1000);
1695
1790
  };
1696
1791
  Meta2d.prototype.closeNetwork = function () {
@@ -1704,14 +1799,19 @@ var Meta2d = /** @class */ (function () {
1704
1799
  });
1705
1800
  this.mqttClients = undefined;
1706
1801
  this.websockets = undefined;
1707
- clearInterval(this.networkTimer);
1708
- this.networkTimer = undefined;
1802
+ clearInterval(this.updateTimer);
1803
+ this.updateTimer = undefined;
1709
1804
  };
1710
- Meta2d.prototype.socketCallback = function (message, topic) {
1805
+ Meta2d.prototype.socketCallback = function (message, context) {
1711
1806
  var _this = this;
1712
- if (topic === void 0) { topic = ''; }
1713
- this.store.emitter.emit('socket', { message: message, topic: topic });
1714
- if (this.socketFn && !this.socketFn(message, topic, { meta2d: this })) {
1807
+ this.store.emitter.emit('socket', { message: message, context: context });
1808
+ if (this.socketFn &&
1809
+ !this.socketFn(message, {
1810
+ meta2d: this,
1811
+ type: context.type,
1812
+ topic: context.topic,
1813
+ url: context.url,
1814
+ })) {
1715
1815
  return;
1716
1816
  }
1717
1817
  var data;
@@ -1747,7 +1847,7 @@ var Meta2d = /** @class */ (function () {
1747
1847
  // 绑定变量方式更新组件数据
1748
1848
  Meta2d.prototype.setDatas = function (datas, _a) {
1749
1849
  var _this = this;
1750
- var _b = _a === void 0 ? {} : _a, _c = _b.render, render = _c === void 0 ? true : _c, _d = _b.doEvent, doEvent = _d === void 0 ? true : _d, history = _b.history;
1850
+ var _b = _a === void 0 ? {} : _a, _c = _b.render, render = _c === void 0 ? true : _c, _e = _b.doEvent, doEvent = _e === void 0 ? true : _e, history = _b.history;
1751
1851
  // 把{dataId: string; value: any}转成setValue格式数据
1752
1852
  var penValues = new Map();
1753
1853
  datas.forEach(function (v) {
@@ -1803,7 +1903,7 @@ var Meta2d = /** @class */ (function () {
1803
1903
  };
1804
1904
  Meta2d.prototype.setValue = function (data, _a) {
1805
1905
  var _this = this;
1806
- var _b = _a === void 0 ? {} : _a, _c = _b.render, render = _c === void 0 ? true : _c, _d = _b.doEvent, doEvent = _d === void 0 ? true : _d, history = _b.history;
1906
+ var _b = _a === void 0 ? {} : _a, _c = _b.render, render = _c === void 0 ? true : _c, _e = _b.doEvent, doEvent = _e === void 0 ? true : _e, history = _b.history;
1807
1907
  var pens = [];
1808
1908
  if (data.id) {
1809
1909
  if (data.id === this.store.data.id) {
@@ -2020,12 +2120,33 @@ var Meta2d = /** @class */ (function () {
2020
2120
  * @param padding 上右下左的内边距
2021
2121
  */
2022
2122
  Meta2d.prototype.downloadPng = function (name, padding) {
2023
- var a = document.createElement('a');
2024
- a.setAttribute('download', name || 'le5le.meta2d.png');
2025
- a.setAttribute('href', this.toPng(padding, undefined, true));
2026
- var evt = document.createEvent('MouseEvents');
2027
- evt.initEvent('click', true, true);
2028
- a.dispatchEvent(evt);
2123
+ var e_4, _a;
2124
+ var _this = this;
2125
+ var _b;
2126
+ try {
2127
+ for (var _c = __values(this.store.data.pens), _e = _c.next(); !_e.done; _e = _c.next()) {
2128
+ var pen = _e.value;
2129
+ if (pen.calculative.img) {
2130
+ //重新生成绘制图片
2131
+ (_b = pen.onRenderPenRaw) === null || _b === void 0 ? void 0 : _b.call(pen, pen);
2132
+ }
2133
+ }
2134
+ }
2135
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
2136
+ finally {
2137
+ try {
2138
+ if (_e && !_e.done && (_a = _c.return)) _a.call(_c);
2139
+ }
2140
+ finally { if (e_4) throw e_4.error; }
2141
+ }
2142
+ setTimeout(function () {
2143
+ var a = document.createElement('a');
2144
+ a.setAttribute('download', name || 'le5le.meta2d.png');
2145
+ a.setAttribute('href', _this.toPng(padding, undefined, true));
2146
+ var evt = document.createEvent('MouseEvents');
2147
+ evt.initEvent('click', true, true);
2148
+ a.dispatchEvent(evt);
2149
+ });
2029
2150
  };
2030
2151
  Meta2d.prototype.getRect = function (pens) {
2031
2152
  if (pens === void 0) { pens = this.store.data.pens; }
@@ -2346,7 +2467,7 @@ var Meta2d = /** @class */ (function () {
2346
2467
  this.formatPainter();
2347
2468
  };
2348
2469
  Meta2d.prototype.alignNodes = function (align, pens, rect) {
2349
- var e_4, _a;
2470
+ var e_5, _a;
2350
2471
  if (pens === void 0) { pens = this.store.data.pens; }
2351
2472
  !rect && (rect = this.getPenRect(this.getRect(pens)));
2352
2473
  var initPens = deepClone(pens); // 原 pens ,深拷贝一下
@@ -2356,12 +2477,12 @@ var Meta2d = /** @class */ (function () {
2356
2477
  this.alignPen(align, item, rect);
2357
2478
  }
2358
2479
  }
2359
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
2480
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
2360
2481
  finally {
2361
2482
  try {
2362
2483
  if (pens_1_1 && !pens_1_1.done && (_a = pens_1.return)) _a.call(pens_1);
2363
2484
  }
2364
- finally { if (e_4) throw e_4.error; }
2485
+ finally { if (e_5) throw e_5.error; }
2365
2486
  }
2366
2487
  this.render();
2367
2488
  this.pushHistory({
@@ -2450,7 +2571,7 @@ var Meta2d = /** @class */ (function () {
2450
2571
  * @param distance 总的宽 or 高
2451
2572
  */
2452
2573
  Meta2d.prototype.spaceBetweenByDirection = function (direction, pens, distance) {
2453
- var e_5, _a;
2574
+ var e_6, _a;
2454
2575
  var _this = this;
2455
2576
  if (pens === void 0) { pens = this.store.data.pens; }
2456
2577
  !distance && (distance = this.getPenRect(this.getRect(pens))[direction]);
@@ -2484,12 +2605,12 @@ var Meta2d = /** @class */ (function () {
2484
2605
  this.setValue(__assign({ id: pen.id }, penRect), { render: false, doEvent: false });
2485
2606
  }
2486
2607
  }
2487
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
2608
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
2488
2609
  finally {
2489
2610
  try {
2490
2611
  if (pens_2_1 && !pens_2_1.done && (_a = pens_2.return)) _a.call(pens_2);
2491
2612
  }
2492
- finally { if (e_5) throw e_5.error; }
2613
+ finally { if (e_6) throw e_6.error; }
2493
2614
  }
2494
2615
  this.render();
2495
2616
  this.pushHistory({
@@ -2657,7 +2778,7 @@ var Meta2d = /** @class */ (function () {
2657
2778
  * @param pen 画笔
2658
2779
  */
2659
2780
  Meta2d.prototype.upByArea = function (pen) {
2660
- var _a, e_6, _b;
2781
+ var _a, e_7, _b;
2661
2782
  var _this = this;
2662
2783
  var index = this.store.data.pens.findIndex(function (p) { return p.id === pen.id; });
2663
2784
  if (index === -1) {
@@ -2707,12 +2828,12 @@ var Meta2d = /** @class */ (function () {
2707
2828
  _loop_4(pen_2);
2708
2829
  }
2709
2830
  }
2710
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
2831
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
2711
2832
  finally {
2712
2833
  try {
2713
2834
  if (allPens_1_1 && !allPens_1_1.done && (_b = allPens_1.return)) _b.call(allPens_1);
2714
2835
  }
2715
- finally { if (e_6) throw e_6.error; }
2836
+ finally { if (e_7) throw e_7.error; }
2716
2837
  }
2717
2838
  this.initImageCanvas([pen]);
2718
2839
  };
@@ -2872,7 +2993,7 @@ var Meta2d = /** @class */ (function () {
2872
2993
  var nextNodes_1 = [];
2873
2994
  // 2. 遍历出线的 nextNode
2874
2995
  lines.forEach(function (line) {
2875
- var e_7, _a;
2996
+ var e_8, _a;
2876
2997
  var lineNextNode = _this.nextNode(line);
2877
2998
  var _loop_7 = function (node) {
2878
2999
  var have = nextNodes_1.find(function (next) { return next.id === node.id; });
@@ -2885,12 +3006,12 @@ var Meta2d = /** @class */ (function () {
2885
3006
  _loop_7(node);
2886
3007
  }
2887
3008
  }
2888
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
3009
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
2889
3010
  finally {
2890
3011
  try {
2891
3012
  if (lineNextNode_1_1 && !lineNextNode_1_1.done && (_a = lineNextNode_1.return)) _a.call(lineNextNode_1);
2892
3013
  }
2893
- finally { if (e_7) throw e_7.error; }
3014
+ finally { if (e_8) throw e_8.error; }
2894
3015
  }
2895
3016
  });
2896
3017
  return nextNodes_1;
@@ -2913,7 +3034,7 @@ var Meta2d = /** @class */ (function () {
2913
3034
  var preNodes_1 = [];
2914
3035
  // 2. 遍历入线的 preNode
2915
3036
  lines.forEach(function (line) {
2916
- var e_8, _a;
3037
+ var e_9, _a;
2917
3038
  var linePreNode = _this.previousNode(line);
2918
3039
  var _loop_8 = function (node) {
2919
3040
  var have = preNodes_1.find(function (pre) { return pre.id === node.id; });
@@ -2926,12 +3047,12 @@ var Meta2d = /** @class */ (function () {
2926
3047
  _loop_8(node);
2927
3048
  }
2928
3049
  }
2929
- catch (e_8_1) { e_8 = { error: e_8_1 }; }
3050
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
2930
3051
  finally {
2931
3052
  try {
2932
3053
  if (linePreNode_1_1 && !linePreNode_1_1.done && (_a = linePreNode_1.return)) _a.call(linePreNode_1);
2933
3054
  }
2934
- finally { if (e_8) throw e_8.error; }
3055
+ finally { if (e_9) throw e_9.error; }
2935
3056
  }
2936
3057
  });
2937
3058
  return preNodes_1;
@@ -3207,7 +3328,7 @@ var Meta2d = /** @class */ (function () {
3207
3328
  : deepClone(__spreadArray([parent], __read(components), false));
3208
3329
  };
3209
3330
  Meta2d.prototype.setVisible = function (pen, visible, render) {
3210
- var e_9, _a;
3331
+ var e_10, _a;
3211
3332
  if (render === void 0) { render = true; }
3212
3333
  this.onSizeUpdate();
3213
3334
  this.setValue({ id: pen.id, visible: visible }, { render: false, doEvent: false });
@@ -3219,12 +3340,12 @@ var Meta2d = /** @class */ (function () {
3219
3340
  child && this.setVisible(child, visible, false);
3220
3341
  }
3221
3342
  }
3222
- catch (e_9_1) { e_9 = { error: e_9_1 }; }
3343
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
3223
3344
  finally {
3224
3345
  try {
3225
3346
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
3226
3347
  }
3227
- finally { if (e_9) throw e_9.error; }
3348
+ finally { if (e_10) throw e_10.error; }
3228
3349
  }
3229
3350
  }
3230
3351
  render && this.render();