@meta2d/core 1.0.26 → 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/canvas/canvas.d.ts +17 -0
- package/src/canvas/canvas.js +156 -9
- package/src/canvas/canvas.js.map +1 -1
- package/src/canvas/canvasImage.d.ts +0 -1
- package/src/canvas/canvasImage.js +93 -65
- package/src/canvas/canvasImage.js.map +1 -1
- package/src/canvas/canvasTemplate.d.ts +19 -0
- package/src/canvas/canvasTemplate.js +194 -0
- package/src/canvas/canvasTemplate.js.map +1 -0
- package/src/core.d.ts +11 -1
- package/src/core.js +152 -41
- package/src/core.js.map +1 -1
- package/src/diagrams/iframe.js +49 -5
- package/src/diagrams/iframe.js.map +1 -1
- package/src/pen/model.d.ts +7 -0
- package/src/pen/model.js.map +1 -1
- package/src/pen/render.js +67 -5
- package/src/pen/render.js.map +1 -1
- package/src/store/store.d.ts +9 -2
- package/src/store/store.js +36 -1
- package/src/store/store.js.map +1 -1
- package/src/utils/index.d.ts +1 -0
- package/src/utils/index.js +1 -0
- package/src/utils/index.js.map +1 -1
- package/src/utils/url.d.ts +1 -0
- package/src/utils/url.js +20 -0
- package/src/utils/url.js.map +1 -1
package/src/core.js
CHANGED
|
@@ -786,6 +786,7 @@ var Meta2d = /** @class */ (function () {
|
|
|
786
786
|
height = this.store.data.height || this.store.options.height;
|
|
787
787
|
if (width && height) {
|
|
788
788
|
this.canvas.canvasImageBottom.canvas.style.backgroundImage = null;
|
|
789
|
+
this.canvas && (this.canvas.canvasTemplate.bgPatchFlags = true);
|
|
789
790
|
}
|
|
790
791
|
else {
|
|
791
792
|
this.canvas.canvasImageBottom.canvas.style.backgroundImage = url
|
|
@@ -810,7 +811,8 @@ var Meta2d = /** @class */ (function () {
|
|
|
810
811
|
Meta2d.prototype.setBackgroundColor = function (color) {
|
|
811
812
|
if (color === void 0) { color = this.store.data.background; }
|
|
812
813
|
this.store.data.background = color;
|
|
813
|
-
this.store.patchFlagsBackground = true;
|
|
814
|
+
// this.store.patchFlagsBackground = true;
|
|
815
|
+
this.canvas && (this.canvas.canvasTemplate.bgPatchFlags = true);
|
|
814
816
|
};
|
|
815
817
|
Meta2d.prototype.setGrid = function (_a) {
|
|
816
818
|
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;
|
|
@@ -818,7 +820,8 @@ var Meta2d = /** @class */ (function () {
|
|
|
818
820
|
this.store.data.gridColor = gridColor;
|
|
819
821
|
this.store.data.gridSize = gridSize;
|
|
820
822
|
this.store.data.gridRotate = gridRotate;
|
|
821
|
-
this.store.patchFlagsBackground = true;
|
|
823
|
+
// this.store.patchFlagsBackground = true;
|
|
824
|
+
this.canvas && (this.canvas.canvasTemplate.bgPatchFlags = true);
|
|
822
825
|
};
|
|
823
826
|
Meta2d.prototype.setRule = function (_a) {
|
|
824
827
|
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;
|
|
@@ -830,7 +833,7 @@ var Meta2d = /** @class */ (function () {
|
|
|
830
833
|
var e_1, _a, e_2, _b, e_3, _c, e_4, _e;
|
|
831
834
|
var _this = this;
|
|
832
835
|
if (render === void 0) { render = true; }
|
|
833
|
-
this.clear(false);
|
|
836
|
+
this.clear(false, data.template);
|
|
834
837
|
this.canvas.autoPolylineFlag = true;
|
|
835
838
|
if (data) {
|
|
836
839
|
this.setBackgroundImage(data.bkImage);
|
|
@@ -886,6 +889,9 @@ var Meta2d = /** @class */ (function () {
|
|
|
886
889
|
_this.canvas.initLineRect(pen);
|
|
887
890
|
}
|
|
888
891
|
});
|
|
892
|
+
if (!this.store.data.template) {
|
|
893
|
+
this.store.data.template = s8();
|
|
894
|
+
}
|
|
889
895
|
if (!render) {
|
|
890
896
|
this.canvas.opening = true;
|
|
891
897
|
}
|
|
@@ -1150,7 +1156,7 @@ var Meta2d = /** @class */ (function () {
|
|
|
1150
1156
|
* 擦除画布,释放 store 上的 pens
|
|
1151
1157
|
* @param render 是否重绘
|
|
1152
1158
|
*/
|
|
1153
|
-
Meta2d.prototype.clear = function (render) {
|
|
1159
|
+
Meta2d.prototype.clear = function (render, template) {
|
|
1154
1160
|
var e_5, _a;
|
|
1155
1161
|
var _b;
|
|
1156
1162
|
if (render === void 0) { render = true; }
|
|
@@ -1167,7 +1173,7 @@ var Meta2d = /** @class */ (function () {
|
|
|
1167
1173
|
}
|
|
1168
1174
|
finally { if (e_5) throw e_5.error; }
|
|
1169
1175
|
}
|
|
1170
|
-
clearStore(this.store);
|
|
1176
|
+
clearStore(this.store, template);
|
|
1171
1177
|
this.hideInput();
|
|
1172
1178
|
this.canvas.tooltip.hide();
|
|
1173
1179
|
if (this.map && this.map.isShow) {
|
|
@@ -1178,7 +1184,10 @@ var Meta2d = /** @class */ (function () {
|
|
|
1178
1184
|
sessionStorage.removeItem('page');
|
|
1179
1185
|
this.store.clipboard = undefined;
|
|
1180
1186
|
// 非必要,为的是 open 时重绘 背景与网格
|
|
1181
|
-
this.store.patchFlagsBackground = true;
|
|
1187
|
+
// this.store.patchFlagsBackground = true;
|
|
1188
|
+
if (!this.store.sameTemplate) {
|
|
1189
|
+
this.canvas.canvasTemplate.bgPatchFlags = true;
|
|
1190
|
+
}
|
|
1182
1191
|
this.store.patchFlagsTop = true;
|
|
1183
1192
|
this.setBackgroundImage(undefined);
|
|
1184
1193
|
render && this.render();
|
|
@@ -1234,7 +1243,8 @@ var Meta2d = /** @class */ (function () {
|
|
|
1234
1243
|
// 没有参数 则播放有自动播放属性的动画
|
|
1235
1244
|
if (!idOrTagOrPens) {
|
|
1236
1245
|
pens = this.store.data.pens.filter(function (pen) {
|
|
1237
|
-
return ((pen.type || pen.frames) && pen.autoPlay) ||
|
|
1246
|
+
return (((pen.type || pen.frames) && pen.autoPlay) ||
|
|
1247
|
+
(pen.animations && pen.autoPlay));
|
|
1238
1248
|
});
|
|
1239
1249
|
}
|
|
1240
1250
|
else if (typeof idOrTagOrPens === 'string') {
|
|
@@ -1341,7 +1351,8 @@ var Meta2d = /** @class */ (function () {
|
|
|
1341
1351
|
});
|
|
1342
1352
|
this.initImageCanvas(pens);
|
|
1343
1353
|
setTimeout(function () {
|
|
1344
|
-
|
|
1354
|
+
var _a;
|
|
1355
|
+
(_a = _this.canvas) === null || _a === void 0 ? void 0 : _a.calcActiveRect();
|
|
1345
1356
|
_this.render();
|
|
1346
1357
|
}, 20);
|
|
1347
1358
|
};
|
|
@@ -2478,7 +2489,7 @@ var Meta2d = /** @class */ (function () {
|
|
|
2478
2489
|
try {
|
|
2479
2490
|
for (var _c = __values(this.store.data.pens), _e = _c.next(); !_e.done; _e = _c.next()) {
|
|
2480
2491
|
var pen = _e.value;
|
|
2481
|
-
if (pen.calculative.img) {
|
|
2492
|
+
if (pen.calculative.img || ['iframe'].includes(pen.name)) {
|
|
2482
2493
|
//重新生成绘制图片
|
|
2483
2494
|
(_b = pen.onRenderPenRaw) === null || _b === void 0 ? void 0 : _b.call(pen, pen);
|
|
2484
2495
|
}
|
|
@@ -2498,7 +2509,7 @@ var Meta2d = /** @class */ (function () {
|
|
|
2498
2509
|
var evt = document.createEvent('MouseEvents');
|
|
2499
2510
|
evt.initEvent('click', true, true);
|
|
2500
2511
|
a.dispatchEvent(evt);
|
|
2501
|
-
});
|
|
2512
|
+
}, 1000);
|
|
2502
2513
|
};
|
|
2503
2514
|
Meta2d.prototype.downloadSvg = function () {
|
|
2504
2515
|
var e_7, _a;
|
|
@@ -2551,6 +2562,20 @@ var Meta2d = /** @class */ (function () {
|
|
|
2551
2562
|
if (pens === void 0) { pens = this.store.data.pens; }
|
|
2552
2563
|
return getRect(pens);
|
|
2553
2564
|
};
|
|
2565
|
+
Meta2d.prototype.hiddenTemplate = function () {
|
|
2566
|
+
this.canvas.canvasTemplate.hidden();
|
|
2567
|
+
};
|
|
2568
|
+
Meta2d.prototype.showTemplate = function () {
|
|
2569
|
+
this.canvas.canvasTemplate.show();
|
|
2570
|
+
};
|
|
2571
|
+
Meta2d.prototype.lockTemplate = function (lock) {
|
|
2572
|
+
//锁定
|
|
2573
|
+
this.store.data.pens.forEach(function (pen) {
|
|
2574
|
+
if (pen.template) {
|
|
2575
|
+
pen.locked = lock;
|
|
2576
|
+
}
|
|
2577
|
+
});
|
|
2578
|
+
};
|
|
2554
2579
|
/**
|
|
2555
2580
|
* 放大到屏幕尺寸,并居中
|
|
2556
2581
|
* @param fit true,填满但完整展示;false,填满,但长边可能截取(即显示不完整)
|
|
@@ -2585,6 +2610,56 @@ var Meta2d = /** @class */ (function () {
|
|
|
2585
2610
|
// 5. 居中
|
|
2586
2611
|
this.centerView();
|
|
2587
2612
|
};
|
|
2613
|
+
Meta2d.prototype.trimPens = function () {
|
|
2614
|
+
//去除空连线
|
|
2615
|
+
var pens = this.store.data.pens.filter(function (pen) { return pen.name === 'line' && pen.anchors.length < 2; });
|
|
2616
|
+
this.delete(pens);
|
|
2617
|
+
};
|
|
2618
|
+
/**
|
|
2619
|
+
* 放大到屏幕尺寸,并居中
|
|
2620
|
+
* @param fit true,填满但完整展示;false,填满,但长边可能截取(即显示不完整)
|
|
2621
|
+
*/
|
|
2622
|
+
Meta2d.prototype.fitTemplateView = function (fit, viewPadding) {
|
|
2623
|
+
var _this = this;
|
|
2624
|
+
if (fit === void 0) { fit = true; }
|
|
2625
|
+
if (viewPadding === void 0) { viewPadding = 10; }
|
|
2626
|
+
// 默认垂直填充,两边留白
|
|
2627
|
+
if (!this.hasView())
|
|
2628
|
+
return;
|
|
2629
|
+
// 1. 重置画布尺寸为容器尺寸
|
|
2630
|
+
var canvas = this.canvas.canvas;
|
|
2631
|
+
var width = canvas.offsetWidth, height = canvas.offsetHeight;
|
|
2632
|
+
// 2. 获取设置的留白值
|
|
2633
|
+
var padding = formatPadding(viewPadding);
|
|
2634
|
+
// 3. 获取图形尺寸
|
|
2635
|
+
var rect = this.getRect();
|
|
2636
|
+
// 4. 计算缩放比例
|
|
2637
|
+
var w = (width - padding[1] - padding[3]) / rect.width;
|
|
2638
|
+
var h = (height - padding[0] - padding[2]) / rect.height;
|
|
2639
|
+
var ratio = w;
|
|
2640
|
+
if (fit) {
|
|
2641
|
+
// 完整显示取小的
|
|
2642
|
+
ratio = w > h ? h : w;
|
|
2643
|
+
}
|
|
2644
|
+
else {
|
|
2645
|
+
ratio = w > h ? w : h;
|
|
2646
|
+
}
|
|
2647
|
+
// 该方法直接更改画布的 scale 属性,所以比率应该乘以当前 scale
|
|
2648
|
+
this.canvas.templateScale(ratio * this.store.data.scale);
|
|
2649
|
+
var _rect = this.getRect();
|
|
2650
|
+
var pens = this.store.data.pens.filter(function (pen) { return !pen.parentId; });
|
|
2651
|
+
this.canvas.templateTranslatePens(pens, -_rect.x, -_rect.y);
|
|
2652
|
+
// 5. 居中
|
|
2653
|
+
this.store.data.pens.forEach(function (pen) {
|
|
2654
|
+
if (!pen.type) {
|
|
2655
|
+
_this.canvas.updateLines(pen);
|
|
2656
|
+
}
|
|
2657
|
+
else {
|
|
2658
|
+
_this.canvas.initLineRect(pen);
|
|
2659
|
+
}
|
|
2660
|
+
});
|
|
2661
|
+
this.centerView();
|
|
2662
|
+
};
|
|
2588
2663
|
Meta2d.prototype.fitSizeView = function (fit, viewPadding) {
|
|
2589
2664
|
if (fit === void 0) { fit = true; }
|
|
2590
2665
|
if (viewPadding === void 0) { viewPadding = 10; }
|
|
@@ -2896,6 +2971,38 @@ var Meta2d = /** @class */ (function () {
|
|
|
2896
2971
|
pens: pens,
|
|
2897
2972
|
});
|
|
2898
2973
|
};
|
|
2974
|
+
//对齐大屏
|
|
2975
|
+
Meta2d.prototype.alignNodesV = function (align, pens) {
|
|
2976
|
+
var e_9, _a;
|
|
2977
|
+
if (pens === void 0) { pens = this.store.data.pens; }
|
|
2978
|
+
var width = this.store.data.width || this.store.options.width;
|
|
2979
|
+
var height = this.store.data.height || this.store.options.height;
|
|
2980
|
+
var rect = {
|
|
2981
|
+
x: 0,
|
|
2982
|
+
y: 0,
|
|
2983
|
+
width: width,
|
|
2984
|
+
height: height,
|
|
2985
|
+
};
|
|
2986
|
+
var initPens = deepClone(pens); // 原 pens ,深拷贝一下
|
|
2987
|
+
try {
|
|
2988
|
+
for (var pens_2 = __values(pens), pens_2_1 = pens_2.next(); !pens_2_1.done; pens_2_1 = pens_2.next()) {
|
|
2989
|
+
var item = pens_2_1.value;
|
|
2990
|
+
this.alignPen(align, item, rect);
|
|
2991
|
+
}
|
|
2992
|
+
}
|
|
2993
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
2994
|
+
finally {
|
|
2995
|
+
try {
|
|
2996
|
+
if (pens_2_1 && !pens_2_1.done && (_a = pens_2.return)) _a.call(pens_2);
|
|
2997
|
+
}
|
|
2998
|
+
finally { if (e_9) throw e_9.error; }
|
|
2999
|
+
}
|
|
3000
|
+
this.pushHistory({
|
|
3001
|
+
type: EditType.Update,
|
|
3002
|
+
initPens: initPens,
|
|
3003
|
+
pens: pens,
|
|
3004
|
+
});
|
|
3005
|
+
};
|
|
2899
3006
|
/**
|
|
2900
3007
|
* 对齐画笔,基于第一个画笔
|
|
2901
3008
|
* @param align 左对齐,右对齐,上对齐,下对齐,居中对齐
|
|
@@ -2976,7 +3083,7 @@ var Meta2d = /** @class */ (function () {
|
|
|
2976
3083
|
* @param distance 总的宽 or 高
|
|
2977
3084
|
*/
|
|
2978
3085
|
Meta2d.prototype.spaceBetweenByDirection = function (direction, pens, distance) {
|
|
2979
|
-
var
|
|
3086
|
+
var e_10, _a;
|
|
2980
3087
|
var _this = this;
|
|
2981
3088
|
if (pens === void 0) { pens = this.store.data.pens; }
|
|
2982
3089
|
!distance && (distance = this.getPenRect(this.getRect(pens))[direction]);
|
|
@@ -3002,20 +3109,20 @@ var Meta2d = /** @class */ (function () {
|
|
|
3002
3109
|
var pen0Rect = this.getPenRect(pens[0]);
|
|
3003
3110
|
var left = direction === 'width' ? pen0Rect.x : pen0Rect.y;
|
|
3004
3111
|
try {
|
|
3005
|
-
for (var
|
|
3006
|
-
var pen =
|
|
3112
|
+
for (var pens_3 = __values(pens), pens_3_1 = pens_3.next(); !pens_3_1.done; pens_3_1 = pens_3.next()) {
|
|
3113
|
+
var pen = pens_3_1.value;
|
|
3007
3114
|
var penRect = this.getPenRect(pen);
|
|
3008
3115
|
direction === 'width' ? (penRect.x = left) : (penRect.y = left);
|
|
3009
3116
|
left += penRect[direction] + space;
|
|
3010
3117
|
this.setValue(__assign({ id: pen.id }, penRect), { render: false, doEvent: false });
|
|
3011
3118
|
}
|
|
3012
3119
|
}
|
|
3013
|
-
catch (
|
|
3120
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
3014
3121
|
finally {
|
|
3015
3122
|
try {
|
|
3016
|
-
if (
|
|
3123
|
+
if (pens_3_1 && !pens_3_1.done && (_a = pens_3.return)) _a.call(pens_3);
|
|
3017
3124
|
}
|
|
3018
|
-
finally { if (
|
|
3125
|
+
finally { if (e_10) throw e_10.error; }
|
|
3019
3126
|
}
|
|
3020
3127
|
this.render();
|
|
3021
3128
|
this.pushHistory({
|
|
@@ -3132,7 +3239,7 @@ var Meta2d = /** @class */ (function () {
|
|
|
3132
3239
|
* @param pens pen 置顶的画笔
|
|
3133
3240
|
*/
|
|
3134
3241
|
Meta2d.prototype.top = function (pens) {
|
|
3135
|
-
var
|
|
3242
|
+
var e_11, _a;
|
|
3136
3243
|
var _this = this;
|
|
3137
3244
|
if (!pens)
|
|
3138
3245
|
pens = this.store.active;
|
|
@@ -3160,12 +3267,12 @@ var Meta2d = /** @class */ (function () {
|
|
|
3160
3267
|
_loop_3(pen);
|
|
3161
3268
|
}
|
|
3162
3269
|
}
|
|
3163
|
-
catch (
|
|
3270
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
3164
3271
|
finally {
|
|
3165
3272
|
try {
|
|
3166
3273
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
3167
3274
|
}
|
|
3168
|
-
finally { if (
|
|
3275
|
+
finally { if (e_11) throw e_11.error; }
|
|
3169
3276
|
}
|
|
3170
3277
|
};
|
|
3171
3278
|
/**
|
|
@@ -3181,7 +3288,7 @@ var Meta2d = /** @class */ (function () {
|
|
|
3181
3288
|
* @param pens 画笔们,注意 pen 必须在该数组内才有效
|
|
3182
3289
|
*/
|
|
3183
3290
|
Meta2d.prototype.bottom = function (pens) {
|
|
3184
|
-
var
|
|
3291
|
+
var e_12, _a;
|
|
3185
3292
|
if (!pens)
|
|
3186
3293
|
pens = this.store.active;
|
|
3187
3294
|
if (!Array.isArray(pens))
|
|
@@ -3212,12 +3319,12 @@ var Meta2d = /** @class */ (function () {
|
|
|
3212
3319
|
_loop_4(pen);
|
|
3213
3320
|
}
|
|
3214
3321
|
}
|
|
3215
|
-
catch (
|
|
3322
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
3216
3323
|
finally {
|
|
3217
3324
|
try {
|
|
3218
3325
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
3219
3326
|
}
|
|
3220
|
-
finally { if (
|
|
3327
|
+
finally { if (e_12) throw e_12.error; }
|
|
3221
3328
|
}
|
|
3222
3329
|
};
|
|
3223
3330
|
/**
|
|
@@ -3226,7 +3333,7 @@ var Meta2d = /** @class */ (function () {
|
|
|
3226
3333
|
* @param pen 画笔
|
|
3227
3334
|
*/
|
|
3228
3335
|
Meta2d.prototype.upByArea = function (pen) {
|
|
3229
|
-
var _a,
|
|
3336
|
+
var _a, e_13, _b;
|
|
3230
3337
|
var _this = this;
|
|
3231
3338
|
var index = this.store.data.pens.findIndex(function (p) { return p.id === pen.id; });
|
|
3232
3339
|
if (index === -1) {
|
|
@@ -3276,12 +3383,12 @@ var Meta2d = /** @class */ (function () {
|
|
|
3276
3383
|
_loop_6(pen_2);
|
|
3277
3384
|
}
|
|
3278
3385
|
}
|
|
3279
|
-
catch (
|
|
3386
|
+
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
3280
3387
|
finally {
|
|
3281
3388
|
try {
|
|
3282
3389
|
if (allPens_1_1 && !allPens_1_1.done && (_b = allPens_1.return)) _b.call(allPens_1);
|
|
3283
3390
|
}
|
|
3284
|
-
finally { if (
|
|
3391
|
+
finally { if (e_13) throw e_13.error; }
|
|
3285
3392
|
}
|
|
3286
3393
|
this.initImageCanvas([pen]);
|
|
3287
3394
|
};
|
|
@@ -3305,7 +3412,7 @@ var Meta2d = /** @class */ (function () {
|
|
|
3305
3412
|
}
|
|
3306
3413
|
else if (type === 'up') {
|
|
3307
3414
|
zIndex =
|
|
3308
|
-
pen.calculative.zIndex === undefined ?
|
|
3415
|
+
pen.calculative.zIndex === undefined ? 6 : pen.calculative.zIndex + 1;
|
|
3309
3416
|
}
|
|
3310
3417
|
else if (type === 'down') {
|
|
3311
3418
|
zIndex =
|
|
@@ -3322,7 +3429,7 @@ var Meta2d = /** @class */ (function () {
|
|
|
3322
3429
|
* @param pens 画笔
|
|
3323
3430
|
*/
|
|
3324
3431
|
Meta2d.prototype.up = function (pens) {
|
|
3325
|
-
var
|
|
3432
|
+
var e_14, _a;
|
|
3326
3433
|
var _this = this;
|
|
3327
3434
|
if (!pens)
|
|
3328
3435
|
pens = this.store.active;
|
|
@@ -3375,12 +3482,12 @@ var Meta2d = /** @class */ (function () {
|
|
|
3375
3482
|
_loop_7(pen);
|
|
3376
3483
|
}
|
|
3377
3484
|
}
|
|
3378
|
-
catch (
|
|
3485
|
+
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
3379
3486
|
finally {
|
|
3380
3487
|
try {
|
|
3381
3488
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
3382
3489
|
}
|
|
3383
|
-
finally { if (
|
|
3490
|
+
finally { if (e_14) throw e_14.error; }
|
|
3384
3491
|
}
|
|
3385
3492
|
};
|
|
3386
3493
|
/**
|
|
@@ -3388,7 +3495,7 @@ var Meta2d = /** @class */ (function () {
|
|
|
3388
3495
|
* @param pen 画笔
|
|
3389
3496
|
*/
|
|
3390
3497
|
Meta2d.prototype.down = function (pens) {
|
|
3391
|
-
var
|
|
3498
|
+
var e_15, _a;
|
|
3392
3499
|
var _this = this;
|
|
3393
3500
|
if (!pens)
|
|
3394
3501
|
pens = this.store.active;
|
|
@@ -3443,12 +3550,12 @@ var Meta2d = /** @class */ (function () {
|
|
|
3443
3550
|
_loop_9(pen);
|
|
3444
3551
|
}
|
|
3445
3552
|
}
|
|
3446
|
-
catch (
|
|
3553
|
+
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
3447
3554
|
finally {
|
|
3448
3555
|
try {
|
|
3449
3556
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
3450
3557
|
}
|
|
3451
|
-
finally { if (
|
|
3558
|
+
finally { if (e_15) throw e_15.error; }
|
|
3452
3559
|
}
|
|
3453
3560
|
};
|
|
3454
3561
|
Meta2d.prototype.setLayer = function (pen, toIndex, pens) {
|
|
@@ -3490,6 +3597,10 @@ var Meta2d = /** @class */ (function () {
|
|
|
3490
3597
|
console.warn(node, 'node contain a error connectedLine');
|
|
3491
3598
|
return;
|
|
3492
3599
|
}
|
|
3600
|
+
if (lines.find(function (_line) { return _line.id === line.id; })) {
|
|
3601
|
+
//去重
|
|
3602
|
+
return;
|
|
3603
|
+
}
|
|
3493
3604
|
switch (type) {
|
|
3494
3605
|
case 'all':
|
|
3495
3606
|
lines.push(line);
|
|
@@ -3523,7 +3634,7 @@ var Meta2d = /** @class */ (function () {
|
|
|
3523
3634
|
var nextNodes_1 = [];
|
|
3524
3635
|
// 2. 遍历出线的 nextNode
|
|
3525
3636
|
lines.forEach(function (line) {
|
|
3526
|
-
var
|
|
3637
|
+
var e_16, _a;
|
|
3527
3638
|
var lineNextNode = _this.nextNode(line);
|
|
3528
3639
|
var _loop_11 = function (node) {
|
|
3529
3640
|
var have = nextNodes_1.find(function (next) { return next.id === node.id; });
|
|
@@ -3536,12 +3647,12 @@ var Meta2d = /** @class */ (function () {
|
|
|
3536
3647
|
_loop_11(node);
|
|
3537
3648
|
}
|
|
3538
3649
|
}
|
|
3539
|
-
catch (
|
|
3650
|
+
catch (e_16_1) { e_16 = { error: e_16_1 }; }
|
|
3540
3651
|
finally {
|
|
3541
3652
|
try {
|
|
3542
3653
|
if (lineNextNode_1_1 && !lineNextNode_1_1.done && (_a = lineNextNode_1.return)) _a.call(lineNextNode_1);
|
|
3543
3654
|
}
|
|
3544
|
-
finally { if (
|
|
3655
|
+
finally { if (e_16) throw e_16.error; }
|
|
3545
3656
|
}
|
|
3546
3657
|
});
|
|
3547
3658
|
return nextNodes_1;
|
|
@@ -3564,7 +3675,7 @@ var Meta2d = /** @class */ (function () {
|
|
|
3564
3675
|
var preNodes_1 = [];
|
|
3565
3676
|
// 2. 遍历入线的 preNode
|
|
3566
3677
|
lines.forEach(function (line) {
|
|
3567
|
-
var
|
|
3678
|
+
var e_17, _a;
|
|
3568
3679
|
var linePreNode = _this.previousNode(line);
|
|
3569
3680
|
var _loop_12 = function (node) {
|
|
3570
3681
|
var have = preNodes_1.find(function (pre) { return pre.id === node.id; });
|
|
@@ -3577,12 +3688,12 @@ var Meta2d = /** @class */ (function () {
|
|
|
3577
3688
|
_loop_12(node);
|
|
3578
3689
|
}
|
|
3579
3690
|
}
|
|
3580
|
-
catch (
|
|
3691
|
+
catch (e_17_1) { e_17 = { error: e_17_1 }; }
|
|
3581
3692
|
finally {
|
|
3582
3693
|
try {
|
|
3583
3694
|
if (linePreNode_1_1 && !linePreNode_1_1.done && (_a = linePreNode_1.return)) _a.call(linePreNode_1);
|
|
3584
3695
|
}
|
|
3585
|
-
finally { if (
|
|
3696
|
+
finally { if (e_17) throw e_17.error; }
|
|
3586
3697
|
}
|
|
3587
3698
|
});
|
|
3588
3699
|
return preNodes_1;
|
|
@@ -3858,7 +3969,7 @@ var Meta2d = /** @class */ (function () {
|
|
|
3858
3969
|
: deepClone(__spreadArray([parent], __read(components), false));
|
|
3859
3970
|
};
|
|
3860
3971
|
Meta2d.prototype.setVisible = function (pen, visible, render) {
|
|
3861
|
-
var
|
|
3972
|
+
var e_18, _a;
|
|
3862
3973
|
if (render === void 0) { render = true; }
|
|
3863
3974
|
this.onSizeUpdate();
|
|
3864
3975
|
this.setValue({ id: pen.id, visible: visible }, { render: false, doEvent: false });
|
|
@@ -3870,12 +3981,12 @@ var Meta2d = /** @class */ (function () {
|
|
|
3870
3981
|
child && this.setVisible(child, visible, false);
|
|
3871
3982
|
}
|
|
3872
3983
|
}
|
|
3873
|
-
catch (
|
|
3984
|
+
catch (e_18_1) { e_18 = { error: e_18_1 }; }
|
|
3874
3985
|
finally {
|
|
3875
3986
|
try {
|
|
3876
3987
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
3877
3988
|
}
|
|
3878
|
-
finally { if (
|
|
3989
|
+
finally { if (e_18) throw e_18.error; }
|
|
3879
3990
|
}
|
|
3880
3991
|
}
|
|
3881
3992
|
render && this.render();
|