@meta2d/core 1.0.34 → 1.0.35
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 +8 -0
- package/src/canvas/canvas.js +251 -90
- package/src/canvas/canvas.js.map +1 -1
- package/src/canvas/canvasTemplate.js +45 -14
- package/src/canvas/canvasTemplate.js.map +1 -1
- package/src/core.d.ts +3 -1
- package/src/core.js +60 -21
- package/src/core.js.map +1 -1
- package/src/diagrams/iframe.js +16 -4
- package/src/diagrams/iframe.js.map +1 -1
- package/src/options.d.ts +6 -0
- package/src/options.js +6 -0
- package/src/options.js.map +1 -1
- package/src/pen/model.d.ts +3 -0
- package/src/pen/model.js.map +1 -1
- package/src/pen/render.d.ts +2 -2
- package/src/pen/render.js +33 -18
- package/src/pen/render.js.map +1 -1
- package/src/store/store.d.ts +3 -0
- package/src/store/store.js.map +1 -1
package/src/canvas/canvas.js
CHANGED
|
@@ -542,6 +542,9 @@ var Canvas = /** @class */ (function () {
|
|
|
542
542
|
case 'v':
|
|
543
543
|
case 'V':
|
|
544
544
|
if (!e.ctrlKey && !e.metaKey) {
|
|
545
|
+
if (_this.pencil) {
|
|
546
|
+
_this.stopPencil();
|
|
547
|
+
}
|
|
545
548
|
if (_this.drawingLineName) {
|
|
546
549
|
_this.finishDrawline();
|
|
547
550
|
_this.drawingLineName = '';
|
|
@@ -556,7 +559,16 @@ var Canvas = /** @class */ (function () {
|
|
|
556
559
|
break;
|
|
557
560
|
case 'b':
|
|
558
561
|
case 'B':
|
|
559
|
-
_this.
|
|
562
|
+
if (_this.drawingLineName) {
|
|
563
|
+
_this.finishDrawline();
|
|
564
|
+
_this.drawingLineName = '';
|
|
565
|
+
}
|
|
566
|
+
if (_this.pencil) {
|
|
567
|
+
_this.stopPencil();
|
|
568
|
+
}
|
|
569
|
+
else {
|
|
570
|
+
_this.drawingPencil();
|
|
571
|
+
}
|
|
560
572
|
break;
|
|
561
573
|
case 'y':
|
|
562
574
|
case 'Y':
|
|
@@ -1052,7 +1064,7 @@ var Canvas = /** @class */ (function () {
|
|
|
1052
1064
|
else {
|
|
1053
1065
|
switch (_this.hoverType) {
|
|
1054
1066
|
case HoverType.None:
|
|
1055
|
-
_this.store.data.rule &&
|
|
1067
|
+
(_this.store.data.rule || _this.store.options.rule) &&
|
|
1056
1068
|
!_this.store.options.disableRuleLine &&
|
|
1057
1069
|
_this.addRuleLine(e);
|
|
1058
1070
|
if (_this.store.options.resizeMode) {
|
|
@@ -2981,12 +2993,15 @@ var Canvas = /** @class */ (function () {
|
|
|
2981
2993
|
});
|
|
2982
2994
|
};
|
|
2983
2995
|
Canvas.prototype.dropPens = function (pens, e) {
|
|
2996
|
+
var _a;
|
|
2984
2997
|
return __awaiter(this, void 0, void 0, function () {
|
|
2985
|
-
var pens_2, pens_2_1, pen, pens_3, pens_3_1, pen, pens_4, pens_4_1, pen, width, height, rect_1, flag,
|
|
2986
|
-
var e_7,
|
|
2987
|
-
|
|
2988
|
-
|
|
2998
|
+
var pens_2, pens_2_1, pen, pens_3, pens_3_1, pen, pens_4, pens_4_1, pen, pens_5, pens_5_1, pen, width, height, rect_1, flag, pens_6, pens_6_1, pen, points;
|
|
2999
|
+
var e_7, _b, e_8, _c, e_9, _d, e_10, _e, e_11, _f;
|
|
3000
|
+
var _this = this;
|
|
3001
|
+
return __generator(this, function (_g) {
|
|
3002
|
+
switch (_g.label) {
|
|
2989
3003
|
case 0:
|
|
3004
|
+
this.randomIdObj = {};
|
|
2990
3005
|
try {
|
|
2991
3006
|
for (pens_2 = __values(pens), pens_2_1 = pens_2.next(); !pens_2_1.done; pens_2_1 = pens_2.next()) {
|
|
2992
3007
|
pen = pens_2_1.value;
|
|
@@ -2997,13 +3012,38 @@ var Canvas = /** @class */ (function () {
|
|
|
2997
3012
|
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
2998
3013
|
finally {
|
|
2999
3014
|
try {
|
|
3000
|
-
if (pens_2_1 && !pens_2_1.done && (
|
|
3015
|
+
if (pens_2_1 && !pens_2_1.done && (_b = pens_2.return)) _b.call(pens_2);
|
|
3001
3016
|
}
|
|
3002
3017
|
finally { if (e_7) throw e_7.error; }
|
|
3003
3018
|
}
|
|
3019
|
+
if (Object.keys(this.randomIdObj).length !== 0) {
|
|
3020
|
+
try {
|
|
3021
|
+
for (pens_3 = __values(pens), pens_3_1 = pens_3.next(); !pens_3_1.done; pens_3_1 = pens_3.next()) {
|
|
3022
|
+
pen = pens_3_1.value;
|
|
3023
|
+
if (pen.type) {
|
|
3024
|
+
pen.anchors[0].connectTo = this.randomIdObj[pen.anchors[0].connectTo];
|
|
3025
|
+
pen.anchors[pen.anchors.length - 1].connectTo =
|
|
3026
|
+
this.randomIdObj[pen.anchors[pen.anchors.length - 1].connectTo];
|
|
3027
|
+
}
|
|
3028
|
+
else {
|
|
3029
|
+
(_a = pen.connectedLines) === null || _a === void 0 ? void 0 : _a.forEach(function (item) {
|
|
3030
|
+
item.lineAnchor = _this.randomIdObj[item.lineAnchor];
|
|
3031
|
+
item.lineId = _this.randomIdObj[item.lineId];
|
|
3032
|
+
});
|
|
3033
|
+
}
|
|
3034
|
+
}
|
|
3035
|
+
}
|
|
3036
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
3037
|
+
finally {
|
|
3038
|
+
try {
|
|
3039
|
+
if (pens_3_1 && !pens_3_1.done && (_c = pens_3.return)) _c.call(pens_3);
|
|
3040
|
+
}
|
|
3041
|
+
finally { if (e_8) throw e_8.error; }
|
|
3042
|
+
}
|
|
3043
|
+
}
|
|
3004
3044
|
try {
|
|
3005
|
-
for (
|
|
3006
|
-
pen =
|
|
3045
|
+
for (pens_4 = __values(pens), pens_4_1 = pens_4.next(); !pens_4_1.done; pens_4_1 = pens_4.next()) {
|
|
3046
|
+
pen = pens_4_1.value;
|
|
3007
3047
|
// TODO: randomCombineId 会更改 id, 此处应该不存在空 id
|
|
3008
3048
|
if (!pen.id) {
|
|
3009
3049
|
pen.id = s8();
|
|
@@ -3012,12 +3052,12 @@ var Canvas = /** @class */ (function () {
|
|
|
3012
3052
|
this.store.pens[pen.id] = pen;
|
|
3013
3053
|
}
|
|
3014
3054
|
}
|
|
3015
|
-
catch (
|
|
3055
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
3016
3056
|
finally {
|
|
3017
3057
|
try {
|
|
3018
|
-
if (
|
|
3058
|
+
if (pens_4_1 && !pens_4_1.done && (_d = pens_4.return)) _d.call(pens_4);
|
|
3019
3059
|
}
|
|
3020
|
-
finally { if (
|
|
3060
|
+
finally { if (e_9) throw e_9.error; }
|
|
3021
3061
|
}
|
|
3022
3062
|
try {
|
|
3023
3063
|
// // 计算区域
|
|
@@ -3025,8 +3065,8 @@ var Canvas = /** @class */ (function () {
|
|
|
3025
3065
|
// // 组合节点才需要提前计算
|
|
3026
3066
|
// Array.isArray(pen.children) && pen.children.length > 0 && this.updatePenRect(pen);
|
|
3027
3067
|
// }
|
|
3028
|
-
for (
|
|
3029
|
-
pen =
|
|
3068
|
+
for (pens_5 = __values(pens), pens_5_1 = pens_5.next(); !pens_5_1.done; pens_5_1 = pens_5.next()) {
|
|
3069
|
+
pen = pens_5_1.value;
|
|
3030
3070
|
if (!pen.parentId) {
|
|
3031
3071
|
pen.width *= this.store.data.scale;
|
|
3032
3072
|
pen.height *= this.store.data.scale;
|
|
@@ -3039,12 +3079,12 @@ var Canvas = /** @class */ (function () {
|
|
|
3039
3079
|
}
|
|
3040
3080
|
}
|
|
3041
3081
|
}
|
|
3042
|
-
catch (
|
|
3082
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
3043
3083
|
finally {
|
|
3044
3084
|
try {
|
|
3045
|
-
if (
|
|
3085
|
+
if (pens_5_1 && !pens_5_1.done && (_e = pens_5.return)) _e.call(pens_5);
|
|
3046
3086
|
}
|
|
3047
|
-
finally { if (
|
|
3087
|
+
finally { if (e_10) throw e_10.error; }
|
|
3048
3088
|
}
|
|
3049
3089
|
width = this.store.data.width || this.store.options.width;
|
|
3050
3090
|
height = this.store.data.height || this.store.options.height;
|
|
@@ -3057,8 +3097,8 @@ var Canvas = /** @class */ (function () {
|
|
|
3057
3097
|
};
|
|
3058
3098
|
flag = true;
|
|
3059
3099
|
try {
|
|
3060
|
-
for (
|
|
3061
|
-
pen =
|
|
3100
|
+
for (pens_6 = __values(pens), pens_6_1 = pens_6.next(); !pens_6_1.done; pens_6_1 = pens_6.next()) {
|
|
3101
|
+
pen = pens_6_1.value;
|
|
3062
3102
|
if (!pen.parentId) {
|
|
3063
3103
|
points = [
|
|
3064
3104
|
{ x: pen.x, y: pen.y },
|
|
@@ -3093,12 +3133,12 @@ var Canvas = /** @class */ (function () {
|
|
|
3093
3133
|
}
|
|
3094
3134
|
}
|
|
3095
3135
|
}
|
|
3096
|
-
catch (
|
|
3136
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
3097
3137
|
finally {
|
|
3098
3138
|
try {
|
|
3099
|
-
if (
|
|
3139
|
+
if (pens_6_1 && !pens_6_1.done && (_f = pens_6.return)) _f.call(pens_6);
|
|
3100
3140
|
}
|
|
3101
|
-
finally { if (
|
|
3141
|
+
finally { if (e_11) throw e_11.error; }
|
|
3102
3142
|
}
|
|
3103
3143
|
if (flag) {
|
|
3104
3144
|
console.info('画笔在大屏范围外');
|
|
@@ -3107,7 +3147,7 @@ var Canvas = /** @class */ (function () {
|
|
|
3107
3147
|
}
|
|
3108
3148
|
return [4 /*yield*/, this.addPens(pens, true)];
|
|
3109
3149
|
case 1:
|
|
3110
|
-
|
|
3150
|
+
_g.sent();
|
|
3111
3151
|
this.active(pens.filter(function (pen) { return !pen.parentId; }));
|
|
3112
3152
|
this.render();
|
|
3113
3153
|
this.externalElements.focus(); // 聚焦
|
|
@@ -3117,8 +3157,35 @@ var Canvas = /** @class */ (function () {
|
|
|
3117
3157
|
});
|
|
3118
3158
|
};
|
|
3119
3159
|
Canvas.prototype.randomCombineId = function (pen, pens, parentId) {
|
|
3120
|
-
var
|
|
3160
|
+
var e_12, _a;
|
|
3161
|
+
var beforeIds = null;
|
|
3162
|
+
if (pen.type) {
|
|
3163
|
+
if (pen.anchors[0].connectTo ||
|
|
3164
|
+
pen.anchors[pen.anchors.length - 1].connectTo) {
|
|
3165
|
+
beforeIds = [
|
|
3166
|
+
pen.id,
|
|
3167
|
+
pen.anchors[0].id,
|
|
3168
|
+
pen.anchors[pen.anchors.length - 1].id,
|
|
3169
|
+
];
|
|
3170
|
+
}
|
|
3171
|
+
}
|
|
3172
|
+
else {
|
|
3173
|
+
if (pen.connectedLines && pen.connectedLines.length) {
|
|
3174
|
+
beforeIds = [pen.id];
|
|
3175
|
+
}
|
|
3176
|
+
}
|
|
3121
3177
|
randomId(pen);
|
|
3178
|
+
if (beforeIds) {
|
|
3179
|
+
if (beforeIds.length === 1) {
|
|
3180
|
+
this.randomIdObj[beforeIds[0]] = pen.id;
|
|
3181
|
+
}
|
|
3182
|
+
else {
|
|
3183
|
+
this.randomIdObj[beforeIds[0]] = pen.id;
|
|
3184
|
+
this.randomIdObj[beforeIds[1]] = pen.anchors[0].id;
|
|
3185
|
+
this.randomIdObj[beforeIds[2]] = pen.anchors[pen.anchors.length - 1].id;
|
|
3186
|
+
}
|
|
3187
|
+
}
|
|
3188
|
+
//处理链接关系
|
|
3122
3189
|
pen.parentId = parentId;
|
|
3123
3190
|
var newChildren = [];
|
|
3124
3191
|
if (Array.isArray(pen.children)) {
|
|
@@ -3134,12 +3201,12 @@ var Canvas = /** @class */ (function () {
|
|
|
3134
3201
|
_loop_4(childId);
|
|
3135
3202
|
}
|
|
3136
3203
|
}
|
|
3137
|
-
catch (
|
|
3204
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
3138
3205
|
finally {
|
|
3139
3206
|
try {
|
|
3140
3207
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
3141
3208
|
}
|
|
3142
|
-
finally { if (
|
|
3209
|
+
finally { if (e_12) throw e_12.error; }
|
|
3143
3210
|
}
|
|
3144
3211
|
}
|
|
3145
3212
|
pen.children = newChildren;
|
|
@@ -3147,8 +3214,8 @@ var Canvas = /** @class */ (function () {
|
|
|
3147
3214
|
};
|
|
3148
3215
|
Canvas.prototype.addPens = function (pens, history) {
|
|
3149
3216
|
return __awaiter(this, void 0, void 0, function () {
|
|
3150
|
-
var _a, list,
|
|
3151
|
-
var
|
|
3217
|
+
var _a, list, pens_7, pens_7_1, pen;
|
|
3218
|
+
var e_13, _b;
|
|
3152
3219
|
return __generator(this, function (_c) {
|
|
3153
3220
|
switch (_c.label) {
|
|
3154
3221
|
case 0:
|
|
@@ -3164,8 +3231,8 @@ var Canvas = /** @class */ (function () {
|
|
|
3164
3231
|
}
|
|
3165
3232
|
list = [];
|
|
3166
3233
|
try {
|
|
3167
|
-
for (
|
|
3168
|
-
pen =
|
|
3234
|
+
for (pens_7 = __values(pens), pens_7_1 = pens_7.next(); !pens_7_1.done; pens_7_1 = pens_7.next()) {
|
|
3235
|
+
pen = pens_7_1.value;
|
|
3169
3236
|
if (this.beforeAddPen && this.beforeAddPen(pen) != true) {
|
|
3170
3237
|
continue;
|
|
3171
3238
|
}
|
|
@@ -3173,12 +3240,12 @@ var Canvas = /** @class */ (function () {
|
|
|
3173
3240
|
list.push(pen);
|
|
3174
3241
|
}
|
|
3175
3242
|
}
|
|
3176
|
-
catch (
|
|
3243
|
+
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
3177
3244
|
finally {
|
|
3178
3245
|
try {
|
|
3179
|
-
if (
|
|
3246
|
+
if (pens_7_1 && !pens_7_1.done && (_b = pens_7.return)) _b.call(pens_7);
|
|
3180
3247
|
}
|
|
3181
|
-
finally { if (
|
|
3248
|
+
finally { if (e_13) throw e_13.error; }
|
|
3182
3249
|
}
|
|
3183
3250
|
this.render();
|
|
3184
3251
|
this.store.emitter.emit('add', list);
|
|
@@ -3245,7 +3312,7 @@ var Canvas = /** @class */ (function () {
|
|
|
3245
3312
|
};
|
|
3246
3313
|
};
|
|
3247
3314
|
Canvas.prototype.addRuleLine = function (e) {
|
|
3248
|
-
var _a = this.store.data, offsetX = _a.x, offsetY = _a.y;
|
|
3315
|
+
var _a = this.store.data, offsetX = _a.x, offsetY = _a.y, scale = _a.scale, origin = _a.origin;
|
|
3249
3316
|
// 靠近左上角的 x ,y
|
|
3250
3317
|
var x = e.x + offsetX;
|
|
3251
3318
|
var y = e.y + offsetY;
|
|
@@ -3260,12 +3327,24 @@ var Canvas = /** @class */ (function () {
|
|
|
3260
3327
|
lineX = -offsetX;
|
|
3261
3328
|
width = this.width;
|
|
3262
3329
|
otherPX = 1;
|
|
3330
|
+
if (!e.ctrlKey) {
|
|
3331
|
+
//找最近的标尺线
|
|
3332
|
+
lineY =
|
|
3333
|
+
Math.round((lineY - origin.y) / (scale * 10)) * (scale * 10) +
|
|
3334
|
+
origin.y;
|
|
3335
|
+
}
|
|
3263
3336
|
}
|
|
3264
3337
|
else if (y < x && y < 20) {
|
|
3265
3338
|
// 绘制一条垂直线
|
|
3266
3339
|
lineY = -offsetY;
|
|
3267
3340
|
height = this.height;
|
|
3268
3341
|
otherPY = 1;
|
|
3342
|
+
if (!e.ctrlKey) {
|
|
3343
|
+
//找最近的标尺线
|
|
3344
|
+
lineX =
|
|
3345
|
+
Math.round((lineX - origin.x) / (scale * 10)) * (scale * 10) +
|
|
3346
|
+
origin.x;
|
|
3347
|
+
}
|
|
3269
3348
|
}
|
|
3270
3349
|
else {
|
|
3271
3350
|
return;
|
|
@@ -3293,6 +3372,37 @@ var Canvas = /** @class */ (function () {
|
|
|
3293
3372
|
],
|
|
3294
3373
|
});
|
|
3295
3374
|
};
|
|
3375
|
+
/**
|
|
3376
|
+
* @description 调整pen的坐标,让pen按照网格自动对齐
|
|
3377
|
+
* @author Joseph Ho
|
|
3378
|
+
* @date 14/11/2023
|
|
3379
|
+
* @memberof Canvas
|
|
3380
|
+
*/
|
|
3381
|
+
Canvas.prototype.alignPenToGrid = function (pen) {
|
|
3382
|
+
var _a;
|
|
3383
|
+
var autoAlignGrid = this.store.options.autoAlignGrid && this.store.data.grid;
|
|
3384
|
+
if (autoAlignGrid) {
|
|
3385
|
+
var gridSize = this.store.data.gridSize || this.store.options.gridSize;
|
|
3386
|
+
var _b = this.store.data, origin_2 = _b.origin, scale = _b.scale;
|
|
3387
|
+
var x = pen.x, y = pen.y;
|
|
3388
|
+
var obj = { x: x, y: y };
|
|
3389
|
+
var rect = this.getPenRect(pen);
|
|
3390
|
+
// 算出偏移了多少个网格
|
|
3391
|
+
var m = parseInt((rect.x / gridSize).toFixed());
|
|
3392
|
+
var n = parseInt((rect.y / gridSize).toFixed());
|
|
3393
|
+
console.log(m, n);
|
|
3394
|
+
var x1 = m * gridSize;
|
|
3395
|
+
var y1 = n * gridSize;
|
|
3396
|
+
// 算出最终的偏移坐标
|
|
3397
|
+
obj.x = origin_2.x + x1 * scale;
|
|
3398
|
+
obj.y = origin_2.y + y1 * scale;
|
|
3399
|
+
Object.assign(pen, obj);
|
|
3400
|
+
(_a = pen.onMove) === null || _a === void 0 ? void 0 : _a.call(pen, pen);
|
|
3401
|
+
this.updatePenRect(pen);
|
|
3402
|
+
this.calcActiveRect();
|
|
3403
|
+
this.getSizeCPs();
|
|
3404
|
+
}
|
|
3405
|
+
};
|
|
3296
3406
|
/**
|
|
3297
3407
|
* 拖拽结束,数据更新到 active.pens
|
|
3298
3408
|
*/
|
|
@@ -3301,13 +3411,26 @@ var Canvas = /** @class */ (function () {
|
|
|
3301
3411
|
// 鼠标松手才更新,此处是更新前的值
|
|
3302
3412
|
var initPens = deepClone(this.store.active, true);
|
|
3303
3413
|
// const pens = deepClone(this.store.active, true);
|
|
3414
|
+
var gridSize = this.store.data.gridSize || this.store.options.gridSize;
|
|
3415
|
+
var _a = this.store.data, origin = _a.origin, scale = _a.scale;
|
|
3416
|
+
var autoAlignGrid = this.store.options.autoAlignGrid && this.store.data.grid;
|
|
3304
3417
|
this.store.active.forEach(function (pen, i) {
|
|
3305
3418
|
var _a;
|
|
3306
3419
|
var _b = _this.movingPens[i], x = _b.x, y = _b.y;
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3420
|
+
var obj = { x: x, y: y };
|
|
3421
|
+
// 根据是否开启了自动网格对齐,来修正坐标
|
|
3422
|
+
if (autoAlignGrid) {
|
|
3423
|
+
var rect = _this.getPenRect(_this.movingPens[i]);
|
|
3424
|
+
// 算出偏移了多少个网格
|
|
3425
|
+
var m = parseInt((rect.x / gridSize).toFixed());
|
|
3426
|
+
var n = parseInt((rect.y / gridSize).toFixed());
|
|
3427
|
+
var x1 = m * gridSize;
|
|
3428
|
+
var y1 = n * gridSize;
|
|
3429
|
+
// 算出最终的偏移坐标
|
|
3430
|
+
obj.x = origin.x + x1 * scale;
|
|
3431
|
+
obj.y = origin.y + y1 * scale;
|
|
3432
|
+
}
|
|
3433
|
+
Object.assign(pen, obj);
|
|
3311
3434
|
(_a = pen.onMove) === null || _a === void 0 ? void 0 : _a.call(pen, pen);
|
|
3312
3435
|
_this.updatePenRect(pen);
|
|
3313
3436
|
_this.updateLines(pen);
|
|
@@ -3336,7 +3459,7 @@ var Canvas = /** @class */ (function () {
|
|
|
3336
3459
|
// 避免选中图元的出错情况,this.dock为undefined
|
|
3337
3460
|
if (!this.dock)
|
|
3338
3461
|
return;
|
|
3339
|
-
var
|
|
3462
|
+
var _b = this.dock, xDock = _b.xDock, yDock = _b.yDock;
|
|
3340
3463
|
var dockPen;
|
|
3341
3464
|
if (xDock) {
|
|
3342
3465
|
dockPen = this.store.pens[xDock.penId];
|
|
@@ -3379,6 +3502,11 @@ var Canvas = /** @class */ (function () {
|
|
|
3379
3502
|
}
|
|
3380
3503
|
}
|
|
3381
3504
|
}
|
|
3505
|
+
// 如果开启自动网格对齐,则需要重算activeRect和sizeCPs
|
|
3506
|
+
if (autoAlignGrid) {
|
|
3507
|
+
this.calcActiveRect();
|
|
3508
|
+
this.getSizeCPs();
|
|
3509
|
+
}
|
|
3382
3510
|
// 此处是更新后的值
|
|
3383
3511
|
this.pushHistory({
|
|
3384
3512
|
type: EditType.Update,
|
|
@@ -3454,7 +3582,7 @@ var Canvas = /** @class */ (function () {
|
|
|
3454
3582
|
this.patchFlags = true;
|
|
3455
3583
|
};
|
|
3456
3584
|
Canvas.prototype.active = function (pens, emit) {
|
|
3457
|
-
var
|
|
3585
|
+
var e_14, _a, _b;
|
|
3458
3586
|
if (emit === void 0) { emit = true; }
|
|
3459
3587
|
if (this.store.active) {
|
|
3460
3588
|
emit && this.store.emitter.emit('inactive', this.store.active);
|
|
@@ -3466,12 +3594,12 @@ var Canvas = /** @class */ (function () {
|
|
|
3466
3594
|
setChildrenActive(pen, false);
|
|
3467
3595
|
}
|
|
3468
3596
|
}
|
|
3469
|
-
catch (
|
|
3597
|
+
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
3470
3598
|
finally {
|
|
3471
3599
|
try {
|
|
3472
3600
|
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
3473
3601
|
}
|
|
3474
|
-
finally { if (
|
|
3602
|
+
finally { if (e_14) throw e_14.error; }
|
|
3475
3603
|
}
|
|
3476
3604
|
}
|
|
3477
3605
|
this.store.active = [];
|
|
@@ -3658,7 +3786,7 @@ var Canvas = /** @class */ (function () {
|
|
|
3658
3786
|
return HoverType.None;
|
|
3659
3787
|
};
|
|
3660
3788
|
Canvas.prototype.resize = function (w, h) {
|
|
3661
|
-
var
|
|
3789
|
+
var e_15, _a;
|
|
3662
3790
|
w = w || this.parentElement.clientWidth;
|
|
3663
3791
|
h = h || this.parentElement.clientHeight;
|
|
3664
3792
|
this.width = w;
|
|
@@ -3700,12 +3828,12 @@ var Canvas = /** @class */ (function () {
|
|
|
3700
3828
|
calcInView(pen);
|
|
3701
3829
|
}
|
|
3702
3830
|
}
|
|
3703
|
-
catch (
|
|
3831
|
+
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
3704
3832
|
finally {
|
|
3705
3833
|
try {
|
|
3706
3834
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
3707
3835
|
}
|
|
3708
|
-
finally { if (
|
|
3836
|
+
finally { if (e_15) throw e_15.error; }
|
|
3709
3837
|
}
|
|
3710
3838
|
};
|
|
3711
3839
|
Canvas.prototype.clearCanvas = function () {
|
|
@@ -3773,7 +3901,7 @@ var Canvas = /** @class */ (function () {
|
|
|
3773
3901
|
this.store.histories.splice(this.store.historyIndex + 1, this.store.histories.length - this.store.historyIndex - 1);
|
|
3774
3902
|
}
|
|
3775
3903
|
(_a = action.pens) === null || _a === void 0 ? void 0 : _a.forEach(function (pen) {
|
|
3776
|
-
var
|
|
3904
|
+
var e_16, _a;
|
|
3777
3905
|
var found;
|
|
3778
3906
|
if (action.initPens) {
|
|
3779
3907
|
try {
|
|
@@ -3784,12 +3912,12 @@ var Canvas = /** @class */ (function () {
|
|
|
3784
3912
|
}
|
|
3785
3913
|
}
|
|
3786
3914
|
}
|
|
3787
|
-
catch (
|
|
3915
|
+
catch (e_16_1) { e_16 = { error: e_16_1 }; }
|
|
3788
3916
|
finally {
|
|
3789
3917
|
try {
|
|
3790
3918
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
3791
3919
|
}
|
|
3792
|
-
finally { if (
|
|
3920
|
+
finally { if (e_16) throw e_16.error; }
|
|
3793
3921
|
}
|
|
3794
3922
|
}
|
|
3795
3923
|
if (found) {
|
|
@@ -3847,11 +3975,11 @@ var Canvas = /** @class */ (function () {
|
|
|
3847
3975
|
var _this = this;
|
|
3848
3976
|
var before = this.store.histories[this.store.historyIndex];
|
|
3849
3977
|
if (before && before.type === EditType.Add) {
|
|
3850
|
-
var
|
|
3978
|
+
var pens_8 = [];
|
|
3851
3979
|
before.pens.forEach(function (pen) {
|
|
3852
|
-
|
|
3980
|
+
pens_8.push(_this.store.pens[pen.id]);
|
|
3853
3981
|
});
|
|
3854
|
-
this.active(
|
|
3982
|
+
this.active(pens_8);
|
|
3855
3983
|
}
|
|
3856
3984
|
};
|
|
3857
3985
|
Canvas.prototype.doEditAction = function (action, undo) {
|
|
@@ -3887,6 +4015,11 @@ var Canvas = /** @class */ (function () {
|
|
|
3887
4015
|
var i = _this.store.data.pens.findIndex(function (item) { return item.id === pen.id; });
|
|
3888
4016
|
if (i > -1) {
|
|
3889
4017
|
pen.calculative = _this.store.data.pens[i].calculative;
|
|
4018
|
+
if (_this.store.data.pens[i].type && _this.store.data.pens[i].lastConnected) {
|
|
4019
|
+
for (var key in _this.store.data.pens[i].lastConnected) {
|
|
4020
|
+
_this.store.pens[key].connectedLines = _this.store.data.pens[i].lastConnected[key];
|
|
4021
|
+
}
|
|
4022
|
+
}
|
|
3890
4023
|
_this.store.data.pens[i] = pen;
|
|
3891
4024
|
_this.store.pens[pen.id] = pen;
|
|
3892
4025
|
for (var k in pen) {
|
|
@@ -3911,7 +4044,7 @@ var Canvas = /** @class */ (function () {
|
|
|
3911
4044
|
});
|
|
3912
4045
|
break;
|
|
3913
4046
|
case EditType.Delete:
|
|
3914
|
-
action.pens.forEach(function (aPen) {
|
|
4047
|
+
action.pens.reverse().forEach(function (aPen) {
|
|
3915
4048
|
var _a, _b;
|
|
3916
4049
|
var pen = deepClone(aPen, true);
|
|
3917
4050
|
if (!pen.calculative) {
|
|
@@ -3922,9 +4055,14 @@ var Canvas = /** @class */ (function () {
|
|
|
3922
4055
|
: _this.store.data.pens.length, 0, pen);
|
|
3923
4056
|
// 先放进去,pens 可能是子节点在前,而父节点在后
|
|
3924
4057
|
_this.store.pens[pen.id] = pen;
|
|
4058
|
+
if (pen.type && pen.lastConnected) {
|
|
4059
|
+
for (var key in pen.lastConnected) {
|
|
4060
|
+
_this.store.pens[key].connectedLines = pen.lastConnected[key];
|
|
4061
|
+
}
|
|
4062
|
+
}
|
|
3925
4063
|
pen.calculative.canvas = _this;
|
|
3926
4064
|
});
|
|
3927
|
-
action.pens.forEach(function (aPen) {
|
|
4065
|
+
action.pens.reverse().forEach(function (aPen) {
|
|
3928
4066
|
var pen = _this.store.pens[aPen.id];
|
|
3929
4067
|
var rect = _this.getPenRect(pen, action.origin, action.scale);
|
|
3930
4068
|
_this.setPenRect(pen, rect, false);
|
|
@@ -4516,7 +4654,7 @@ var Canvas = /** @class */ (function () {
|
|
|
4516
4654
|
this.onMovePens();
|
|
4517
4655
|
};
|
|
4518
4656
|
Canvas.prototype.onMovePens = function () {
|
|
4519
|
-
var
|
|
4657
|
+
var e_17, _a;
|
|
4520
4658
|
var _b;
|
|
4521
4659
|
var map = this.parent.map;
|
|
4522
4660
|
if (map && map.isShow) {
|
|
@@ -4541,12 +4679,12 @@ var Canvas = /** @class */ (function () {
|
|
|
4541
4679
|
}
|
|
4542
4680
|
}
|
|
4543
4681
|
}
|
|
4544
|
-
catch (
|
|
4682
|
+
catch (e_17_1) { e_17 = { error: e_17_1 }; }
|
|
4545
4683
|
finally {
|
|
4546
4684
|
try {
|
|
4547
4685
|
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
4548
4686
|
}
|
|
4549
|
-
finally { if (
|
|
4687
|
+
finally { if (e_17) throw e_17.error; }
|
|
4550
4688
|
}
|
|
4551
4689
|
};
|
|
4552
4690
|
/**
|
|
@@ -4644,7 +4782,7 @@ var Canvas = /** @class */ (function () {
|
|
|
4644
4782
|
this.calcActiveRect();
|
|
4645
4783
|
};
|
|
4646
4784
|
Canvas.prototype.rotatePens = function (e) {
|
|
4647
|
-
var
|
|
4785
|
+
var e_18, _a;
|
|
4648
4786
|
var _this = this;
|
|
4649
4787
|
if (!this.initPens) {
|
|
4650
4788
|
this.initPens = deepClone(this.getAllByPens(this.store.active));
|
|
@@ -4671,12 +4809,12 @@ var Canvas = /** @class */ (function () {
|
|
|
4671
4809
|
this.updateLines(pen);
|
|
4672
4810
|
}
|
|
4673
4811
|
}
|
|
4674
|
-
catch (
|
|
4812
|
+
catch (e_18_1) { e_18 = { error: e_18_1 }; }
|
|
4675
4813
|
finally {
|
|
4676
4814
|
try {
|
|
4677
4815
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
4678
4816
|
}
|
|
4679
|
-
finally { if (
|
|
4817
|
+
finally { if (e_18) throw e_18.error; }
|
|
4680
4818
|
}
|
|
4681
4819
|
this.lastRotate = this.activeRect.rotate;
|
|
4682
4820
|
this.getSizeCPs();
|
|
@@ -5413,7 +5551,7 @@ var Canvas = /** @class */ (function () {
|
|
|
5413
5551
|
this.initLineRect(line);
|
|
5414
5552
|
};
|
|
5415
5553
|
Canvas.prototype.restoreNodeAnimate = function (pen) {
|
|
5416
|
-
var _a;
|
|
5554
|
+
var _a, _b;
|
|
5417
5555
|
if (pen.calculative.initRect) {
|
|
5418
5556
|
if (pen.keepAnimateState) {
|
|
5419
5557
|
for (var k in pen) {
|
|
@@ -5470,10 +5608,14 @@ var Canvas = /** @class */ (function () {
|
|
|
5470
5608
|
pen.calculative.worldRect = pen.calculative.initRect;
|
|
5471
5609
|
}
|
|
5472
5610
|
this.updatePenRect(pen, { worldRectIsReady: true });
|
|
5611
|
+
this.updateLines(pen);
|
|
5473
5612
|
if (pen.calculative.text !== pen.text) {
|
|
5474
5613
|
pen.calculative.text = pen.text;
|
|
5475
5614
|
calcTextLines(pen);
|
|
5476
5615
|
}
|
|
5616
|
+
if ((_b = this.store.active) === null || _b === void 0 ? void 0 : _b.length) {
|
|
5617
|
+
this.calcActiveRect();
|
|
5618
|
+
}
|
|
5477
5619
|
pen.calculative.initRect = undefined;
|
|
5478
5620
|
}
|
|
5479
5621
|
};
|
|
@@ -5650,7 +5792,7 @@ var Canvas = /** @class */ (function () {
|
|
|
5650
5792
|
return;
|
|
5651
5793
|
}
|
|
5652
5794
|
pens.forEach(function (pen) {
|
|
5653
|
-
var _a, _b, _c, _d;
|
|
5795
|
+
var _a, _b, _c, _d, _e;
|
|
5654
5796
|
if (pen.calculative.pause) {
|
|
5655
5797
|
var d = Date.now() - pen.calculative.pause;
|
|
5656
5798
|
pen.calculative.pause = undefined;
|
|
@@ -5685,6 +5827,18 @@ var Canvas = /** @class */ (function () {
|
|
|
5685
5827
|
}
|
|
5686
5828
|
_this.store.animateMap.set(pen, _this.getFrameProps(pen));
|
|
5687
5829
|
}
|
|
5830
|
+
else {
|
|
5831
|
+
if ((_e = pen.animations) === null || _e === void 0 ? void 0 : _e.length) {
|
|
5832
|
+
//默认执行line的第一个动画
|
|
5833
|
+
var animate = deepClone(pen.animations[0]);
|
|
5834
|
+
delete animate.name;
|
|
5835
|
+
animate.currentAnimation = 0;
|
|
5836
|
+
_this.parent.setValue(__assign({ id: pen.id }, animate), {
|
|
5837
|
+
doEvent: false,
|
|
5838
|
+
history: false,
|
|
5839
|
+
});
|
|
5840
|
+
}
|
|
5841
|
+
}
|
|
5688
5842
|
_this.store.animates.add(pen);
|
|
5689
5843
|
}
|
|
5690
5844
|
}
|
|
@@ -5710,7 +5864,7 @@ var Canvas = /** @class */ (function () {
|
|
|
5710
5864
|
return;
|
|
5711
5865
|
}
|
|
5712
5866
|
requestAnimationFrame(function () {
|
|
5713
|
-
var
|
|
5867
|
+
var e_19, _a;
|
|
5714
5868
|
var now = Date.now();
|
|
5715
5869
|
if (now - _this.lastAnimateRender < _this.store.options.animateInterval) {
|
|
5716
5870
|
if (_this.store.animates.size > 0) {
|
|
@@ -5795,12 +5949,12 @@ var Canvas = /** @class */ (function () {
|
|
|
5795
5949
|
_loop_5(pen);
|
|
5796
5950
|
}
|
|
5797
5951
|
}
|
|
5798
|
-
catch (
|
|
5952
|
+
catch (e_19_1) { e_19 = { error: e_19_1 }; }
|
|
5799
5953
|
finally {
|
|
5800
5954
|
try {
|
|
5801
5955
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
5802
5956
|
}
|
|
5803
|
-
finally { if (
|
|
5957
|
+
finally { if (e_19) throw e_19.error; }
|
|
5804
5958
|
}
|
|
5805
5959
|
if (active) {
|
|
5806
5960
|
_this.calcActiveRect();
|
|
@@ -5887,7 +6041,7 @@ var Canvas = /** @class */ (function () {
|
|
|
5887
6041
|
var _a;
|
|
5888
6042
|
return __awaiter(this, void 0, void 0, function () {
|
|
5889
6043
|
var clipboardText, clipboard, _b, _c, offset, pos, curPage, rootPens, rootPens_1, rootPens_1_1, pen;
|
|
5890
|
-
var
|
|
6044
|
+
var e_20, _d;
|
|
5891
6045
|
return __generator(this, function (_e) {
|
|
5892
6046
|
switch (_e.label) {
|
|
5893
6047
|
case 0:
|
|
@@ -5960,12 +6114,12 @@ var Canvas = /** @class */ (function () {
|
|
|
5960
6114
|
this.pastePen(pen, undefined);
|
|
5961
6115
|
}
|
|
5962
6116
|
}
|
|
5963
|
-
catch (
|
|
6117
|
+
catch (e_20_1) { e_20 = { error: e_20_1 }; }
|
|
5964
6118
|
finally {
|
|
5965
6119
|
try {
|
|
5966
6120
|
if (rootPens_1_1 && !rootPens_1_1.done && (_d = rootPens_1.return)) _d.call(rootPens_1);
|
|
5967
6121
|
}
|
|
5968
|
-
finally { if (
|
|
6122
|
+
finally { if (e_20) throw e_20.error; }
|
|
5969
6123
|
}
|
|
5970
6124
|
sessionStorage.setItem('page', clipboard.page);
|
|
5971
6125
|
this.active(rootPens);
|
|
@@ -5983,20 +6137,20 @@ var Canvas = /** @class */ (function () {
|
|
|
5983
6137
|
* @param pens 不包含子节点
|
|
5984
6138
|
*/
|
|
5985
6139
|
Canvas.prototype.getAllByPens = function (pens) {
|
|
5986
|
-
var
|
|
6140
|
+
var e_21, _a;
|
|
5987
6141
|
var retPens = [];
|
|
5988
6142
|
try {
|
|
5989
|
-
for (var
|
|
5990
|
-
var pen =
|
|
6143
|
+
for (var pens_9 = __values(pens), pens_9_1 = pens_9.next(); !pens_9_1.done; pens_9_1 = pens_9.next()) {
|
|
6144
|
+
var pen = pens_9_1.value;
|
|
5991
6145
|
retPens.push.apply(retPens, __spreadArray([], __read(deepClone(getAllChildren(pen, this.store), true)), false));
|
|
5992
6146
|
}
|
|
5993
6147
|
}
|
|
5994
|
-
catch (
|
|
6148
|
+
catch (e_21_1) { e_21 = { error: e_21_1 }; }
|
|
5995
6149
|
finally {
|
|
5996
6150
|
try {
|
|
5997
|
-
if (
|
|
6151
|
+
if (pens_9_1 && !pens_9_1.done && (_a = pens_9.return)) _a.call(pens_9);
|
|
5998
6152
|
}
|
|
5999
|
-
finally { if (
|
|
6153
|
+
finally { if (e_21) throw e_21.error; }
|
|
6000
6154
|
}
|
|
6001
6155
|
return retPens.concat(pens);
|
|
6002
6156
|
};
|
|
@@ -6039,7 +6193,7 @@ var Canvas = /** @class */ (function () {
|
|
|
6039
6193
|
* @param pastePens 此处复制的全部 pens (包含子节点)
|
|
6040
6194
|
*/
|
|
6041
6195
|
Canvas.prototype.changeNodeConnectedLine = function (oldId, line, pastePens) {
|
|
6042
|
-
var
|
|
6196
|
+
var e_22, _a;
|
|
6043
6197
|
var _b;
|
|
6044
6198
|
var from = line.anchors[0];
|
|
6045
6199
|
var to = line.anchors[line.anchors.length - 1];
|
|
@@ -6075,12 +6229,12 @@ var Canvas = /** @class */ (function () {
|
|
|
6075
6229
|
_loop_7(anchor);
|
|
6076
6230
|
}
|
|
6077
6231
|
}
|
|
6078
|
-
catch (
|
|
6232
|
+
catch (e_22_1) { e_22 = { error: e_22_1 }; }
|
|
6079
6233
|
finally {
|
|
6080
6234
|
try {
|
|
6081
6235
|
if (anchors_1_1 && !anchors_1_1.done && (_a = anchors_1.return)) _a.call(anchors_1);
|
|
6082
6236
|
}
|
|
6083
|
-
finally { if (
|
|
6237
|
+
finally { if (e_22) throw e_22.error; }
|
|
6084
6238
|
}
|
|
6085
6239
|
};
|
|
6086
6240
|
Canvas.prototype.delete = function (pens, canDelLocked, history) {
|
|
@@ -6134,6 +6288,9 @@ var Canvas = /** @class */ (function () {
|
|
|
6134
6288
|
return;
|
|
6135
6289
|
}
|
|
6136
6290
|
pens.forEach(function (pen) {
|
|
6291
|
+
if (pen.type) {
|
|
6292
|
+
pen.lastConnected = {};
|
|
6293
|
+
}
|
|
6137
6294
|
if (!pen.parentId) {
|
|
6138
6295
|
if (!canDelLocked && pen.locked) {
|
|
6139
6296
|
return;
|
|
@@ -6628,9 +6785,9 @@ var Canvas = /** @class */ (function () {
|
|
|
6628
6785
|
Object.assign(pen, rect);
|
|
6629
6786
|
}
|
|
6630
6787
|
else {
|
|
6631
|
-
var _a = this.store.data,
|
|
6632
|
-
pen.x =
|
|
6633
|
-
pen.y =
|
|
6788
|
+
var _a = this.store.data, origin_3 = _a.origin, scale = _a.scale;
|
|
6789
|
+
pen.x = origin_3.x + rect.x * scale;
|
|
6790
|
+
pen.y = origin_3.y + rect.y * scale;
|
|
6634
6791
|
pen.width = rect.width * scale;
|
|
6635
6792
|
pen.height = rect.height * scale;
|
|
6636
6793
|
}
|
|
@@ -6661,7 +6818,7 @@ var Canvas = /** @class */ (function () {
|
|
|
6661
6818
|
};
|
|
6662
6819
|
};
|
|
6663
6820
|
Canvas.prototype.toPng = function (padding, callback, containBkImg, maxWidth) {
|
|
6664
|
-
var
|
|
6821
|
+
var e_23, _a;
|
|
6665
6822
|
if (padding === void 0) { padding = 2; }
|
|
6666
6823
|
if (containBkImg === void 0) { containBkImg = false; }
|
|
6667
6824
|
var rect = getRect(this.store.data.pens);
|
|
@@ -6694,7 +6851,11 @@ var Canvas = /** @class */ (function () {
|
|
|
6694
6851
|
var width = this.store.data.width || this.store.options.width;
|
|
6695
6852
|
var height = this.store.data.height || this.store.options.height;
|
|
6696
6853
|
//大屏
|
|
6697
|
-
|
|
6854
|
+
var isV = false;
|
|
6855
|
+
if (width && height && !this.store.data.component) {
|
|
6856
|
+
isV = true;
|
|
6857
|
+
}
|
|
6858
|
+
if (isV) {
|
|
6698
6859
|
rect.x = this.store.data.origin.x;
|
|
6699
6860
|
rect.y = this.store.data.origin.y;
|
|
6700
6861
|
rect.width = width * this.store.data.scale;
|
|
@@ -6740,7 +6901,7 @@ var Canvas = /** @class */ (function () {
|
|
|
6740
6901
|
// 绘制背景颜色
|
|
6741
6902
|
ctx.save();
|
|
6742
6903
|
ctx.fillStyle = background;
|
|
6743
|
-
if (
|
|
6904
|
+
if (isV) {
|
|
6744
6905
|
ctx.fillRect(0, 0, vRect.width + (p[1] + p[3]) * _scale, vRect.height + (p[0] + p[2]) * _scale);
|
|
6745
6906
|
}
|
|
6746
6907
|
else {
|
|
@@ -6749,7 +6910,7 @@ var Canvas = /** @class */ (function () {
|
|
|
6749
6910
|
ctx.restore();
|
|
6750
6911
|
}
|
|
6751
6912
|
if (isDrawBkImg) {
|
|
6752
|
-
if (
|
|
6913
|
+
if (isV) {
|
|
6753
6914
|
ctx.drawImage(this.store.bkImg, p[3] * _scale || 0, p[0] * _scale || 0, vRect.width, vRect.height);
|
|
6754
6915
|
}
|
|
6755
6916
|
else {
|
|
@@ -6763,7 +6924,7 @@ var Canvas = /** @class */ (function () {
|
|
|
6763
6924
|
}
|
|
6764
6925
|
else {
|
|
6765
6926
|
// 平移画布,画笔的 worldRect 不变化
|
|
6766
|
-
if (
|
|
6927
|
+
if (isV) {
|
|
6767
6928
|
ctx.translate(-oldRect.x + p[3] * _scale || 0, -oldRect.y + p[0] * _scale || 0);
|
|
6768
6929
|
}
|
|
6769
6930
|
else {
|
|
@@ -6784,17 +6945,17 @@ var Canvas = /** @class */ (function () {
|
|
|
6784
6945
|
renderPenRaw(ctx, pen);
|
|
6785
6946
|
}
|
|
6786
6947
|
else {
|
|
6787
|
-
renderPen(ctx, pen);
|
|
6948
|
+
renderPen(ctx, pen, true);
|
|
6788
6949
|
}
|
|
6789
6950
|
pen.calculative.active = active;
|
|
6790
6951
|
}
|
|
6791
6952
|
}
|
|
6792
|
-
catch (
|
|
6953
|
+
catch (e_23_1) { e_23 = { error: e_23_1 }; }
|
|
6793
6954
|
finally {
|
|
6794
6955
|
try {
|
|
6795
6956
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
6796
6957
|
}
|
|
6797
|
-
finally { if (
|
|
6958
|
+
finally { if (e_23) throw e_23.error; }
|
|
6798
6959
|
}
|
|
6799
6960
|
if (callback) {
|
|
6800
6961
|
canvas.toBlob(callback);
|
|
@@ -6803,7 +6964,7 @@ var Canvas = /** @class */ (function () {
|
|
|
6803
6964
|
return canvas.toDataURL();
|
|
6804
6965
|
};
|
|
6805
6966
|
Canvas.prototype.activeToPng = function (padding) {
|
|
6806
|
-
var
|
|
6967
|
+
var e_24, _a;
|
|
6807
6968
|
if (padding === void 0) { padding = 2; }
|
|
6808
6969
|
var allPens = this.getAllByPens(this.store.active);
|
|
6809
6970
|
var ids = allPens.map(function (pen) { return pen.id; });
|
|
@@ -6853,12 +7014,12 @@ var Canvas = /** @class */ (function () {
|
|
|
6853
7014
|
}
|
|
6854
7015
|
}
|
|
6855
7016
|
}
|
|
6856
|
-
catch (
|
|
7017
|
+
catch (e_24_1) { e_24 = { error: e_24_1 }; }
|
|
6857
7018
|
finally {
|
|
6858
7019
|
try {
|
|
6859
7020
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
6860
7021
|
}
|
|
6861
|
-
finally { if (
|
|
7022
|
+
finally { if (e_24) throw e_24.error; }
|
|
6862
7023
|
}
|
|
6863
7024
|
return canvas.toDataURL();
|
|
6864
7025
|
};
|