leafer-ui 1.2.1 → 1.3.0
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/README.md +3 -7
- package/dist/web.cjs +27 -327
- package/dist/web.esm.js +28 -329
- package/dist/web.esm.min.js +1 -1
- package/dist/web.js +166 -459
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.module.js +166 -460
- package/dist/web.module.min.js +1 -1
- package/package.json +12 -12
package/dist/web.js
CHANGED
|
@@ -768,8 +768,8 @@ var LeaferUI = (function (exports) {
|
|
|
768
768
|
t.maxY = y > t.maxY ? y : t.maxY;
|
|
769
769
|
},
|
|
770
770
|
addBounds(t, x, y, width, height) {
|
|
771
|
-
addPoint$
|
|
772
|
-
addPoint$
|
|
771
|
+
addPoint$3(t, x, y);
|
|
772
|
+
addPoint$3(t, x + width, y + height);
|
|
773
773
|
},
|
|
774
774
|
copy(t, pb) {
|
|
775
775
|
t.minX = pb.minX;
|
|
@@ -790,9 +790,9 @@ var LeaferUI = (function (exports) {
|
|
|
790
790
|
setBounds.height = t.maxY - t.minY;
|
|
791
791
|
}
|
|
792
792
|
};
|
|
793
|
-
const { addPoint: addPoint$
|
|
793
|
+
const { addPoint: addPoint$3 } = TwoPointBoundsHelper;
|
|
794
794
|
|
|
795
|
-
const { tempPointBounds: tempPointBounds$1, setPoint: setPoint$
|
|
795
|
+
const { tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$3 } = TwoPointBoundsHelper;
|
|
796
796
|
const { toOuterPoint: toOuterPoint$2 } = MatrixHelper;
|
|
797
797
|
const { float, fourNumber } = MathHelper;
|
|
798
798
|
const { floor, ceil: ceil$2 } = Math;
|
|
@@ -908,17 +908,17 @@ var LeaferUI = (function (exports) {
|
|
|
908
908
|
point.x = t.x;
|
|
909
909
|
point.y = t.y;
|
|
910
910
|
toOuterPoint$2(matrix, point, toPoint$5);
|
|
911
|
-
setPoint$
|
|
911
|
+
setPoint$2(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
912
912
|
point.x = t.x + t.width;
|
|
913
913
|
toOuterPoint$2(matrix, point, toPoint$5);
|
|
914
|
-
addPoint$
|
|
914
|
+
addPoint$2(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
915
915
|
point.y = t.y + t.height;
|
|
916
916
|
toOuterPoint$2(matrix, point, toPoint$5);
|
|
917
|
-
addPoint$
|
|
917
|
+
addPoint$2(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
918
918
|
point.x = t.x;
|
|
919
919
|
toOuterPoint$2(matrix, point, toPoint$5);
|
|
920
|
-
addPoint$
|
|
921
|
-
toBounds$
|
|
920
|
+
addPoint$2(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
921
|
+
toBounds$3(tempPointBounds$1, to);
|
|
922
922
|
}
|
|
923
923
|
},
|
|
924
924
|
toInnerOf(t, matrix, to) {
|
|
@@ -1008,8 +1008,8 @@ var LeaferUI = (function (exports) {
|
|
|
1008
1008
|
B.reset(t);
|
|
1009
1009
|
},
|
|
1010
1010
|
setPoints(t, points) {
|
|
1011
|
-
points.forEach((point, index) => index === 0 ? setPoint$
|
|
1012
|
-
toBounds$
|
|
1011
|
+
points.forEach((point, index) => index === 0 ? setPoint$2(tempPointBounds$1, point.x, point.y) : addPoint$2(tempPointBounds$1, point.x, point.y));
|
|
1012
|
+
toBounds$3(tempPointBounds$1, t);
|
|
1013
1013
|
},
|
|
1014
1014
|
setPoint(t, point) {
|
|
1015
1015
|
B.set(t, point.x, point.y);
|
|
@@ -1377,7 +1377,7 @@ var LeaferUI = (function (exports) {
|
|
|
1377
1377
|
}
|
|
1378
1378
|
const D$4 = Debug;
|
|
1379
1379
|
|
|
1380
|
-
const debug$
|
|
1380
|
+
const debug$f = Debug.get('RunTime');
|
|
1381
1381
|
const Run = {
|
|
1382
1382
|
currentId: 0,
|
|
1383
1383
|
currentName: '',
|
|
@@ -1395,7 +1395,7 @@ var LeaferUI = (function (exports) {
|
|
|
1395
1395
|
const time = R.idMap[id], name = R.nameMap[id];
|
|
1396
1396
|
const duration = microsecond ? (performance.now() - time) / 1000 : Date.now() - time;
|
|
1397
1397
|
R.idMap[id] = R.nameMap[id] = R.nameToIdMap[name] = undefined;
|
|
1398
|
-
debug$
|
|
1398
|
+
debug$f.log(name, duration, 'ms');
|
|
1399
1399
|
},
|
|
1400
1400
|
endOfName(name, microsecond) {
|
|
1401
1401
|
const id = R.nameToIdMap[name];
|
|
@@ -1405,34 +1405,37 @@ var LeaferUI = (function (exports) {
|
|
|
1405
1405
|
};
|
|
1406
1406
|
const R = Run;
|
|
1407
1407
|
|
|
1408
|
+
const check = [];
|
|
1408
1409
|
const Plugin = {
|
|
1409
1410
|
list: {},
|
|
1410
|
-
add(name) {
|
|
1411
|
+
add(name, ...needPlugins) {
|
|
1411
1412
|
this.list[name] = true;
|
|
1413
|
+
check.push(...needPlugins);
|
|
1412
1414
|
},
|
|
1413
|
-
|
|
1415
|
+
has(name, tip) {
|
|
1414
1416
|
const rs = this.list[name];
|
|
1415
1417
|
if (!rs && tip)
|
|
1416
1418
|
this.need(name);
|
|
1417
1419
|
return rs;
|
|
1418
1420
|
},
|
|
1419
1421
|
need(name) {
|
|
1420
|
-
console.error('need plugin: @leafer-in/' + name);
|
|
1422
|
+
console.error('need plugin: ' + (name.includes('-x') ? '' : '@leafer-in/') + name);
|
|
1421
1423
|
}
|
|
1422
1424
|
};
|
|
1425
|
+
setTimeout(() => check.forEach(name => Plugin.has(name, true)));
|
|
1423
1426
|
|
|
1424
|
-
const debug$
|
|
1427
|
+
const debug$e = Debug.get('UICreator');
|
|
1425
1428
|
const UICreator = {
|
|
1426
1429
|
list: {},
|
|
1427
1430
|
register(UI) {
|
|
1428
1431
|
const { __tag: tag } = UI.prototype;
|
|
1429
1432
|
if (list$1[tag])
|
|
1430
|
-
debug$
|
|
1433
|
+
debug$e.repeat(tag);
|
|
1431
1434
|
list$1[tag] = UI;
|
|
1432
1435
|
},
|
|
1433
1436
|
get(tag, data, x, y, width, height) {
|
|
1434
1437
|
if (!list$1[tag])
|
|
1435
|
-
debug$
|
|
1438
|
+
debug$e.error('not register ' + tag);
|
|
1436
1439
|
const ui = new list$1[tag](data);
|
|
1437
1440
|
if (x !== undefined) {
|
|
1438
1441
|
ui.x = x;
|
|
@@ -1448,7 +1451,7 @@ var LeaferUI = (function (exports) {
|
|
|
1448
1451
|
};
|
|
1449
1452
|
const { list: list$1 } = UICreator;
|
|
1450
1453
|
|
|
1451
|
-
const debug$
|
|
1454
|
+
const debug$d = Debug.get('EventCreator');
|
|
1452
1455
|
const EventCreator = {
|
|
1453
1456
|
nameList: {},
|
|
1454
1457
|
register(Event) {
|
|
@@ -1456,7 +1459,7 @@ var LeaferUI = (function (exports) {
|
|
|
1456
1459
|
Object.keys(Event).forEach(key => {
|
|
1457
1460
|
name = Event[key];
|
|
1458
1461
|
if (typeof name === 'string')
|
|
1459
|
-
nameList[name] && debug$
|
|
1462
|
+
nameList[name] && debug$d.repeat(name), nameList[name] = Event;
|
|
1460
1463
|
});
|
|
1461
1464
|
},
|
|
1462
1465
|
changeName(oldName, newName) {
|
|
@@ -2050,11 +2053,11 @@ var LeaferUI = (function (exports) {
|
|
|
2050
2053
|
toBlob(_type, _quality) { return undefined; }
|
|
2051
2054
|
toDataURL(_type, _quality) { return undefined; }
|
|
2052
2055
|
saveAs(_filename, _quality) { return undefined; }
|
|
2053
|
-
resize(size) {
|
|
2056
|
+
resize(size, safeResize = true) {
|
|
2054
2057
|
if (this.isSameSize(size))
|
|
2055
2058
|
return;
|
|
2056
2059
|
let takeCanvas;
|
|
2057
|
-
if (this.context && !this.unreal && this.width) {
|
|
2060
|
+
if (this.context && !this.unreal && safeResize && this.width) {
|
|
2058
2061
|
takeCanvas = this.getSameCanvas();
|
|
2059
2062
|
takeCanvas.copyWorld(this);
|
|
2060
2063
|
}
|
|
@@ -2345,7 +2348,7 @@ var LeaferUI = (function (exports) {
|
|
|
2345
2348
|
};
|
|
2346
2349
|
|
|
2347
2350
|
const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$3, PI: PI$2, sqrt: sqrt$1, pow } = Math;
|
|
2348
|
-
const { setPoint: setPoint$
|
|
2351
|
+
const { setPoint: setPoint$1, addPoint: addPoint$1 } = TwoPointBoundsHelper;
|
|
2349
2352
|
const { set, toNumberPoints } = PointHelper;
|
|
2350
2353
|
const { M: M$5, L: L$6, C: C$5, Q: Q$4, Z: Z$5 } = PathCommandMap;
|
|
2351
2354
|
const tempPoint$2 = {};
|
|
@@ -2421,8 +2424,8 @@ var LeaferUI = (function (exports) {
|
|
|
2421
2424
|
if (data)
|
|
2422
2425
|
data.push(L$6, x1, y1);
|
|
2423
2426
|
if (setPointBounds) {
|
|
2424
|
-
setPoint$
|
|
2425
|
-
addPoint$
|
|
2427
|
+
setPoint$1(setPointBounds, fromX, fromY);
|
|
2428
|
+
addPoint$1(setPointBounds, x1, y1);
|
|
2426
2429
|
}
|
|
2427
2430
|
if (setStartPoint)
|
|
2428
2431
|
set(setStartPoint, fromX, fromY);
|
|
@@ -2474,7 +2477,7 @@ var LeaferUI = (function (exports) {
|
|
|
2474
2477
|
if (data)
|
|
2475
2478
|
data.push(data.length ? L$6 : M$5, fromX, fromY);
|
|
2476
2479
|
if (setPointBounds)
|
|
2477
|
-
setPoint$
|
|
2480
|
+
setPoint$1(setPointBounds, fromX, fromY);
|
|
2478
2481
|
if (setStartPoint)
|
|
2479
2482
|
set(setStartPoint, fromX, fromY);
|
|
2480
2483
|
for (let i = 0; i < parts; i++) {
|
|
@@ -2536,11 +2539,11 @@ var LeaferUI = (function (exports) {
|
|
|
2536
2539
|
if (0 < t2 && t2 < 1)
|
|
2537
2540
|
tList.push(t2);
|
|
2538
2541
|
}
|
|
2539
|
-
addMode ? addPoint$
|
|
2540
|
-
addPoint$
|
|
2542
|
+
addMode ? addPoint$1(pointBounds, fromX, fromY) : setPoint$1(pointBounds, fromX, fromY);
|
|
2543
|
+
addPoint$1(pointBounds, toX, toY);
|
|
2541
2544
|
for (let i = 0, len = tList.length; i < len; i++) {
|
|
2542
2545
|
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$2);
|
|
2543
|
-
addPoint$
|
|
2546
|
+
addPoint$1(pointBounds, tempPoint$2.x, tempPoint$2.y);
|
|
2544
2547
|
}
|
|
2545
2548
|
},
|
|
2546
2549
|
getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, setPoint) {
|
|
@@ -2612,7 +2615,7 @@ var LeaferUI = (function (exports) {
|
|
|
2612
2615
|
const { M: M$4, m, L: L$5, l, H, h, V, v, C: C$4, c, S, s, Q: Q$3, q, T, t, A, a, Z: Z$4, z, N: N$3, D: D$3, X: X$3, G: G$3, F: F$4, O: O$3, P: P$3, U: U$3 } = PathCommandMap;
|
|
2613
2616
|
const { rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1 } = BezierHelper;
|
|
2614
2617
|
const { ellipticalArc } = EllipseHelper;
|
|
2615
|
-
const debug$
|
|
2618
|
+
const debug$c = Debug.get('PathConvert');
|
|
2616
2619
|
const setEndPoint$1 = {};
|
|
2617
2620
|
const PathConvert = {
|
|
2618
2621
|
current: { dot: 0 },
|
|
@@ -2853,7 +2856,7 @@ var LeaferUI = (function (exports) {
|
|
|
2853
2856
|
i += 6;
|
|
2854
2857
|
break;
|
|
2855
2858
|
default:
|
|
2856
|
-
debug$
|
|
2859
|
+
debug$c.error(`command: ${command} [index:${i}]`, old);
|
|
2857
2860
|
return data;
|
|
2858
2861
|
}
|
|
2859
2862
|
lastCommand = command;
|
|
@@ -3078,7 +3081,7 @@ var LeaferUI = (function (exports) {
|
|
|
3078
3081
|
}
|
|
3079
3082
|
|
|
3080
3083
|
const { M: M$2, L: L$3, C: C$2, Q: Q$1, Z: Z$2, N: N$1, D: D$1, X: X$1, G: G$1, F: F$2, O: O$1, P: P$1, U: U$1 } = PathCommandMap;
|
|
3081
|
-
const debug$
|
|
3084
|
+
const debug$b = Debug.get('PathDrawer');
|
|
3082
3085
|
const PathDrawer = {
|
|
3083
3086
|
drawPathByData(drawer, data) {
|
|
3084
3087
|
if (!data)
|
|
@@ -3141,7 +3144,7 @@ var LeaferUI = (function (exports) {
|
|
|
3141
3144
|
i += 6;
|
|
3142
3145
|
break;
|
|
3143
3146
|
default:
|
|
3144
|
-
debug$
|
|
3147
|
+
debug$b.error(`command: ${command} [index:${i}]`, data);
|
|
3145
3148
|
return;
|
|
3146
3149
|
}
|
|
3147
3150
|
}
|
|
@@ -3150,8 +3153,8 @@ var LeaferUI = (function (exports) {
|
|
|
3150
3153
|
|
|
3151
3154
|
const { M: M$1, L: L$2, C: C$1, Q, Z: Z$1, N, D, X, G, F: F$1, O, P, U } = PathCommandMap;
|
|
3152
3155
|
const { toTwoPointBounds, toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc, ellipse: ellipse$1 } = BezierHelper;
|
|
3153
|
-
const { addPointBounds, copy: copy$8, addPoint
|
|
3154
|
-
const debug$
|
|
3156
|
+
const { addPointBounds, copy: copy$8, addPoint, setPoint, addBounds, toBounds: toBounds$2 } = TwoPointBoundsHelper;
|
|
3157
|
+
const debug$a = Debug.get('PathBounds');
|
|
3155
3158
|
let radius, radiusX, radiusY;
|
|
3156
3159
|
const tempPointBounds = {};
|
|
3157
3160
|
const setPointBounds = {};
|
|
@@ -3159,21 +3162,21 @@ var LeaferUI = (function (exports) {
|
|
|
3159
3162
|
const PathBounds = {
|
|
3160
3163
|
toBounds(data, setBounds) {
|
|
3161
3164
|
PathBounds.toTwoPointBounds(data, setPointBounds);
|
|
3162
|
-
toBounds$
|
|
3165
|
+
toBounds$2(setPointBounds, setBounds);
|
|
3163
3166
|
},
|
|
3164
3167
|
toTwoPointBounds(data, setPointBounds) {
|
|
3165
3168
|
if (!data || !data.length)
|
|
3166
|
-
return setPoint
|
|
3169
|
+
return setPoint(setPointBounds, 0, 0);
|
|
3167
3170
|
let i = 0, x = 0, y = 0, x1, y1, toX, toY, command;
|
|
3168
3171
|
const len = data.length;
|
|
3169
3172
|
while (i < len) {
|
|
3170
3173
|
command = data[i];
|
|
3171
3174
|
if (i === 0) {
|
|
3172
3175
|
if (command === Z$1 || command === C$1 || command === Q) {
|
|
3173
|
-
setPoint
|
|
3176
|
+
setPoint(setPointBounds, x, y);
|
|
3174
3177
|
}
|
|
3175
3178
|
else {
|
|
3176
|
-
setPoint
|
|
3179
|
+
setPoint(setPointBounds, data[i + 1], data[i + 2]);
|
|
3177
3180
|
}
|
|
3178
3181
|
}
|
|
3179
3182
|
switch (command) {
|
|
@@ -3181,7 +3184,7 @@ var LeaferUI = (function (exports) {
|
|
|
3181
3184
|
case L$2:
|
|
3182
3185
|
x = data[i + 1];
|
|
3183
3186
|
y = data[i + 2];
|
|
3184
|
-
addPoint
|
|
3187
|
+
addPoint(setPointBounds, x, y);
|
|
3185
3188
|
i += 3;
|
|
3186
3189
|
break;
|
|
3187
3190
|
case C$1:
|
|
@@ -3259,7 +3262,7 @@ var LeaferUI = (function (exports) {
|
|
|
3259
3262
|
i += 6;
|
|
3260
3263
|
break;
|
|
3261
3264
|
default:
|
|
3262
|
-
debug$
|
|
3265
|
+
debug$a.error(`command: ${command} [index:${i}]`, data);
|
|
3263
3266
|
return;
|
|
3264
3267
|
}
|
|
3265
3268
|
}
|
|
@@ -3375,7 +3378,7 @@ var LeaferUI = (function (exports) {
|
|
|
3375
3378
|
const F = FileHelper;
|
|
3376
3379
|
F.opacityTypes.forEach(type => F.upperCaseTypeMap[type] = type.toUpperCase());
|
|
3377
3380
|
|
|
3378
|
-
const debug$
|
|
3381
|
+
const debug$9 = Debug.get('TaskProcessor');
|
|
3379
3382
|
class TaskItem {
|
|
3380
3383
|
constructor(task) {
|
|
3381
3384
|
this.parallel = true;
|
|
@@ -3390,7 +3393,7 @@ var LeaferUI = (function (exports) {
|
|
|
3390
3393
|
yield this.task();
|
|
3391
3394
|
}
|
|
3392
3395
|
catch (error) {
|
|
3393
|
-
debug$
|
|
3396
|
+
debug$9.error(error);
|
|
3394
3397
|
}
|
|
3395
3398
|
});
|
|
3396
3399
|
}
|
|
@@ -4077,7 +4080,7 @@ var LeaferUI = (function (exports) {
|
|
|
4077
4080
|
defineKey(data, key, property);
|
|
4078
4081
|
}
|
|
4079
4082
|
|
|
4080
|
-
const debug$
|
|
4083
|
+
const debug$8 = new Debug('rewrite');
|
|
4081
4084
|
const list = [];
|
|
4082
4085
|
const excludeNames = ['destroy', 'constructor'];
|
|
4083
4086
|
function rewrite(method) {
|
|
@@ -4094,7 +4097,7 @@ var LeaferUI = (function (exports) {
|
|
|
4094
4097
|
if (list.length) {
|
|
4095
4098
|
list.forEach(item => {
|
|
4096
4099
|
if (error)
|
|
4097
|
-
debug$
|
|
4100
|
+
debug$8.error(item.name, '需在Class上装饰@rewriteAble()');
|
|
4098
4101
|
item.run();
|
|
4099
4102
|
});
|
|
4100
4103
|
list.length = 0;
|
|
@@ -4256,18 +4259,21 @@ var LeaferUI = (function (exports) {
|
|
|
4256
4259
|
L.setTransform(t, matrix$1, resize);
|
|
4257
4260
|
},
|
|
4258
4261
|
setTransform(t, transform, resize) {
|
|
4259
|
-
const
|
|
4262
|
+
const data = t.__, originPoint = data.origin && L.getInnerOrigin(t, data.origin);
|
|
4263
|
+
const layout = getLayout(transform, originPoint, data.around && L.getInnerOrigin(t, data.around));
|
|
4260
4264
|
if (resize) {
|
|
4261
|
-
const scaleX = layout.scaleX / t.scaleX;
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
+
const scaleX = layout.scaleX / t.scaleX, scaleY = layout.scaleY / t.scaleY;
|
|
4266
|
+
delete layout.scaleX, delete layout.scaleY;
|
|
4267
|
+
if (originPoint) {
|
|
4268
|
+
BoundsHelper.scale(t.boxBounds, Math.abs(scaleX), Math.abs(scaleY));
|
|
4269
|
+
const changedPoint = L.getInnerOrigin(t, data.origin);
|
|
4270
|
+
PointHelper.move(layout, originPoint.x - changedPoint.x, originPoint.y - changedPoint.y);
|
|
4271
|
+
}
|
|
4265
4272
|
t.set(layout);
|
|
4266
|
-
t.scaleResize(scaleX, scaleY,
|
|
4273
|
+
t.scaleResize(scaleX, scaleY, false);
|
|
4267
4274
|
}
|
|
4268
|
-
else
|
|
4275
|
+
else
|
|
4269
4276
|
t.set(layout);
|
|
4270
|
-
}
|
|
4271
4277
|
},
|
|
4272
4278
|
getFlipTransform(t, axis) {
|
|
4273
4279
|
const m = getMatrixData();
|
|
@@ -4808,7 +4814,6 @@ var LeaferUI = (function (exports) {
|
|
|
4808
4814
|
}
|
|
4809
4815
|
}
|
|
4810
4816
|
}
|
|
4811
|
-
LayoutEvent.CHECK_UPDATE = 'layout.check_update';
|
|
4812
4817
|
LayoutEvent.REQUEST = 'layout.request';
|
|
4813
4818
|
LayoutEvent.START = 'layout.start';
|
|
4814
4819
|
LayoutEvent.BEFORE = 'layout.before';
|
|
@@ -4950,14 +4955,15 @@ var LeaferUI = (function (exports) {
|
|
|
4950
4955
|
if (list) {
|
|
4951
4956
|
let item;
|
|
4952
4957
|
for (let i = 0, len = list.length; i < len; i++) {
|
|
4953
|
-
item = list[i]
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
+
if (item = list[i]) {
|
|
4959
|
+
item.listener(event);
|
|
4960
|
+
if (item.once) {
|
|
4961
|
+
this.off(type, item.listener, capture);
|
|
4962
|
+
i--, len--;
|
|
4963
|
+
}
|
|
4964
|
+
if (event && event.isStopNow)
|
|
4965
|
+
break;
|
|
4958
4966
|
}
|
|
4959
|
-
if (event && event.isStopNow)
|
|
4960
|
-
break;
|
|
4961
4967
|
}
|
|
4962
4968
|
}
|
|
4963
4969
|
this.syncEventer && this.syncEventer.emitEvent(event, capture);
|
|
@@ -5002,13 +5008,13 @@ var LeaferUI = (function (exports) {
|
|
|
5002
5008
|
const LeafEventer = { on, on_, off, off_, once, emit: emit$2, emitEvent: emitEvent$1, hasEvent, destroyEventer: destroy };
|
|
5003
5009
|
|
|
5004
5010
|
const { isFinite } = Number;
|
|
5005
|
-
const debug$
|
|
5011
|
+
const debug$7 = Debug.get('setAttr');
|
|
5006
5012
|
const LeafDataProxy = {
|
|
5007
5013
|
__setAttr(name, newValue, checkFiniteNumber) {
|
|
5008
5014
|
if (this.leaferIsCreated) {
|
|
5009
5015
|
const oldValue = this.__.__getInput(name);
|
|
5010
5016
|
if (checkFiniteNumber && !isFinite(newValue) && newValue !== undefined) {
|
|
5011
|
-
debug$
|
|
5017
|
+
debug$7.warn(this.innerName, name, newValue);
|
|
5012
5018
|
newValue = undefined;
|
|
5013
5019
|
}
|
|
5014
5020
|
if (typeof newValue === 'object' || oldValue !== newValue) {
|
|
@@ -5078,7 +5084,7 @@ var LeaferUI = (function (exports) {
|
|
|
5078
5084
|
const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2 } = LeafHelper;
|
|
5079
5085
|
const { updateBounds: updateBounds$1 } = BranchHelper;
|
|
5080
5086
|
const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$5 } = BoundsHelper;
|
|
5081
|
-
const { toBounds: toBounds$
|
|
5087
|
+
const { toBounds: toBounds$1 } = PathBounds;
|
|
5082
5088
|
const LeafBounds = {
|
|
5083
5089
|
__updateWorldBounds() {
|
|
5084
5090
|
toOuterOf$1(this.__layout.renderBounds, this.__world, this.__world);
|
|
@@ -5160,7 +5166,7 @@ var LeaferUI = (function (exports) {
|
|
|
5160
5166
|
const b = this.__layout.boxBounds;
|
|
5161
5167
|
const data = this.__;
|
|
5162
5168
|
if (data.__pathInputed) {
|
|
5163
|
-
toBounds$
|
|
5169
|
+
toBounds$1(data.path, b);
|
|
5164
5170
|
}
|
|
5165
5171
|
else {
|
|
5166
5172
|
b.x = 0;
|
|
@@ -5708,7 +5714,7 @@ var LeaferUI = (function (exports) {
|
|
|
5708
5714
|
const { setListWithFn } = BoundsHelper;
|
|
5709
5715
|
const { sort } = BranchHelper;
|
|
5710
5716
|
const { localBoxBounds, localStrokeBounds, localRenderBounds, maskLocalBoxBounds, maskLocalStrokeBounds, maskLocalRenderBounds } = LeafBoundsHelper;
|
|
5711
|
-
const debug$
|
|
5717
|
+
const debug$6 = new Debug('Branch');
|
|
5712
5718
|
exports.Branch = class Branch extends exports.Leaf {
|
|
5713
5719
|
__updateStrokeSpread() {
|
|
5714
5720
|
const { children } = this;
|
|
@@ -5750,7 +5756,7 @@ var LeaferUI = (function (exports) {
|
|
|
5750
5756
|
}
|
|
5751
5757
|
add(child, index) {
|
|
5752
5758
|
if (child === this || child.destroyed)
|
|
5753
|
-
return debug$
|
|
5759
|
+
return debug$6.warn('add self or destroyed');
|
|
5754
5760
|
const noIndex = index === undefined;
|
|
5755
5761
|
if (!child.__) {
|
|
5756
5762
|
if (child instanceof Array)
|
|
@@ -6004,9 +6010,9 @@ var LeaferUI = (function (exports) {
|
|
|
6004
6010
|
}
|
|
6005
6011
|
}
|
|
6006
6012
|
|
|
6007
|
-
const version = "1.
|
|
6013
|
+
const version = "1.3.0";
|
|
6008
6014
|
|
|
6009
|
-
const debug$
|
|
6015
|
+
const debug$5 = Debug.get('LeaferCanvas');
|
|
6010
6016
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6011
6017
|
set zIndex(zIndex) {
|
|
6012
6018
|
const { style } = this.view;
|
|
@@ -6078,7 +6084,7 @@ var LeaferUI = (function (exports) {
|
|
|
6078
6084
|
}
|
|
6079
6085
|
}
|
|
6080
6086
|
else {
|
|
6081
|
-
debug$
|
|
6087
|
+
debug$5.error(`no id: ${inputView}`);
|
|
6082
6088
|
this.__createView();
|
|
6083
6089
|
}
|
|
6084
6090
|
}
|
|
@@ -6096,7 +6102,8 @@ var LeaferUI = (function (exports) {
|
|
|
6096
6102
|
this.view.height = Math.ceil(height * pixelRatio);
|
|
6097
6103
|
}
|
|
6098
6104
|
updateClientBounds() {
|
|
6099
|
-
|
|
6105
|
+
if (this.view.parentElement)
|
|
6106
|
+
this.clientBounds = this.view.getBoundingClientRect();
|
|
6100
6107
|
}
|
|
6101
6108
|
startAutoLayout(autoBounds, listener) {
|
|
6102
6109
|
this.resizeListener = listener;
|
|
@@ -6115,7 +6122,7 @@ var LeaferUI = (function (exports) {
|
|
|
6115
6122
|
}
|
|
6116
6123
|
else {
|
|
6117
6124
|
this.checkAutoBounds(this.view);
|
|
6118
|
-
debug$
|
|
6125
|
+
debug$5.warn('no parent');
|
|
6119
6126
|
}
|
|
6120
6127
|
}
|
|
6121
6128
|
catch (_a) {
|
|
@@ -6451,7 +6458,7 @@ var LeaferUI = (function (exports) {
|
|
|
6451
6458
|
}
|
|
6452
6459
|
|
|
6453
6460
|
const { updateAllMatrix, updateAllChange } = LeafHelper;
|
|
6454
|
-
const debug$
|
|
6461
|
+
const debug$4 = Debug.get('Layouter');
|
|
6455
6462
|
class Layouter {
|
|
6456
6463
|
constructor(target, userConfig) {
|
|
6457
6464
|
this.totalTimes = 0;
|
|
@@ -6486,7 +6493,7 @@ var LeaferUI = (function (exports) {
|
|
|
6486
6493
|
target.emitEvent(new LayoutEvent(LayoutEvent.END, this.layoutedBlocks, this.times));
|
|
6487
6494
|
}
|
|
6488
6495
|
catch (e) {
|
|
6489
|
-
debug$
|
|
6496
|
+
debug$4.error(e);
|
|
6490
6497
|
}
|
|
6491
6498
|
this.layoutedBlocks = null;
|
|
6492
6499
|
}
|
|
@@ -6500,9 +6507,9 @@ var LeaferUI = (function (exports) {
|
|
|
6500
6507
|
}
|
|
6501
6508
|
layoutOnce() {
|
|
6502
6509
|
if (this.layouting)
|
|
6503
|
-
return debug$
|
|
6510
|
+
return debug$4.warn('layouting');
|
|
6504
6511
|
if (this.times > 3)
|
|
6505
|
-
return debug$
|
|
6512
|
+
return debug$4.warn('layout max times');
|
|
6506
6513
|
this.times++;
|
|
6507
6514
|
this.totalTimes++;
|
|
6508
6515
|
this.layouting = true;
|
|
@@ -6606,7 +6613,7 @@ var LeaferUI = (function (exports) {
|
|
|
6606
6613
|
}
|
|
6607
6614
|
}
|
|
6608
6615
|
|
|
6609
|
-
const debug$
|
|
6616
|
+
const debug$3 = Debug.get('Renderer');
|
|
6610
6617
|
class Renderer {
|
|
6611
6618
|
get needFill() { return !!(!this.canvas.allowBackgroundColor && this.config.fill); }
|
|
6612
6619
|
constructor(target, canvas, userConfig) {
|
|
@@ -6644,7 +6651,7 @@ var LeaferUI = (function (exports) {
|
|
|
6644
6651
|
const { target } = this;
|
|
6645
6652
|
this.times = 0;
|
|
6646
6653
|
this.totalBounds = new Bounds();
|
|
6647
|
-
debug$
|
|
6654
|
+
debug$3.log(target.innerName, '--->');
|
|
6648
6655
|
try {
|
|
6649
6656
|
if (!target.isApp)
|
|
6650
6657
|
target.app.emit(RenderEvent.CHILD_START, target);
|
|
@@ -6655,9 +6662,9 @@ var LeaferUI = (function (exports) {
|
|
|
6655
6662
|
}
|
|
6656
6663
|
catch (e) {
|
|
6657
6664
|
this.rendering = false;
|
|
6658
|
-
debug$
|
|
6665
|
+
debug$3.error(e);
|
|
6659
6666
|
}
|
|
6660
|
-
debug$
|
|
6667
|
+
debug$3.log('-------------|');
|
|
6661
6668
|
}
|
|
6662
6669
|
renderAgain() {
|
|
6663
6670
|
if (this.rendering) {
|
|
@@ -6669,9 +6676,9 @@ var LeaferUI = (function (exports) {
|
|
|
6669
6676
|
}
|
|
6670
6677
|
renderOnce(callback) {
|
|
6671
6678
|
if (this.rendering)
|
|
6672
|
-
return debug$
|
|
6679
|
+
return debug$3.warn('rendering');
|
|
6673
6680
|
if (this.times > 3)
|
|
6674
|
-
return debug$
|
|
6681
|
+
return debug$3.warn('render max times');
|
|
6675
6682
|
this.times++;
|
|
6676
6683
|
this.totalTimes++;
|
|
6677
6684
|
this.rendering = true;
|
|
@@ -6708,7 +6715,7 @@ var LeaferUI = (function (exports) {
|
|
|
6708
6715
|
partRender() {
|
|
6709
6716
|
const { canvas, updateBlocks: list } = this;
|
|
6710
6717
|
if (!list)
|
|
6711
|
-
return debug$
|
|
6718
|
+
return debug$3.warn('PartRender: need update attr');
|
|
6712
6719
|
this.mergeBlocks();
|
|
6713
6720
|
list.forEach(block => { if (canvas.bounds.hit(block) && !block.isEmpty())
|
|
6714
6721
|
this.clipRender(block); });
|
|
@@ -6811,7 +6818,7 @@ var LeaferUI = (function (exports) {
|
|
|
6811
6818
|
empty = (!leaf.__world.width || !leaf.__world.height);
|
|
6812
6819
|
if (empty) {
|
|
6813
6820
|
if (!leaf.isLeafer)
|
|
6814
|
-
debug$
|
|
6821
|
+
debug$3.tip(leaf.innerName, ': empty');
|
|
6815
6822
|
empty = (!leaf.isBranch || leaf.isBranchLeaf);
|
|
6816
6823
|
}
|
|
6817
6824
|
return empty;
|
|
@@ -6977,143 +6984,26 @@ var LeaferUI = (function (exports) {
|
|
|
6977
6984
|
}
|
|
6978
6985
|
}
|
|
6979
6986
|
|
|
6980
|
-
const { Yes, NoAndSkip, YesAndSkip } = exports.Answer;
|
|
6981
|
-
const idCondition = {}, classNameCondition = {}, tagCondition = {};
|
|
6982
6987
|
class Selector {
|
|
6983
6988
|
constructor(target, userConfig) {
|
|
6984
6989
|
this.config = {};
|
|
6985
|
-
this.innerIdMap = {};
|
|
6986
|
-
this.idMap = {};
|
|
6987
|
-
this.methods = {
|
|
6988
|
-
id: (leaf, name) => leaf.id === name ? (this.target && (this.idMap[name] = leaf), 1) : 0,
|
|
6989
|
-
innerId: (leaf, innerId) => leaf.innerId === innerId ? (this.target && (this.innerIdMap[innerId] = leaf), 1) : 0,
|
|
6990
|
-
className: (leaf, name) => leaf.className === name ? 1 : 0,
|
|
6991
|
-
tag: (leaf, name) => leaf.__tag === name ? 1 : 0,
|
|
6992
|
-
tags: (leaf, nameMap) => nameMap[leaf.__tag] ? 1 : 0
|
|
6993
|
-
};
|
|
6994
|
-
this.target = target;
|
|
6995
6990
|
if (userConfig)
|
|
6996
6991
|
this.config = DataHelper.default(userConfig, this.config);
|
|
6997
|
-
this.picker = new Picker(target, this);
|
|
6998
|
-
|
|
6999
|
-
this.__listenEvents();
|
|
7000
|
-
}
|
|
7001
|
-
getBy(condition, branch, one, options) {
|
|
7002
|
-
switch (typeof condition) {
|
|
7003
|
-
case 'number':
|
|
7004
|
-
const leaf = this.getByInnerId(condition, branch);
|
|
7005
|
-
return one ? leaf : (leaf ? [leaf] : []);
|
|
7006
|
-
case 'string':
|
|
7007
|
-
switch (condition[0]) {
|
|
7008
|
-
case '#':
|
|
7009
|
-
idCondition.id = condition.substring(1), condition = idCondition;
|
|
7010
|
-
break;
|
|
7011
|
-
case '.':
|
|
7012
|
-
classNameCondition.className = condition.substring(1), condition = classNameCondition;
|
|
7013
|
-
break;
|
|
7014
|
-
default:
|
|
7015
|
-
tagCondition.tag = condition, condition = tagCondition;
|
|
7016
|
-
}
|
|
7017
|
-
case 'object':
|
|
7018
|
-
if (condition.id !== undefined) {
|
|
7019
|
-
const leaf = this.getById(condition.id, branch);
|
|
7020
|
-
return one ? leaf : (leaf ? [leaf] : []);
|
|
7021
|
-
}
|
|
7022
|
-
else if (condition.tag) {
|
|
7023
|
-
const { tag } = condition, isArray = tag instanceof Array;
|
|
7024
|
-
return this.getByMethod(isArray ? this.methods.tags : this.methods.tag, branch, one, isArray ? DataHelper.toMap(tag) : tag);
|
|
7025
|
-
}
|
|
7026
|
-
else {
|
|
7027
|
-
return this.getByMethod(this.methods.className, branch, one, condition.className);
|
|
7028
|
-
}
|
|
7029
|
-
case 'function':
|
|
7030
|
-
return this.getByMethod(condition, branch, one, options);
|
|
7031
|
-
}
|
|
6992
|
+
this.picker = new Picker(this.target = target, this);
|
|
6993
|
+
this.finder = Creator.finder && Creator.finder();
|
|
7032
6994
|
}
|
|
7033
6995
|
getByPoint(hitPoint, hitRadius, options) {
|
|
7034
|
-
if (Platform.
|
|
7035
|
-
this.target.
|
|
6996
|
+
if (Platform.backgrounder && this.target)
|
|
6997
|
+
this.target.updateLayout();
|
|
7036
6998
|
return this.picker.getByPoint(hitPoint, hitRadius, options);
|
|
7037
6999
|
}
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
if (cache)
|
|
7041
|
-
return cache;
|
|
7042
|
-
this.eachFind(this.toChildren(branch), this.methods.innerId, null, innerId);
|
|
7043
|
-
return this.findLeaf;
|
|
7044
|
-
}
|
|
7045
|
-
getById(id, branch) {
|
|
7046
|
-
const cache = this.idMap[id];
|
|
7047
|
-
if (cache && LeafHelper.hasParent(cache, branch || this.target))
|
|
7048
|
-
return cache;
|
|
7049
|
-
this.eachFind(this.toChildren(branch), this.methods.id, null, id);
|
|
7050
|
-
return this.findLeaf;
|
|
7051
|
-
}
|
|
7052
|
-
getByClassName(className, branch) {
|
|
7053
|
-
return this.getByMethod(this.methods.className, branch, false, className);
|
|
7054
|
-
}
|
|
7055
|
-
getByTag(tag, branch) {
|
|
7056
|
-
return this.getByMethod(this.methods.tag, branch, false, tag);
|
|
7057
|
-
}
|
|
7058
|
-
getByMethod(method, branch, one, options) {
|
|
7059
|
-
const list = one ? null : [];
|
|
7060
|
-
this.eachFind(this.toChildren(branch), method, list, options);
|
|
7061
|
-
return list || this.findLeaf;
|
|
7062
|
-
}
|
|
7063
|
-
eachFind(children, method, list, options) {
|
|
7064
|
-
let child, result;
|
|
7065
|
-
for (let i = 0, len = children.length; i < len; i++) {
|
|
7066
|
-
child = children[i];
|
|
7067
|
-
result = method(child, options);
|
|
7068
|
-
if (result === Yes || result === YesAndSkip) {
|
|
7069
|
-
if (list) {
|
|
7070
|
-
list.push(child);
|
|
7071
|
-
}
|
|
7072
|
-
else {
|
|
7073
|
-
this.findLeaf = child;
|
|
7074
|
-
return;
|
|
7075
|
-
}
|
|
7076
|
-
}
|
|
7077
|
-
if (child.isBranch && result < NoAndSkip)
|
|
7078
|
-
this.eachFind(child.children, method, list, options);
|
|
7079
|
-
}
|
|
7080
|
-
}
|
|
7081
|
-
toChildren(branch) {
|
|
7082
|
-
this.findLeaf = null;
|
|
7083
|
-
return [branch || this.target];
|
|
7084
|
-
}
|
|
7085
|
-
__onRemoveChild(event) {
|
|
7086
|
-
const { id, innerId } = event.child;
|
|
7087
|
-
if (this.idMap[id])
|
|
7088
|
-
delete this.idMap[id];
|
|
7089
|
-
if (this.innerIdMap[innerId])
|
|
7090
|
-
delete this.innerIdMap[innerId];
|
|
7091
|
-
}
|
|
7092
|
-
__checkIdChange(event) {
|
|
7093
|
-
if (event.attrName === 'id') {
|
|
7094
|
-
const id = event.oldValue;
|
|
7095
|
-
if (this.idMap[id])
|
|
7096
|
-
delete this.idMap[id];
|
|
7097
|
-
}
|
|
7098
|
-
}
|
|
7099
|
-
__listenEvents() {
|
|
7100
|
-
this.__eventIds = [
|
|
7101
|
-
this.target.on_(ChildEvent.REMOVE, this.__onRemoveChild, this),
|
|
7102
|
-
this.target.on_(PropertyEvent.CHANGE, this.__checkIdChange, this)
|
|
7103
|
-
];
|
|
7104
|
-
}
|
|
7105
|
-
__removeListenEvents() {
|
|
7106
|
-
this.target.off_(this.__eventIds);
|
|
7107
|
-
this.__eventIds.length = 0;
|
|
7000
|
+
getBy(condition, branch, one, options) {
|
|
7001
|
+
return this.finder ? this.finder.getBy(condition, branch, one, options) : Plugin.need('find');
|
|
7108
7002
|
}
|
|
7109
7003
|
destroy() {
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
this.
|
|
7113
|
-
this.findLeaf = null;
|
|
7114
|
-
this.innerIdMap = {};
|
|
7115
|
-
this.idMap = {};
|
|
7116
|
-
}
|
|
7004
|
+
this.picker.destroy();
|
|
7005
|
+
if (this.finder)
|
|
7006
|
+
this.finder.destroy();
|
|
7117
7007
|
}
|
|
7118
7008
|
}
|
|
7119
7009
|
|
|
@@ -7186,7 +7076,7 @@ var LeaferUI = (function (exports) {
|
|
|
7186
7076
|
|
|
7187
7077
|
const { parse, objectToCanvasData } = PathConvert;
|
|
7188
7078
|
const emptyPaint = {};
|
|
7189
|
-
const debug$
|
|
7079
|
+
const debug$2 = Debug.get('UIData');
|
|
7190
7080
|
class UIData extends LeafData {
|
|
7191
7081
|
get scale() { const { scaleX, scaleY } = this; return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX; }
|
|
7192
7082
|
get __strokeWidth() {
|
|
@@ -7223,7 +7113,7 @@ var LeaferUI = (function (exports) {
|
|
|
7223
7113
|
if (value < 0) {
|
|
7224
7114
|
this._width = -value;
|
|
7225
7115
|
this.__leaf.scaleX *= -1;
|
|
7226
|
-
debug$
|
|
7116
|
+
debug$2.warn('width < 0, instead -scaleX ', this);
|
|
7227
7117
|
}
|
|
7228
7118
|
else
|
|
7229
7119
|
this._width = value;
|
|
@@ -7232,7 +7122,7 @@ var LeaferUI = (function (exports) {
|
|
|
7232
7122
|
if (value < 0) {
|
|
7233
7123
|
this._height = -value;
|
|
7234
7124
|
this.__leaf.scaleY *= -1;
|
|
7235
|
-
debug$
|
|
7125
|
+
debug$2.warn('height < 0, instead -scaleY', this);
|
|
7236
7126
|
}
|
|
7237
7127
|
else
|
|
7238
7128
|
this._height = value;
|
|
@@ -7609,25 +7499,27 @@ var LeaferUI = (function (exports) {
|
|
|
7609
7499
|
}
|
|
7610
7500
|
reset(_data) { }
|
|
7611
7501
|
set(data, transition) {
|
|
7612
|
-
if (
|
|
7613
|
-
if (transition
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
|
|
7502
|
+
if (data) {
|
|
7503
|
+
if (transition) {
|
|
7504
|
+
if (transition === 'temp') {
|
|
7505
|
+
this.lockNormalStyle = true;
|
|
7506
|
+
Object.assign(this, data);
|
|
7507
|
+
this.lockNormalStyle = false;
|
|
7508
|
+
}
|
|
7509
|
+
else
|
|
7510
|
+
this.animate(data, transition);
|
|
7617
7511
|
}
|
|
7618
7512
|
else
|
|
7619
|
-
|
|
7513
|
+
Object.assign(this, data);
|
|
7620
7514
|
}
|
|
7621
|
-
else
|
|
7622
|
-
Object.assign(this, data);
|
|
7623
7515
|
}
|
|
7624
7516
|
get(name) {
|
|
7625
7517
|
return typeof name === 'string' ? this.__.__getInput(name) : this.__.__getInputData(name);
|
|
7626
7518
|
}
|
|
7627
7519
|
createProxyData() { return undefined; }
|
|
7628
|
-
find(_condition, _options) { return
|
|
7520
|
+
find(_condition, _options) { return Plugin.need('find'); }
|
|
7629
7521
|
findTag(tag) { return this.find({ tag }); }
|
|
7630
|
-
findOne(_condition, _options) { return
|
|
7522
|
+
findOne(_condition, _options) { return Plugin.need('find'); }
|
|
7631
7523
|
findId(id) { return this.findOne({ id }); }
|
|
7632
7524
|
getPath(curve, pathForRender) {
|
|
7633
7525
|
this.__layout.update();
|
|
@@ -7679,9 +7571,9 @@ var LeaferUI = (function (exports) {
|
|
|
7679
7571
|
animate(_keyframe, _options, _type, _isTemp) {
|
|
7680
7572
|
return Plugin.need('animate');
|
|
7681
7573
|
}
|
|
7682
|
-
killAnimate(_type) { }
|
|
7683
|
-
export(
|
|
7684
|
-
return
|
|
7574
|
+
killAnimate(_type, _killStyle) { }
|
|
7575
|
+
export(_filename, _options) {
|
|
7576
|
+
return Plugin.need('export');
|
|
7685
7577
|
}
|
|
7686
7578
|
clone(data) {
|
|
7687
7579
|
const json = this.toJSON();
|
|
@@ -7927,16 +7819,18 @@ var LeaferUI = (function (exports) {
|
|
|
7927
7819
|
this.children = [];
|
|
7928
7820
|
}
|
|
7929
7821
|
set(data, transition) {
|
|
7930
|
-
if (data
|
|
7931
|
-
|
|
7932
|
-
|
|
7933
|
-
|
|
7934
|
-
|
|
7935
|
-
|
|
7936
|
-
|
|
7822
|
+
if (data) {
|
|
7823
|
+
if (data.children) {
|
|
7824
|
+
const { children } = data;
|
|
7825
|
+
delete data.children;
|
|
7826
|
+
this.children ? this.clear() : this.__setBranch();
|
|
7827
|
+
super.set(data, transition);
|
|
7828
|
+
children.forEach(child => this.add(child));
|
|
7829
|
+
data.children = children;
|
|
7830
|
+
}
|
|
7831
|
+
else
|
|
7832
|
+
super.set(data, transition);
|
|
7937
7833
|
}
|
|
7938
|
-
else
|
|
7939
|
-
super.set(data, transition);
|
|
7940
7834
|
}
|
|
7941
7835
|
toJSON(options) {
|
|
7942
7836
|
const data = super.toJSON(options);
|
|
@@ -7968,7 +7862,7 @@ var LeaferUI = (function (exports) {
|
|
|
7968
7862
|
], exports.Group);
|
|
7969
7863
|
|
|
7970
7864
|
var Leafer_1;
|
|
7971
|
-
const debug$
|
|
7865
|
+
const debug$1 = Debug.get('Leafer');
|
|
7972
7866
|
exports.Leafer = Leafer_1 = class Leafer extends exports.Group {
|
|
7973
7867
|
get __tag() { return 'Leafer'; }
|
|
7974
7868
|
get isApp() { return false; }
|
|
@@ -8133,7 +8027,7 @@ var LeaferUI = (function (exports) {
|
|
|
8133
8027
|
if (this.canvas) {
|
|
8134
8028
|
if (canvasSizeAttrs.includes(attrName)) {
|
|
8135
8029
|
if (!newValue)
|
|
8136
|
-
debug$
|
|
8030
|
+
debug$1.warn(attrName + ' is 0');
|
|
8137
8031
|
this.__changeCanvasSize(attrName, newValue);
|
|
8138
8032
|
}
|
|
8139
8033
|
else if (attrName === 'fill') {
|
|
@@ -8199,6 +8093,8 @@ var LeaferUI = (function (exports) {
|
|
|
8199
8093
|
this.requestRender();
|
|
8200
8094
|
}
|
|
8201
8095
|
}
|
|
8096
|
+
else
|
|
8097
|
+
this.requestRender();
|
|
8202
8098
|
}
|
|
8203
8099
|
__checkViewCompleted(emit = true) {
|
|
8204
8100
|
this.nextRender(() => {
|
|
@@ -8272,9 +8168,6 @@ var LeaferUI = (function (exports) {
|
|
|
8272
8168
|
this.canvas && this.canvas.updateClientBounds();
|
|
8273
8169
|
}
|
|
8274
8170
|
receiveEvent(_event) { }
|
|
8275
|
-
__checkUpdateLayout() {
|
|
8276
|
-
this.__layout.update();
|
|
8277
|
-
}
|
|
8278
8171
|
emitLeafer(type) {
|
|
8279
8172
|
this.emitEvent(new LeaferEvent(type, this));
|
|
8280
8173
|
}
|
|
@@ -8285,7 +8178,7 @@ var LeaferUI = (function (exports) {
|
|
|
8285
8178
|
this.once(LayoutEvent.END, () => this.__onReady());
|
|
8286
8179
|
this.once(RenderEvent.START, () => this.__onCreated());
|
|
8287
8180
|
this.once(RenderEvent.END, () => this.__onViewReady());
|
|
8288
|
-
this.__eventIds.push(this.on_(WatchEvent.DATA, this.__onWatchData, this), this.on_(RenderEvent.NEXT, this.__onNextRender, this)
|
|
8181
|
+
this.__eventIds.push(this.on_(WatchEvent.DATA, this.__onWatchData, this), this.on_(RenderEvent.NEXT, this.__onNextRender, this));
|
|
8289
8182
|
}
|
|
8290
8183
|
__removeListenEvents() {
|
|
8291
8184
|
this.off_(this.__eventIds);
|
|
@@ -8316,7 +8209,7 @@ var LeaferUI = (function (exports) {
|
|
|
8316
8209
|
setTimeout(() => { ImageManager.clearRecycled(); }, 100);
|
|
8317
8210
|
}
|
|
8318
8211
|
catch (e) {
|
|
8319
|
-
debug$
|
|
8212
|
+
debug$1.error(e);
|
|
8320
8213
|
}
|
|
8321
8214
|
}
|
|
8322
8215
|
};
|
|
@@ -8350,7 +8243,7 @@ var LeaferUI = (function (exports) {
|
|
|
8350
8243
|
], exports.Rect);
|
|
8351
8244
|
|
|
8352
8245
|
const { copy: copy$3, add, includes: includes$1 } = BoundsHelper;
|
|
8353
|
-
const rect$1 = exports.Rect.prototype, group
|
|
8246
|
+
const rect$1 = exports.Rect.prototype, group = exports.Group.prototype;
|
|
8354
8247
|
const childrenRenderBounds = {};
|
|
8355
8248
|
exports.Box = class Box extends exports.Group {
|
|
8356
8249
|
get __tag() { return 'Box'; }
|
|
@@ -8460,7 +8353,7 @@ var LeaferUI = (function (exports) {
|
|
|
8460
8353
|
rewrite(rect$1.__render)
|
|
8461
8354
|
], exports.Box.prototype, "__renderRect", null);
|
|
8462
8355
|
__decorate([
|
|
8463
|
-
rewrite(group
|
|
8356
|
+
rewrite(group.__render)
|
|
8464
8357
|
], exports.Box.prototype, "__renderGroup", null);
|
|
8465
8358
|
exports.Box = __decorate([
|
|
8466
8359
|
rewriteAble(),
|
|
@@ -8545,7 +8438,7 @@ var LeaferUI = (function (exports) {
|
|
|
8545
8438
|
|
|
8546
8439
|
const { moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1 } = PathCommandDataHelper;
|
|
8547
8440
|
const { rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint } = PointHelper;
|
|
8548
|
-
const { toBounds
|
|
8441
|
+
const { toBounds } = PathBounds;
|
|
8549
8442
|
exports.Line = class Line extends exports.UI {
|
|
8550
8443
|
get __tag() { return 'Line'; }
|
|
8551
8444
|
get toPoint() {
|
|
@@ -8589,7 +8482,7 @@ var LeaferUI = (function (exports) {
|
|
|
8589
8482
|
}
|
|
8590
8483
|
__updateBoxBounds() {
|
|
8591
8484
|
if (this.points) {
|
|
8592
|
-
toBounds
|
|
8485
|
+
toBounds(this.__.__pathForRender, this.__layout.boxBounds);
|
|
8593
8486
|
}
|
|
8594
8487
|
else
|
|
8595
8488
|
super.__updateBoxBounds();
|
|
@@ -8764,10 +8657,10 @@ var LeaferUI = (function (exports) {
|
|
|
8764
8657
|
__updateSize() {
|
|
8765
8658
|
const { canvas } = this;
|
|
8766
8659
|
if (canvas) {
|
|
8767
|
-
const { smooth } = this.__;
|
|
8660
|
+
const { smooth, safeResize } = this.__;
|
|
8661
|
+
canvas.resize(this.__, safeResize);
|
|
8768
8662
|
if (canvas.smooth !== smooth)
|
|
8769
8663
|
canvas.smooth = smooth;
|
|
8770
|
-
canvas.resize(this.__);
|
|
8771
8664
|
}
|
|
8772
8665
|
}
|
|
8773
8666
|
destroy() {
|
|
@@ -8793,6 +8686,9 @@ var LeaferUI = (function (exports) {
|
|
|
8793
8686
|
__decorate([
|
|
8794
8687
|
resizeType(true)
|
|
8795
8688
|
], exports.Canvas.prototype, "smooth", void 0);
|
|
8689
|
+
__decorate([
|
|
8690
|
+
dataType(false)
|
|
8691
|
+
], exports.Canvas.prototype, "safeResize", void 0);
|
|
8796
8692
|
__decorate([
|
|
8797
8693
|
resizeType()
|
|
8798
8694
|
], exports.Canvas.prototype, "contextSettings", void 0);
|
|
@@ -8938,6 +8834,9 @@ var LeaferUI = (function (exports) {
|
|
|
8938
8834
|
__decorate([
|
|
8939
8835
|
boundsType(0)
|
|
8940
8836
|
], exports.Text.prototype, "paraSpacing", void 0);
|
|
8837
|
+
__decorate([
|
|
8838
|
+
boundsType('x')
|
|
8839
|
+
], exports.Text.prototype, "writingMode", void 0);
|
|
8941
8840
|
__decorate([
|
|
8942
8841
|
boundsType('left')
|
|
8943
8842
|
], exports.Text.prototype, "textAlign", void 0);
|
|
@@ -9124,8 +9023,8 @@ var LeaferUI = (function (exports) {
|
|
|
9124
9023
|
this.children.forEach(leafer => leafer.resize(event));
|
|
9125
9024
|
super.__onResize(event);
|
|
9126
9025
|
}
|
|
9127
|
-
|
|
9128
|
-
this.children.forEach(leafer => leafer.
|
|
9026
|
+
updateLayout() {
|
|
9027
|
+
this.children.forEach(leafer => leafer.updateLayout());
|
|
9129
9028
|
}
|
|
9130
9029
|
__getChildConfig(userConfig) {
|
|
9131
9030
|
let config = Object.assign({}, this.config);
|
|
@@ -9615,7 +9514,7 @@ var LeaferUI = (function (exports) {
|
|
|
9615
9514
|
}
|
|
9616
9515
|
}
|
|
9617
9516
|
|
|
9618
|
-
const debug
|
|
9517
|
+
const debug = Debug.get('emit');
|
|
9619
9518
|
function emit$1(type, data, path, excludePath) {
|
|
9620
9519
|
if (!path && !data.path)
|
|
9621
9520
|
return;
|
|
@@ -9645,7 +9544,7 @@ var LeaferUI = (function (exports) {
|
|
|
9645
9544
|
}
|
|
9646
9545
|
}
|
|
9647
9546
|
catch (e) {
|
|
9648
|
-
debug
|
|
9547
|
+
debug.error(e);
|
|
9649
9548
|
}
|
|
9650
9549
|
}
|
|
9651
9550
|
const allowTypes = ['move', 'zoom', 'rotate', 'key'];
|
|
@@ -10202,8 +10101,8 @@ var LeaferUI = (function (exports) {
|
|
|
10202
10101
|
this.__drawRenderPath(canvas); };
|
|
10203
10102
|
|
|
10204
10103
|
const matrix = new Matrix();
|
|
10205
|
-
const ui$
|
|
10206
|
-
ui$
|
|
10104
|
+
const ui$1 = exports.UI.prototype;
|
|
10105
|
+
ui$1.__updateHitCanvas = function () {
|
|
10207
10106
|
const data = this.__, { hitCanvasManager } = this.leafer;
|
|
10208
10107
|
const isHitPixelFill = (data.__pixelFill || data.__isCanvas) && data.hitFill === 'pixel';
|
|
10209
10108
|
const isHitPixelStroke = data.__pixelStroke && data.hitStroke === 'pixel';
|
|
@@ -10230,7 +10129,7 @@ var LeaferUI = (function (exports) {
|
|
|
10230
10129
|
this.__drawHitPath(h);
|
|
10231
10130
|
h.setStrokeOptions(data);
|
|
10232
10131
|
};
|
|
10233
|
-
ui$
|
|
10132
|
+
ui$1.__hit = function (inner) {
|
|
10234
10133
|
if (Platform.name === 'miniapp')
|
|
10235
10134
|
this.__drawHitPath(this.__hitCanvas);
|
|
10236
10135
|
const data = this.__;
|
|
@@ -10270,43 +10169,35 @@ var LeaferUI = (function (exports) {
|
|
|
10270
10169
|
return hitWidth ? this.__hitStroke(inner, hitWidth) : false;
|
|
10271
10170
|
};
|
|
10272
10171
|
|
|
10273
|
-
const ui
|
|
10172
|
+
const ui = exports.UI.prototype, rect = exports.Rect.prototype, box$1 = exports.Box.prototype;
|
|
10274
10173
|
rect.__updateHitCanvas = box$1.__updateHitCanvas = function () {
|
|
10275
10174
|
if (this.stroke || this.cornerRadius || ((this.fill || this.__.__isCanvas) && this.hitFill === 'pixel') || this.hitStroke === 'all')
|
|
10276
|
-
ui
|
|
10175
|
+
ui.__updateHitCanvas.call(this);
|
|
10277
10176
|
else if (this.__hitCanvas)
|
|
10278
10177
|
this.__hitCanvas = null;
|
|
10279
10178
|
};
|
|
10280
10179
|
rect.__hitFill = box$1.__hitFill = function (inner) {
|
|
10281
|
-
return this.__hitCanvas ? ui
|
|
10180
|
+
return this.__hitCanvas ? ui.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
|
|
10282
10181
|
};
|
|
10283
10182
|
|
|
10284
|
-
const ui = exports.UI.prototype, group = exports.Group.prototype;
|
|
10285
10183
|
function getSelector(ui) {
|
|
10286
10184
|
return ui.leafer ? ui.leafer.selector : (Platform.selector || (Platform.selector = Creator.selector()));
|
|
10287
10185
|
}
|
|
10288
|
-
|
|
10289
|
-
|
|
10290
|
-
|
|
10291
|
-
ui.findOne = function (condition, options) {
|
|
10292
|
-
return getSelector(this).getBy(condition, this, true, options);
|
|
10293
|
-
};
|
|
10294
|
-
group.pick = function (hitPoint, options) {
|
|
10295
|
-
this.__layout.update();
|
|
10296
|
-
if (!options)
|
|
10297
|
-
options = {};
|
|
10186
|
+
exports.Group.prototype.pick = function (hitPoint, options) {
|
|
10187
|
+
this.leafer || this.updateLayout();
|
|
10188
|
+
options || (options = emptyData);
|
|
10298
10189
|
return getSelector(this).getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this }));
|
|
10299
10190
|
};
|
|
10300
10191
|
|
|
10301
|
-
const canvas
|
|
10302
|
-
canvas
|
|
10192
|
+
const canvas = LeaferCanvasBase.prototype;
|
|
10193
|
+
canvas.hitFill = function (point, fillRule) {
|
|
10303
10194
|
return fillRule ? this.context.isPointInPath(point.x, point.y, fillRule) : this.context.isPointInPath(point.x, point.y);
|
|
10304
10195
|
};
|
|
10305
|
-
canvas
|
|
10196
|
+
canvas.hitStroke = function (point, strokeWidth) {
|
|
10306
10197
|
this.strokeWidth = strokeWidth;
|
|
10307
10198
|
return this.context.isPointInStroke(point.x, point.y);
|
|
10308
10199
|
};
|
|
10309
|
-
canvas
|
|
10200
|
+
canvas.hitPixel = function (radiusPoint, offset, scale = 1) {
|
|
10310
10201
|
let { x, y, radiusX, radiusY } = radiusPoint;
|
|
10311
10202
|
if (offset)
|
|
10312
10203
|
x -= offset.x, y -= offset.y;
|
|
@@ -12102,197 +11993,12 @@ var LeaferUI = (function (exports) {
|
|
|
12102
11993
|
string
|
|
12103
11994
|
};
|
|
12104
11995
|
|
|
12105
|
-
const { setPoint, addPoint, toBounds } = TwoPointBoundsHelper;
|
|
12106
|
-
function getTrimBounds(canvas) {
|
|
12107
|
-
const { width, height } = canvas.view;
|
|
12108
|
-
const { data } = canvas.context.getImageData(0, 0, width, height);
|
|
12109
|
-
let x, y, pointBounds, index = 0;
|
|
12110
|
-
for (let i = 0; i < data.length; i += 4) {
|
|
12111
|
-
if (data[i + 3] !== 0) {
|
|
12112
|
-
x = index % width;
|
|
12113
|
-
y = (index - x) / width;
|
|
12114
|
-
pointBounds ? addPoint(pointBounds, x, y) : setPoint(pointBounds = {}, x, y);
|
|
12115
|
-
}
|
|
12116
|
-
index++;
|
|
12117
|
-
}
|
|
12118
|
-
const bounds = new Bounds();
|
|
12119
|
-
toBounds(pointBounds, bounds);
|
|
12120
|
-
return bounds.scale(1 / canvas.pixelRatio).ceil();
|
|
12121
|
-
}
|
|
12122
|
-
|
|
12123
|
-
const ExportModule = {
|
|
12124
|
-
export(leaf, filename, options) {
|
|
12125
|
-
this.running = true;
|
|
12126
|
-
const fileType = FileHelper.fileType(filename);
|
|
12127
|
-
const isDownload = filename.includes('.');
|
|
12128
|
-
options = FileHelper.getExportOptions(options);
|
|
12129
|
-
return addTask((success) => new Promise((resolve) => {
|
|
12130
|
-
const over = (result) => {
|
|
12131
|
-
success(result);
|
|
12132
|
-
resolve();
|
|
12133
|
-
this.running = false;
|
|
12134
|
-
};
|
|
12135
|
-
const { toURL } = Platform;
|
|
12136
|
-
const { download } = Platform.origin;
|
|
12137
|
-
if (fileType === 'json') {
|
|
12138
|
-
isDownload && download(toURL(JSON.stringify(leaf.toJSON(options.json)), 'text'), filename);
|
|
12139
|
-
return over({ data: isDownload ? true : leaf.toJSON(options.json) });
|
|
12140
|
-
}
|
|
12141
|
-
if (fileType === 'svg') {
|
|
12142
|
-
isDownload && download(toURL(leaf.toSVG(), 'svg'), filename);
|
|
12143
|
-
return over({ data: isDownload ? true : leaf.toSVG() });
|
|
12144
|
-
}
|
|
12145
|
-
const { leafer } = leaf;
|
|
12146
|
-
if (leafer) {
|
|
12147
|
-
checkLazy(leaf);
|
|
12148
|
-
leafer.waitViewCompleted(() => __awaiter(this, void 0, void 0, function* () {
|
|
12149
|
-
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
12150
|
-
const { worldTransform, isLeafer, isFrame } = leaf;
|
|
12151
|
-
const { slice, trim, onCanvas } = options;
|
|
12152
|
-
const smooth = options.smooth === undefined ? leafer.config.smooth : options.smooth;
|
|
12153
|
-
const contextSettings = options.contextSettings || leafer.config.contextSettings;
|
|
12154
|
-
const screenshot = options.screenshot || leaf.isApp;
|
|
12155
|
-
const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill : options.fill) : options.fill;
|
|
12156
|
-
const needFill = FileHelper.isOpaqueImage(filename) || fill, matrix = new Matrix();
|
|
12157
|
-
if (screenshot) {
|
|
12158
|
-
renderBounds = screenshot === true ? (isLeafer ? leafer.canvas.bounds : leaf.worldRenderBounds) : screenshot;
|
|
12159
|
-
}
|
|
12160
|
-
else {
|
|
12161
|
-
let relative = options.relative || (isLeafer ? 'inner' : 'local');
|
|
12162
|
-
scaleX = worldTransform.scaleX;
|
|
12163
|
-
scaleY = worldTransform.scaleY;
|
|
12164
|
-
switch (relative) {
|
|
12165
|
-
case 'inner':
|
|
12166
|
-
matrix.set(worldTransform);
|
|
12167
|
-
break;
|
|
12168
|
-
case 'local':
|
|
12169
|
-
matrix.set(worldTransform).divide(leaf.localTransform);
|
|
12170
|
-
scaleX /= leaf.scaleX;
|
|
12171
|
-
scaleY /= leaf.scaleY;
|
|
12172
|
-
break;
|
|
12173
|
-
case 'world':
|
|
12174
|
-
scaleX = 1;
|
|
12175
|
-
scaleY = 1;
|
|
12176
|
-
break;
|
|
12177
|
-
case 'page':
|
|
12178
|
-
relative = leaf.leafer;
|
|
12179
|
-
default:
|
|
12180
|
-
matrix.set(worldTransform).divide(leaf.getTransform(relative));
|
|
12181
|
-
const l = relative.worldTransform;
|
|
12182
|
-
scaleX /= scaleX / l.scaleX;
|
|
12183
|
-
scaleY /= scaleY / l.scaleY;
|
|
12184
|
-
}
|
|
12185
|
-
renderBounds = leaf.getBounds('render', relative);
|
|
12186
|
-
}
|
|
12187
|
-
const scaleData = { scaleX: 1, scaleY: 1 };
|
|
12188
|
-
MathHelper.getScaleData(options.scale, options.size, renderBounds, scaleData);
|
|
12189
|
-
let pixelRatio = options.pixelRatio || 1;
|
|
12190
|
-
if (leaf.isApp) {
|
|
12191
|
-
scaleData.scaleX *= pixelRatio;
|
|
12192
|
-
scaleData.scaleY *= pixelRatio;
|
|
12193
|
-
pixelRatio = leaf.app.pixelRatio;
|
|
12194
|
-
}
|
|
12195
|
-
const { x, y, width, height } = new Bounds(renderBounds).scale(scaleData.scaleX, scaleData.scaleY);
|
|
12196
|
-
const renderOptions = { matrix: matrix.scale(1 / scaleData.scaleX, 1 / scaleData.scaleY).invert().translate(-x, -y).withScale(1 / scaleX * scaleData.scaleX, 1 / scaleY * scaleData.scaleY) };
|
|
12197
|
-
let canvas = Creator.canvas({ width: Math.round(width), height: Math.round(height), pixelRatio, smooth, contextSettings });
|
|
12198
|
-
let sliceLeaf;
|
|
12199
|
-
if (slice) {
|
|
12200
|
-
sliceLeaf = leaf;
|
|
12201
|
-
sliceLeaf.__worldOpacity = 0;
|
|
12202
|
-
leaf = leafer;
|
|
12203
|
-
renderOptions.bounds = canvas.bounds;
|
|
12204
|
-
}
|
|
12205
|
-
canvas.save();
|
|
12206
|
-
if (isFrame && fill !== undefined) {
|
|
12207
|
-
const oldFill = leaf.get('fill');
|
|
12208
|
-
leaf.fill = '';
|
|
12209
|
-
leaf.__render(canvas, renderOptions);
|
|
12210
|
-
leaf.fill = oldFill;
|
|
12211
|
-
}
|
|
12212
|
-
else {
|
|
12213
|
-
leaf.__render(canvas, renderOptions);
|
|
12214
|
-
}
|
|
12215
|
-
canvas.restore();
|
|
12216
|
-
if (sliceLeaf)
|
|
12217
|
-
sliceLeaf.__updateWorldOpacity();
|
|
12218
|
-
if (trim) {
|
|
12219
|
-
trimBounds = getTrimBounds(canvas);
|
|
12220
|
-
const old = canvas, { width, height } = trimBounds;
|
|
12221
|
-
const config = { x: 0, y: 0, width, height, pixelRatio };
|
|
12222
|
-
canvas = Creator.canvas(config);
|
|
12223
|
-
canvas.copyWorld(old, trimBounds, config);
|
|
12224
|
-
}
|
|
12225
|
-
if (needFill)
|
|
12226
|
-
canvas.fillWorld(canvas.bounds, fill || '#FFFFFF', 'destination-over');
|
|
12227
|
-
if (onCanvas)
|
|
12228
|
-
onCanvas(canvas);
|
|
12229
|
-
const data = filename === 'canvas' ? canvas : yield canvas.export(filename, options);
|
|
12230
|
-
over({ data, width: canvas.pixelWidth, height: canvas.pixelHeight, renderBounds, trimBounds });
|
|
12231
|
-
}));
|
|
12232
|
-
}
|
|
12233
|
-
else {
|
|
12234
|
-
over({ data: false });
|
|
12235
|
-
}
|
|
12236
|
-
}));
|
|
12237
|
-
}
|
|
12238
|
-
};
|
|
12239
|
-
let tasker;
|
|
12240
|
-
function addTask(task) {
|
|
12241
|
-
if (!tasker)
|
|
12242
|
-
tasker = new TaskProcessor();
|
|
12243
|
-
return new Promise((resolve) => {
|
|
12244
|
-
tasker.add(() => __awaiter(this, void 0, void 0, function* () { return yield task(resolve); }), { parallel: false });
|
|
12245
|
-
});
|
|
12246
|
-
}
|
|
12247
|
-
function checkLazy(leaf) {
|
|
12248
|
-
if (leaf.__.__needComputePaint)
|
|
12249
|
-
leaf.__.__computePaint();
|
|
12250
|
-
if (leaf.isBranch)
|
|
12251
|
-
leaf.children.forEach(child => checkLazy(child));
|
|
12252
|
-
}
|
|
12253
|
-
|
|
12254
|
-
const canvas = LeaferCanvasBase.prototype;
|
|
12255
|
-
const debug = Debug.get('@leafer-ui/export');
|
|
12256
|
-
canvas.export = function (filename, options) {
|
|
12257
|
-
const { quality, blob } = FileHelper.getExportOptions(options);
|
|
12258
|
-
if (filename.includes('.'))
|
|
12259
|
-
return this.saveAs(filename, quality);
|
|
12260
|
-
else if (blob)
|
|
12261
|
-
return this.toBlob(filename, quality);
|
|
12262
|
-
else
|
|
12263
|
-
return this.toDataURL(filename, quality);
|
|
12264
|
-
};
|
|
12265
|
-
canvas.toBlob = function (type, quality) {
|
|
12266
|
-
return new Promise((resolve) => {
|
|
12267
|
-
Platform.origin.canvasToBolb(this.view, type, quality).then((blob) => {
|
|
12268
|
-
resolve(blob);
|
|
12269
|
-
}).catch((e) => {
|
|
12270
|
-
debug.error(e);
|
|
12271
|
-
resolve(null);
|
|
12272
|
-
});
|
|
12273
|
-
});
|
|
12274
|
-
};
|
|
12275
|
-
canvas.toDataURL = function (type, quality) {
|
|
12276
|
-
return Platform.origin.canvasToDataURL(this.view, type, quality);
|
|
12277
|
-
};
|
|
12278
|
-
canvas.saveAs = function (filename, quality) {
|
|
12279
|
-
return new Promise((resolve) => {
|
|
12280
|
-
Platform.origin.canvasSaveAs(this.view, filename, quality).then(() => {
|
|
12281
|
-
resolve(true);
|
|
12282
|
-
}).catch((e) => {
|
|
12283
|
-
debug.error(e);
|
|
12284
|
-
resolve(false);
|
|
12285
|
-
});
|
|
12286
|
-
});
|
|
12287
|
-
};
|
|
12288
|
-
|
|
12289
11996
|
Object.assign(TextConvert, TextConvertModule);
|
|
12290
11997
|
Object.assign(ColorConvert, ColorConvertModule);
|
|
12291
11998
|
Object.assign(Paint, PaintModule);
|
|
12292
11999
|
Object.assign(PaintImage, PaintImageModule);
|
|
12293
12000
|
Object.assign(PaintGradient, PaintGradientModule);
|
|
12294
12001
|
Object.assign(Effect, EffectModule);
|
|
12295
|
-
Object.assign(Export, ExportModule);
|
|
12296
12002
|
|
|
12297
12003
|
Object.assign(Creator, {
|
|
12298
12004
|
interaction: (target, canvas, selector, options) => new Interaction(target, canvas, selector, options),
|
|
@@ -12383,6 +12089,7 @@ var LeaferUI = (function (exports) {
|
|
|
12383
12089
|
exports.PathNumberCommandLengthMap = PathNumberCommandLengthMap;
|
|
12384
12090
|
exports.PathNumberCommandMap = PathNumberCommandMap;
|
|
12385
12091
|
exports.PenData = PenData;
|
|
12092
|
+
exports.Picker = Picker;
|
|
12386
12093
|
exports.Platform = Platform;
|
|
12387
12094
|
exports.Plugin = Plugin;
|
|
12388
12095
|
exports.Point = Point;
|