@leafer-game/worker 1.2.2 → 1.3.1
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/dist/worker.cjs +7 -0
- package/dist/worker.esm.js +1 -0
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.js +332 -478
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.module.js +331 -479
- package/dist/worker.module.min.js +1 -1
- package/package.json +10 -9
package/dist/worker.module.js
CHANGED
|
@@ -765,8 +765,8 @@ const TwoPointBoundsHelper = {
|
|
|
765
765
|
t.maxY = y > t.maxY ? y : t.maxY;
|
|
766
766
|
},
|
|
767
767
|
addBounds(t, x, y, width, height) {
|
|
768
|
-
addPoint$
|
|
769
|
-
addPoint$
|
|
768
|
+
addPoint$3(t, x, y);
|
|
769
|
+
addPoint$3(t, x + width, y + height);
|
|
770
770
|
},
|
|
771
771
|
copy(t, pb) {
|
|
772
772
|
t.minX = pb.minX;
|
|
@@ -787,9 +787,9 @@ const TwoPointBoundsHelper = {
|
|
|
787
787
|
setBounds.height = t.maxY - t.minY;
|
|
788
788
|
}
|
|
789
789
|
};
|
|
790
|
-
const { addPoint: addPoint$
|
|
790
|
+
const { addPoint: addPoint$3 } = TwoPointBoundsHelper;
|
|
791
791
|
|
|
792
|
-
const { tempPointBounds: tempPointBounds$1, setPoint: setPoint$
|
|
792
|
+
const { tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$3 } = TwoPointBoundsHelper;
|
|
793
793
|
const { toOuterPoint: toOuterPoint$2 } = MatrixHelper;
|
|
794
794
|
const { float: float$1, fourNumber: fourNumber$1 } = MathHelper;
|
|
795
795
|
const { floor: floor$1, ceil: ceil$3 } = Math;
|
|
@@ -905,17 +905,17 @@ const BoundsHelper = {
|
|
|
905
905
|
point.x = t.x;
|
|
906
906
|
point.y = t.y;
|
|
907
907
|
toOuterPoint$2(matrix, point, toPoint$5);
|
|
908
|
-
setPoint$
|
|
908
|
+
setPoint$2(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
909
909
|
point.x = t.x + t.width;
|
|
910
910
|
toOuterPoint$2(matrix, point, toPoint$5);
|
|
911
|
-
addPoint$
|
|
911
|
+
addPoint$2(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
912
912
|
point.y = t.y + t.height;
|
|
913
913
|
toOuterPoint$2(matrix, point, toPoint$5);
|
|
914
|
-
addPoint$
|
|
914
|
+
addPoint$2(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
915
915
|
point.x = t.x;
|
|
916
916
|
toOuterPoint$2(matrix, point, toPoint$5);
|
|
917
|
-
addPoint$
|
|
918
|
-
toBounds$
|
|
917
|
+
addPoint$2(tempPointBounds$1, toPoint$5.x, toPoint$5.y);
|
|
918
|
+
toBounds$3(tempPointBounds$1, to);
|
|
919
919
|
}
|
|
920
920
|
},
|
|
921
921
|
toInnerOf(t, matrix, to) {
|
|
@@ -1005,8 +1005,8 @@ const BoundsHelper = {
|
|
|
1005
1005
|
B.reset(t);
|
|
1006
1006
|
},
|
|
1007
1007
|
setPoints(t, points) {
|
|
1008
|
-
points.forEach((point, index) => index === 0 ? setPoint$
|
|
1009
|
-
toBounds$
|
|
1008
|
+
points.forEach((point, index) => index === 0 ? setPoint$2(tempPointBounds$1, point.x, point.y) : addPoint$2(tempPointBounds$1, point.x, point.y));
|
|
1009
|
+
toBounds$3(tempPointBounds$1, t);
|
|
1010
1010
|
},
|
|
1011
1011
|
setPoint(t, point) {
|
|
1012
1012
|
B.set(t, point.x, point.y);
|
|
@@ -1374,7 +1374,7 @@ function getNameList(name) {
|
|
|
1374
1374
|
}
|
|
1375
1375
|
const D$4 = Debug;
|
|
1376
1376
|
|
|
1377
|
-
const debug$
|
|
1377
|
+
const debug$e = Debug.get('RunTime');
|
|
1378
1378
|
const Run = {
|
|
1379
1379
|
currentId: 0,
|
|
1380
1380
|
currentName: '',
|
|
@@ -1392,7 +1392,7 @@ const Run = {
|
|
|
1392
1392
|
const time = R.idMap[id], name = R.nameMap[id];
|
|
1393
1393
|
const duration = microsecond ? (performance.now() - time) / 1000 : Date.now() - time;
|
|
1394
1394
|
R.idMap[id] = R.nameMap[id] = R.nameToIdMap[name] = undefined;
|
|
1395
|
-
debug$
|
|
1395
|
+
debug$e.log(name, duration, 'ms');
|
|
1396
1396
|
},
|
|
1397
1397
|
endOfName(name, microsecond) {
|
|
1398
1398
|
const id = R.nameToIdMap[name];
|
|
@@ -1402,34 +1402,37 @@ const Run = {
|
|
|
1402
1402
|
};
|
|
1403
1403
|
const R = Run;
|
|
1404
1404
|
|
|
1405
|
+
const check = [];
|
|
1405
1406
|
const Plugin = {
|
|
1406
1407
|
list: {},
|
|
1407
|
-
add(name) {
|
|
1408
|
+
add(name, ...needPlugins) {
|
|
1408
1409
|
this.list[name] = true;
|
|
1410
|
+
check.push(...needPlugins);
|
|
1409
1411
|
},
|
|
1410
|
-
|
|
1412
|
+
has(name, tip) {
|
|
1411
1413
|
const rs = this.list[name];
|
|
1412
1414
|
if (!rs && tip)
|
|
1413
1415
|
this.need(name);
|
|
1414
1416
|
return rs;
|
|
1415
1417
|
},
|
|
1416
1418
|
need(name) {
|
|
1417
|
-
console.error('need plugin: @leafer-in/' + name);
|
|
1419
|
+
console.error('need plugin: ' + (name.includes('-x') ? '' : '@leafer-in/') + name);
|
|
1418
1420
|
}
|
|
1419
1421
|
};
|
|
1422
|
+
setTimeout(() => check.forEach(name => Plugin.has(name, true)));
|
|
1420
1423
|
|
|
1421
|
-
const debug$
|
|
1424
|
+
const debug$d = Debug.get('UICreator');
|
|
1422
1425
|
const UICreator = {
|
|
1423
1426
|
list: {},
|
|
1424
1427
|
register(UI) {
|
|
1425
1428
|
const { __tag: tag } = UI.prototype;
|
|
1426
1429
|
if (list$1[tag])
|
|
1427
|
-
debug$
|
|
1430
|
+
debug$d.repeat(tag);
|
|
1428
1431
|
list$1[tag] = UI;
|
|
1429
1432
|
},
|
|
1430
1433
|
get(tag, data, x, y, width, height) {
|
|
1431
1434
|
if (!list$1[tag])
|
|
1432
|
-
debug$
|
|
1435
|
+
debug$d.error('not register ' + tag);
|
|
1433
1436
|
const ui = new list$1[tag](data);
|
|
1434
1437
|
if (x !== undefined) {
|
|
1435
1438
|
ui.x = x;
|
|
@@ -1445,7 +1448,7 @@ const UICreator = {
|
|
|
1445
1448
|
};
|
|
1446
1449
|
const { list: list$1 } = UICreator;
|
|
1447
1450
|
|
|
1448
|
-
const debug$
|
|
1451
|
+
const debug$c = Debug.get('EventCreator');
|
|
1449
1452
|
const EventCreator = {
|
|
1450
1453
|
nameList: {},
|
|
1451
1454
|
register(Event) {
|
|
@@ -1453,7 +1456,7 @@ const EventCreator = {
|
|
|
1453
1456
|
Object.keys(Event).forEach(key => {
|
|
1454
1457
|
name = Event[key];
|
|
1455
1458
|
if (typeof name === 'string')
|
|
1456
|
-
nameList[name] && debug$
|
|
1459
|
+
nameList[name] && debug$c.repeat(name), nameList[name] = Event;
|
|
1457
1460
|
});
|
|
1458
1461
|
},
|
|
1459
1462
|
changeName(oldName, newName) {
|
|
@@ -2342,7 +2345,7 @@ const RectHelper = {
|
|
|
2342
2345
|
};
|
|
2343
2346
|
|
|
2344
2347
|
const { sin: sin$4, cos: cos$4, atan2: atan2$1, ceil: ceil$2, abs: abs$4, PI: PI$3, sqrt: sqrt$3, pow: pow$1 } = Math;
|
|
2345
|
-
const { setPoint: setPoint$
|
|
2348
|
+
const { setPoint: setPoint$1, addPoint: addPoint$1 } = TwoPointBoundsHelper;
|
|
2346
2349
|
const { set, toNumberPoints } = PointHelper;
|
|
2347
2350
|
const { M: M$6, L: L$7, C: C$6, Q: Q$4, Z: Z$6 } = PathCommandMap;
|
|
2348
2351
|
const tempPoint$3 = {};
|
|
@@ -2418,8 +2421,8 @@ const BezierHelper = {
|
|
|
2418
2421
|
if (data)
|
|
2419
2422
|
data.push(L$7, x1, y1);
|
|
2420
2423
|
if (setPointBounds) {
|
|
2421
|
-
setPoint$
|
|
2422
|
-
addPoint$
|
|
2424
|
+
setPoint$1(setPointBounds, fromX, fromY);
|
|
2425
|
+
addPoint$1(setPointBounds, x1, y1);
|
|
2423
2426
|
}
|
|
2424
2427
|
if (setStartPoint)
|
|
2425
2428
|
set(setStartPoint, fromX, fromY);
|
|
@@ -2471,7 +2474,7 @@ const BezierHelper = {
|
|
|
2471
2474
|
if (data)
|
|
2472
2475
|
data.push(data.length ? L$7 : M$6, fromX, fromY);
|
|
2473
2476
|
if (setPointBounds)
|
|
2474
|
-
setPoint$
|
|
2477
|
+
setPoint$1(setPointBounds, fromX, fromY);
|
|
2475
2478
|
if (setStartPoint)
|
|
2476
2479
|
set(setStartPoint, fromX, fromY);
|
|
2477
2480
|
for (let i = 0; i < parts; i++) {
|
|
@@ -2533,11 +2536,11 @@ const BezierHelper = {
|
|
|
2533
2536
|
if (0 < t2 && t2 < 1)
|
|
2534
2537
|
tList.push(t2);
|
|
2535
2538
|
}
|
|
2536
|
-
addMode ? addPoint$
|
|
2537
|
-
addPoint$
|
|
2539
|
+
addMode ? addPoint$1(pointBounds, fromX, fromY) : setPoint$1(pointBounds, fromX, fromY);
|
|
2540
|
+
addPoint$1(pointBounds, toX, toY);
|
|
2538
2541
|
for (let i = 0, len = tList.length; i < len; i++) {
|
|
2539
2542
|
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$3);
|
|
2540
|
-
addPoint$
|
|
2543
|
+
addPoint$1(pointBounds, tempPoint$3.x, tempPoint$3.y);
|
|
2541
2544
|
}
|
|
2542
2545
|
},
|
|
2543
2546
|
getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, setPoint) {
|
|
@@ -2609,7 +2612,7 @@ const EllipseHelper = {
|
|
|
2609
2612
|
const { M: M$5, m, L: L$6, l, H, h, V, v, C: C$5, c, S, s, Q: Q$3, q, T, t, A, a, Z: Z$5, 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;
|
|
2610
2613
|
const { rect: rect$3, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1 } = BezierHelper;
|
|
2611
2614
|
const { ellipticalArc } = EllipseHelper;
|
|
2612
|
-
const debug$
|
|
2615
|
+
const debug$b = Debug.get('PathConvert');
|
|
2613
2616
|
const setEndPoint$1 = {};
|
|
2614
2617
|
const PathConvert = {
|
|
2615
2618
|
current: { dot: 0 },
|
|
@@ -2850,7 +2853,7 @@ const PathConvert = {
|
|
|
2850
2853
|
i += 6;
|
|
2851
2854
|
break;
|
|
2852
2855
|
default:
|
|
2853
|
-
debug$
|
|
2856
|
+
debug$b.error(`command: ${command} [index:${i}]`, old);
|
|
2854
2857
|
return data;
|
|
2855
2858
|
}
|
|
2856
2859
|
lastCommand = command;
|
|
@@ -3075,7 +3078,7 @@ class PathCreator {
|
|
|
3075
3078
|
}
|
|
3076
3079
|
|
|
3077
3080
|
const { M: M$3, L: L$4, C: C$3, Q: Q$1, Z: Z$3, 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;
|
|
3078
|
-
const debug$
|
|
3081
|
+
const debug$a = Debug.get('PathDrawer');
|
|
3079
3082
|
const PathDrawer = {
|
|
3080
3083
|
drawPathByData(drawer, data) {
|
|
3081
3084
|
if (!data)
|
|
@@ -3138,7 +3141,7 @@ const PathDrawer = {
|
|
|
3138
3141
|
i += 6;
|
|
3139
3142
|
break;
|
|
3140
3143
|
default:
|
|
3141
|
-
debug$
|
|
3144
|
+
debug$a.error(`command: ${command} [index:${i}]`, data);
|
|
3142
3145
|
return;
|
|
3143
3146
|
}
|
|
3144
3147
|
}
|
|
@@ -3147,8 +3150,8 @@ const PathDrawer = {
|
|
|
3147
3150
|
|
|
3148
3151
|
const { M: M$2, L: L$3, C: C$2, Q, Z: Z$2, N, D, X, G, F: F$1, O, P, U } = PathCommandMap;
|
|
3149
3152
|
const { toTwoPointBounds, toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc, ellipse: ellipse$1 } = BezierHelper;
|
|
3150
|
-
const { addPointBounds, copy: copy$8, addPoint
|
|
3151
|
-
const debug$
|
|
3153
|
+
const { addPointBounds, copy: copy$8, addPoint, setPoint, addBounds, toBounds: toBounds$2 } = TwoPointBoundsHelper;
|
|
3154
|
+
const debug$9 = Debug.get('PathBounds');
|
|
3152
3155
|
let radius, radiusX, radiusY;
|
|
3153
3156
|
const tempPointBounds = {};
|
|
3154
3157
|
const setPointBounds = {};
|
|
@@ -3156,21 +3159,21 @@ const setEndPoint = {};
|
|
|
3156
3159
|
const PathBounds = {
|
|
3157
3160
|
toBounds(data, setBounds) {
|
|
3158
3161
|
PathBounds.toTwoPointBounds(data, setPointBounds);
|
|
3159
|
-
toBounds$
|
|
3162
|
+
toBounds$2(setPointBounds, setBounds);
|
|
3160
3163
|
},
|
|
3161
3164
|
toTwoPointBounds(data, setPointBounds) {
|
|
3162
3165
|
if (!data || !data.length)
|
|
3163
|
-
return setPoint
|
|
3166
|
+
return setPoint(setPointBounds, 0, 0);
|
|
3164
3167
|
let i = 0, x = 0, y = 0, x1, y1, toX, toY, command;
|
|
3165
3168
|
const len = data.length;
|
|
3166
3169
|
while (i < len) {
|
|
3167
3170
|
command = data[i];
|
|
3168
3171
|
if (i === 0) {
|
|
3169
3172
|
if (command === Z$2 || command === C$2 || command === Q) {
|
|
3170
|
-
setPoint
|
|
3173
|
+
setPoint(setPointBounds, x, y);
|
|
3171
3174
|
}
|
|
3172
3175
|
else {
|
|
3173
|
-
setPoint
|
|
3176
|
+
setPoint(setPointBounds, data[i + 1], data[i + 2]);
|
|
3174
3177
|
}
|
|
3175
3178
|
}
|
|
3176
3179
|
switch (command) {
|
|
@@ -3178,7 +3181,7 @@ const PathBounds = {
|
|
|
3178
3181
|
case L$3:
|
|
3179
3182
|
x = data[i + 1];
|
|
3180
3183
|
y = data[i + 2];
|
|
3181
|
-
addPoint
|
|
3184
|
+
addPoint(setPointBounds, x, y);
|
|
3182
3185
|
i += 3;
|
|
3183
3186
|
break;
|
|
3184
3187
|
case C$2:
|
|
@@ -3256,7 +3259,7 @@ const PathBounds = {
|
|
|
3256
3259
|
i += 6;
|
|
3257
3260
|
break;
|
|
3258
3261
|
default:
|
|
3259
|
-
debug$
|
|
3262
|
+
debug$9.error(`command: ${command} [index:${i}]`, data);
|
|
3260
3263
|
return;
|
|
3261
3264
|
}
|
|
3262
3265
|
}
|
|
@@ -3372,7 +3375,7 @@ const FileHelper = {
|
|
|
3372
3375
|
const F = FileHelper;
|
|
3373
3376
|
F.opacityTypes.forEach(type => F.upperCaseTypeMap[type] = type.toUpperCase());
|
|
3374
3377
|
|
|
3375
|
-
const debug$
|
|
3378
|
+
const debug$8 = Debug.get('TaskProcessor');
|
|
3376
3379
|
class TaskItem {
|
|
3377
3380
|
constructor(task) {
|
|
3378
3381
|
this.parallel = true;
|
|
@@ -3387,7 +3390,7 @@ class TaskItem {
|
|
|
3387
3390
|
yield this.task();
|
|
3388
3391
|
}
|
|
3389
3392
|
catch (error) {
|
|
3390
|
-
debug$
|
|
3393
|
+
debug$8.error(error);
|
|
3391
3394
|
}
|
|
3392
3395
|
});
|
|
3393
3396
|
}
|
|
@@ -4074,7 +4077,7 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
4074
4077
|
defineKey(data, key, property);
|
|
4075
4078
|
}
|
|
4076
4079
|
|
|
4077
|
-
const debug$
|
|
4080
|
+
const debug$7 = new Debug('rewrite');
|
|
4078
4081
|
const list = [];
|
|
4079
4082
|
const excludeNames = ['destroy', 'constructor'];
|
|
4080
4083
|
function rewrite(method) {
|
|
@@ -4091,7 +4094,7 @@ function doRewrite(error) {
|
|
|
4091
4094
|
if (list.length) {
|
|
4092
4095
|
list.forEach(item => {
|
|
4093
4096
|
if (error)
|
|
4094
|
-
debug$
|
|
4097
|
+
debug$7.error(item.name, '需在Class上装饰@rewriteAble()');
|
|
4095
4098
|
item.run();
|
|
4096
4099
|
});
|
|
4097
4100
|
list.length = 0;
|
|
@@ -4808,7 +4811,6 @@ class LayoutEvent extends Event {
|
|
|
4808
4811
|
}
|
|
4809
4812
|
}
|
|
4810
4813
|
}
|
|
4811
|
-
LayoutEvent.CHECK_UPDATE = 'layout.check_update';
|
|
4812
4814
|
LayoutEvent.REQUEST = 'layout.request';
|
|
4813
4815
|
LayoutEvent.START = 'layout.start';
|
|
4814
4816
|
LayoutEvent.BEFORE = 'layout.before';
|
|
@@ -5003,13 +5005,13 @@ const { on, on_, off, off_, once, emit: emit$2, emitEvent: emitEvent$1, hasEvent
|
|
|
5003
5005
|
const LeafEventer = { on, on_, off, off_, once, emit: emit$2, emitEvent: emitEvent$1, hasEvent, destroyEventer: destroy };
|
|
5004
5006
|
|
|
5005
5007
|
const { isFinite } = Number;
|
|
5006
|
-
const debug$
|
|
5008
|
+
const debug$6 = Debug.get('setAttr');
|
|
5007
5009
|
const LeafDataProxy = {
|
|
5008
5010
|
__setAttr(name, newValue, checkFiniteNumber) {
|
|
5009
5011
|
if (this.leaferIsCreated) {
|
|
5010
5012
|
const oldValue = this.__.__getInput(name);
|
|
5011
5013
|
if (checkFiniteNumber && !isFinite(newValue) && newValue !== undefined) {
|
|
5012
|
-
debug$
|
|
5014
|
+
debug$6.warn(this.innerName, name, newValue);
|
|
5013
5015
|
newValue = undefined;
|
|
5014
5016
|
}
|
|
5015
5017
|
if (typeof newValue === 'object' || oldValue !== newValue) {
|
|
@@ -5079,7 +5081,7 @@ const LeafMatrix = {
|
|
|
5079
5081
|
const { updateMatrix: updateMatrix$2, updateAllMatrix: updateAllMatrix$3 } = LeafHelper;
|
|
5080
5082
|
const { updateBounds: updateBounds$2 } = BranchHelper;
|
|
5081
5083
|
const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$5 } = BoundsHelper;
|
|
5082
|
-
const { toBounds: toBounds$
|
|
5084
|
+
const { toBounds: toBounds$1 } = PathBounds;
|
|
5083
5085
|
const LeafBounds = {
|
|
5084
5086
|
__updateWorldBounds() {
|
|
5085
5087
|
toOuterOf$1(this.__layout.renderBounds, this.__world, this.__world);
|
|
@@ -5161,7 +5163,7 @@ const LeafBounds = {
|
|
|
5161
5163
|
const b = this.__layout.boxBounds;
|
|
5162
5164
|
const data = this.__;
|
|
5163
5165
|
if (data.__pathInputed) {
|
|
5164
|
-
toBounds$
|
|
5166
|
+
toBounds$1(data.path, b);
|
|
5165
5167
|
}
|
|
5166
5168
|
else {
|
|
5167
5169
|
b.x = 0;
|
|
@@ -5709,7 +5711,7 @@ Leaf = __decorate([
|
|
|
5709
5711
|
const { setListWithFn } = BoundsHelper;
|
|
5710
5712
|
const { sort } = BranchHelper;
|
|
5711
5713
|
const { localBoxBounds, localStrokeBounds, localRenderBounds, maskLocalBoxBounds, maskLocalStrokeBounds, maskLocalRenderBounds } = LeafBoundsHelper;
|
|
5712
|
-
const debug$
|
|
5714
|
+
const debug$5 = new Debug('Branch');
|
|
5713
5715
|
let Branch = class Branch extends Leaf {
|
|
5714
5716
|
__updateStrokeSpread() {
|
|
5715
5717
|
const { children } = this;
|
|
@@ -5751,7 +5753,7 @@ let Branch = class Branch extends Leaf {
|
|
|
5751
5753
|
}
|
|
5752
5754
|
add(child, index) {
|
|
5753
5755
|
if (child === this || child.destroyed)
|
|
5754
|
-
return debug$
|
|
5756
|
+
return debug$5.warn('add self or destroyed');
|
|
5755
5757
|
const noIndex = index === undefined;
|
|
5756
5758
|
if (!child.__) {
|
|
5757
5759
|
if (child instanceof Array)
|
|
@@ -6005,7 +6007,7 @@ class LeafLevelList {
|
|
|
6005
6007
|
}
|
|
6006
6008
|
}
|
|
6007
6009
|
|
|
6008
|
-
const version = "1.
|
|
6010
|
+
const version = "1.3.1";
|
|
6009
6011
|
|
|
6010
6012
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6011
6013
|
get allowBackgroundColor() { return true; }
|
|
@@ -6073,6 +6075,7 @@ function useCanvas(_canvasType, _power) {
|
|
|
6073
6075
|
}
|
|
6074
6076
|
Platform.name = 'web';
|
|
6075
6077
|
Platform.isWorker = true;
|
|
6078
|
+
Platform.backgrounder = true;
|
|
6076
6079
|
Platform.requestRender = function (render) { requestAnimationFrame(render); };
|
|
6077
6080
|
defineKey(Platform, 'devicePixelRatio', { get() { return 1; } });
|
|
6078
6081
|
const { userAgent } = navigator;
|
|
@@ -6279,7 +6282,7 @@ class LayoutBlockData {
|
|
|
6279
6282
|
}
|
|
6280
6283
|
|
|
6281
6284
|
const { updateAllMatrix: updateAllMatrix$1, updateAllChange } = LeafHelper;
|
|
6282
|
-
const debug$
|
|
6285
|
+
const debug$4 = Debug.get('Layouter');
|
|
6283
6286
|
class Layouter {
|
|
6284
6287
|
constructor(target, userConfig) {
|
|
6285
6288
|
this.totalTimes = 0;
|
|
@@ -6314,7 +6317,7 @@ class Layouter {
|
|
|
6314
6317
|
target.emitEvent(new LayoutEvent(LayoutEvent.END, this.layoutedBlocks, this.times));
|
|
6315
6318
|
}
|
|
6316
6319
|
catch (e) {
|
|
6317
|
-
debug$
|
|
6320
|
+
debug$4.error(e);
|
|
6318
6321
|
}
|
|
6319
6322
|
this.layoutedBlocks = null;
|
|
6320
6323
|
}
|
|
@@ -6328,9 +6331,9 @@ class Layouter {
|
|
|
6328
6331
|
}
|
|
6329
6332
|
layoutOnce() {
|
|
6330
6333
|
if (this.layouting)
|
|
6331
|
-
return debug$
|
|
6334
|
+
return debug$4.warn('layouting');
|
|
6332
6335
|
if (this.times > 3)
|
|
6333
|
-
return debug$
|
|
6336
|
+
return debug$4.warn('layout max times');
|
|
6334
6337
|
this.times++;
|
|
6335
6338
|
this.totalTimes++;
|
|
6336
6339
|
this.layouting = true;
|
|
@@ -6434,7 +6437,7 @@ class Layouter {
|
|
|
6434
6437
|
}
|
|
6435
6438
|
}
|
|
6436
6439
|
|
|
6437
|
-
const debug$
|
|
6440
|
+
const debug$3 = Debug.get('Renderer');
|
|
6438
6441
|
class Renderer {
|
|
6439
6442
|
get needFill() { return !!(!this.canvas.allowBackgroundColor && this.config.fill); }
|
|
6440
6443
|
constructor(target, canvas, userConfig) {
|
|
@@ -6472,7 +6475,7 @@ class Renderer {
|
|
|
6472
6475
|
const { target } = this;
|
|
6473
6476
|
this.times = 0;
|
|
6474
6477
|
this.totalBounds = new Bounds();
|
|
6475
|
-
debug$
|
|
6478
|
+
debug$3.log(target.innerName, '--->');
|
|
6476
6479
|
try {
|
|
6477
6480
|
if (!target.isApp)
|
|
6478
6481
|
target.app.emit(RenderEvent.CHILD_START, target);
|
|
@@ -6483,9 +6486,9 @@ class Renderer {
|
|
|
6483
6486
|
}
|
|
6484
6487
|
catch (e) {
|
|
6485
6488
|
this.rendering = false;
|
|
6486
|
-
debug$
|
|
6489
|
+
debug$3.error(e);
|
|
6487
6490
|
}
|
|
6488
|
-
debug$
|
|
6491
|
+
debug$3.log('-------------|');
|
|
6489
6492
|
}
|
|
6490
6493
|
renderAgain() {
|
|
6491
6494
|
if (this.rendering) {
|
|
@@ -6497,9 +6500,9 @@ class Renderer {
|
|
|
6497
6500
|
}
|
|
6498
6501
|
renderOnce(callback) {
|
|
6499
6502
|
if (this.rendering)
|
|
6500
|
-
return debug$
|
|
6503
|
+
return debug$3.warn('rendering');
|
|
6501
6504
|
if (this.times > 3)
|
|
6502
|
-
return debug$
|
|
6505
|
+
return debug$3.warn('render max times');
|
|
6503
6506
|
this.times++;
|
|
6504
6507
|
this.totalTimes++;
|
|
6505
6508
|
this.rendering = true;
|
|
@@ -6536,7 +6539,7 @@ class Renderer {
|
|
|
6536
6539
|
partRender() {
|
|
6537
6540
|
const { canvas, updateBlocks: list } = this;
|
|
6538
6541
|
if (!list)
|
|
6539
|
-
return debug$
|
|
6542
|
+
return debug$3.warn('PartRender: need update attr');
|
|
6540
6543
|
this.mergeBlocks();
|
|
6541
6544
|
list.forEach(block => { if (canvas.bounds.hit(block) && !block.isEmpty())
|
|
6542
6545
|
this.clipRender(block); });
|
|
@@ -6639,7 +6642,7 @@ class Renderer {
|
|
|
6639
6642
|
empty = (!leaf.__world.width || !leaf.__world.height);
|
|
6640
6643
|
if (empty) {
|
|
6641
6644
|
if (!leaf.isLeafer)
|
|
6642
|
-
debug$
|
|
6645
|
+
debug$3.tip(leaf.innerName, ': empty');
|
|
6643
6646
|
empty = (!leaf.isBranch || leaf.isBranchLeaf);
|
|
6644
6647
|
}
|
|
6645
6648
|
return empty;
|
|
@@ -6805,143 +6808,26 @@ class Picker {
|
|
|
6805
6808
|
}
|
|
6806
6809
|
}
|
|
6807
6810
|
|
|
6808
|
-
const { Yes, NoAndSkip, YesAndSkip } = Answer;
|
|
6809
|
-
const idCondition = {}, classNameCondition = {}, tagCondition = {};
|
|
6810
6811
|
class Selector {
|
|
6811
6812
|
constructor(target, userConfig) {
|
|
6812
6813
|
this.config = {};
|
|
6813
|
-
this.innerIdMap = {};
|
|
6814
|
-
this.idMap = {};
|
|
6815
|
-
this.methods = {
|
|
6816
|
-
id: (leaf, name) => leaf.id === name ? (this.target && (this.idMap[name] = leaf), 1) : 0,
|
|
6817
|
-
innerId: (leaf, innerId) => leaf.innerId === innerId ? (this.target && (this.innerIdMap[innerId] = leaf), 1) : 0,
|
|
6818
|
-
className: (leaf, name) => leaf.className === name ? 1 : 0,
|
|
6819
|
-
tag: (leaf, name) => leaf.__tag === name ? 1 : 0,
|
|
6820
|
-
tags: (leaf, nameMap) => nameMap[leaf.__tag] ? 1 : 0
|
|
6821
|
-
};
|
|
6822
|
-
this.target = target;
|
|
6823
6814
|
if (userConfig)
|
|
6824
6815
|
this.config = DataHelper.default(userConfig, this.config);
|
|
6825
|
-
this.picker = new Picker(target, this);
|
|
6826
|
-
|
|
6827
|
-
this.__listenEvents();
|
|
6828
|
-
}
|
|
6829
|
-
getBy(condition, branch, one, options) {
|
|
6830
|
-
switch (typeof condition) {
|
|
6831
|
-
case 'number':
|
|
6832
|
-
const leaf = this.getByInnerId(condition, branch);
|
|
6833
|
-
return one ? leaf : (leaf ? [leaf] : []);
|
|
6834
|
-
case 'string':
|
|
6835
|
-
switch (condition[0]) {
|
|
6836
|
-
case '#':
|
|
6837
|
-
idCondition.id = condition.substring(1), condition = idCondition;
|
|
6838
|
-
break;
|
|
6839
|
-
case '.':
|
|
6840
|
-
classNameCondition.className = condition.substring(1), condition = classNameCondition;
|
|
6841
|
-
break;
|
|
6842
|
-
default:
|
|
6843
|
-
tagCondition.tag = condition, condition = tagCondition;
|
|
6844
|
-
}
|
|
6845
|
-
case 'object':
|
|
6846
|
-
if (condition.id !== undefined) {
|
|
6847
|
-
const leaf = this.getById(condition.id, branch);
|
|
6848
|
-
return one ? leaf : (leaf ? [leaf] : []);
|
|
6849
|
-
}
|
|
6850
|
-
else if (condition.tag) {
|
|
6851
|
-
const { tag } = condition, isArray = tag instanceof Array;
|
|
6852
|
-
return this.getByMethod(isArray ? this.methods.tags : this.methods.tag, branch, one, isArray ? DataHelper.toMap(tag) : tag);
|
|
6853
|
-
}
|
|
6854
|
-
else {
|
|
6855
|
-
return this.getByMethod(this.methods.className, branch, one, condition.className);
|
|
6856
|
-
}
|
|
6857
|
-
case 'function':
|
|
6858
|
-
return this.getByMethod(condition, branch, one, options);
|
|
6859
|
-
}
|
|
6816
|
+
this.picker = new Picker(this.target = target, this);
|
|
6817
|
+
this.finder = Creator.finder && Creator.finder();
|
|
6860
6818
|
}
|
|
6861
6819
|
getByPoint(hitPoint, hitRadius, options) {
|
|
6862
|
-
if (Platform.
|
|
6863
|
-
this.target.
|
|
6820
|
+
if (Platform.backgrounder && this.target)
|
|
6821
|
+
this.target.updateLayout();
|
|
6864
6822
|
return this.picker.getByPoint(hitPoint, hitRadius, options);
|
|
6865
6823
|
}
|
|
6866
|
-
|
|
6867
|
-
|
|
6868
|
-
if (cache)
|
|
6869
|
-
return cache;
|
|
6870
|
-
this.eachFind(this.toChildren(branch), this.methods.innerId, null, innerId);
|
|
6871
|
-
return this.findLeaf;
|
|
6872
|
-
}
|
|
6873
|
-
getById(id, branch) {
|
|
6874
|
-
const cache = this.idMap[id];
|
|
6875
|
-
if (cache && LeafHelper.hasParent(cache, branch || this.target))
|
|
6876
|
-
return cache;
|
|
6877
|
-
this.eachFind(this.toChildren(branch), this.methods.id, null, id);
|
|
6878
|
-
return this.findLeaf;
|
|
6879
|
-
}
|
|
6880
|
-
getByClassName(className, branch) {
|
|
6881
|
-
return this.getByMethod(this.methods.className, branch, false, className);
|
|
6882
|
-
}
|
|
6883
|
-
getByTag(tag, branch) {
|
|
6884
|
-
return this.getByMethod(this.methods.tag, branch, false, tag);
|
|
6885
|
-
}
|
|
6886
|
-
getByMethod(method, branch, one, options) {
|
|
6887
|
-
const list = one ? null : [];
|
|
6888
|
-
this.eachFind(this.toChildren(branch), method, list, options);
|
|
6889
|
-
return list || this.findLeaf;
|
|
6890
|
-
}
|
|
6891
|
-
eachFind(children, method, list, options) {
|
|
6892
|
-
let child, result;
|
|
6893
|
-
for (let i = 0, len = children.length; i < len; i++) {
|
|
6894
|
-
child = children[i];
|
|
6895
|
-
result = method(child, options);
|
|
6896
|
-
if (result === Yes || result === YesAndSkip) {
|
|
6897
|
-
if (list) {
|
|
6898
|
-
list.push(child);
|
|
6899
|
-
}
|
|
6900
|
-
else {
|
|
6901
|
-
this.findLeaf = child;
|
|
6902
|
-
return;
|
|
6903
|
-
}
|
|
6904
|
-
}
|
|
6905
|
-
if (child.isBranch && result < NoAndSkip)
|
|
6906
|
-
this.eachFind(child.children, method, list, options);
|
|
6907
|
-
}
|
|
6908
|
-
}
|
|
6909
|
-
toChildren(branch) {
|
|
6910
|
-
this.findLeaf = null;
|
|
6911
|
-
return [branch || this.target];
|
|
6912
|
-
}
|
|
6913
|
-
__onRemoveChild(event) {
|
|
6914
|
-
const { id, innerId } = event.child;
|
|
6915
|
-
if (this.idMap[id])
|
|
6916
|
-
delete this.idMap[id];
|
|
6917
|
-
if (this.innerIdMap[innerId])
|
|
6918
|
-
delete this.innerIdMap[innerId];
|
|
6919
|
-
}
|
|
6920
|
-
__checkIdChange(event) {
|
|
6921
|
-
if (event.attrName === 'id') {
|
|
6922
|
-
const id = event.oldValue;
|
|
6923
|
-
if (this.idMap[id])
|
|
6924
|
-
delete this.idMap[id];
|
|
6925
|
-
}
|
|
6926
|
-
}
|
|
6927
|
-
__listenEvents() {
|
|
6928
|
-
this.__eventIds = [
|
|
6929
|
-
this.target.on_(ChildEvent.REMOVE, this.__onRemoveChild, this),
|
|
6930
|
-
this.target.on_(PropertyEvent.CHANGE, this.__checkIdChange, this)
|
|
6931
|
-
];
|
|
6932
|
-
}
|
|
6933
|
-
__removeListenEvents() {
|
|
6934
|
-
this.target.off_(this.__eventIds);
|
|
6935
|
-
this.__eventIds.length = 0;
|
|
6824
|
+
getBy(condition, branch, one, options) {
|
|
6825
|
+
return this.finder ? this.finder.getBy(condition, branch, one, options) : Plugin.need('find');
|
|
6936
6826
|
}
|
|
6937
6827
|
destroy() {
|
|
6938
|
-
|
|
6939
|
-
|
|
6940
|
-
this.
|
|
6941
|
-
this.findLeaf = null;
|
|
6942
|
-
this.innerIdMap = {};
|
|
6943
|
-
this.idMap = {};
|
|
6944
|
-
}
|
|
6828
|
+
this.picker.destroy();
|
|
6829
|
+
if (this.finder)
|
|
6830
|
+
this.finder.destroy();
|
|
6945
6831
|
}
|
|
6946
6832
|
}
|
|
6947
6833
|
|
|
@@ -7014,7 +6900,7 @@ const Transition = {
|
|
|
7014
6900
|
|
|
7015
6901
|
const { parse, objectToCanvasData } = PathConvert;
|
|
7016
6902
|
const emptyPaint = {};
|
|
7017
|
-
const debug$
|
|
6903
|
+
const debug$2 = Debug.get('UIData');
|
|
7018
6904
|
class UIData extends LeafData {
|
|
7019
6905
|
get scale() { const { scaleX, scaleY } = this; return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX; }
|
|
7020
6906
|
get __strokeWidth() {
|
|
@@ -7051,7 +6937,7 @@ class UIData extends LeafData {
|
|
|
7051
6937
|
if (value < 0) {
|
|
7052
6938
|
this._width = -value;
|
|
7053
6939
|
this.__leaf.scaleX *= -1;
|
|
7054
|
-
debug$
|
|
6940
|
+
debug$2.warn('width < 0, instead -scaleX ', this);
|
|
7055
6941
|
}
|
|
7056
6942
|
else
|
|
7057
6943
|
this._width = value;
|
|
@@ -7060,7 +6946,7 @@ class UIData extends LeafData {
|
|
|
7060
6946
|
if (value < 0) {
|
|
7061
6947
|
this._height = -value;
|
|
7062
6948
|
this.__leaf.scaleY *= -1;
|
|
7063
|
-
debug$
|
|
6949
|
+
debug$2.warn('height < 0, instead -scaleY', this);
|
|
7064
6950
|
}
|
|
7065
6951
|
else
|
|
7066
6952
|
this._height = value;
|
|
@@ -7437,25 +7323,27 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7437
7323
|
}
|
|
7438
7324
|
reset(_data) { }
|
|
7439
7325
|
set(data, transition) {
|
|
7440
|
-
if (
|
|
7441
|
-
if (transition
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7326
|
+
if (data) {
|
|
7327
|
+
if (transition) {
|
|
7328
|
+
if (transition === 'temp') {
|
|
7329
|
+
this.lockNormalStyle = true;
|
|
7330
|
+
Object.assign(this, data);
|
|
7331
|
+
this.lockNormalStyle = false;
|
|
7332
|
+
}
|
|
7333
|
+
else
|
|
7334
|
+
this.animate(data, transition);
|
|
7445
7335
|
}
|
|
7446
7336
|
else
|
|
7447
|
-
|
|
7337
|
+
Object.assign(this, data);
|
|
7448
7338
|
}
|
|
7449
|
-
else
|
|
7450
|
-
Object.assign(this, data);
|
|
7451
7339
|
}
|
|
7452
7340
|
get(name) {
|
|
7453
7341
|
return typeof name === 'string' ? this.__.__getInput(name) : this.__.__getInputData(name);
|
|
7454
7342
|
}
|
|
7455
7343
|
createProxyData() { return undefined; }
|
|
7456
|
-
find(_condition, _options) { return
|
|
7344
|
+
find(_condition, _options) { return Plugin.need('find'); }
|
|
7457
7345
|
findTag(tag) { return this.find({ tag }); }
|
|
7458
|
-
findOne(_condition, _options) { return
|
|
7346
|
+
findOne(_condition, _options) { return Plugin.need('find'); }
|
|
7459
7347
|
findId(id) { return this.findOne({ id }); }
|
|
7460
7348
|
getPath(curve, pathForRender) {
|
|
7461
7349
|
this.__layout.update();
|
|
@@ -7507,9 +7395,9 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7507
7395
|
animate(_keyframe, _options, _type, _isTemp) {
|
|
7508
7396
|
return Plugin.need('animate');
|
|
7509
7397
|
}
|
|
7510
|
-
killAnimate(_type) { }
|
|
7511
|
-
export(
|
|
7512
|
-
return
|
|
7398
|
+
killAnimate(_type, _killStyle) { }
|
|
7399
|
+
export(_filename, _options) {
|
|
7400
|
+
return Plugin.need('export');
|
|
7513
7401
|
}
|
|
7514
7402
|
clone(data) {
|
|
7515
7403
|
const json = this.toJSON();
|
|
@@ -7755,16 +7643,18 @@ let Group = class Group extends UI {
|
|
|
7755
7643
|
this.children = [];
|
|
7756
7644
|
}
|
|
7757
7645
|
set(data, transition) {
|
|
7758
|
-
if (data
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
|
|
7646
|
+
if (data) {
|
|
7647
|
+
if (data.children) {
|
|
7648
|
+
const { children } = data;
|
|
7649
|
+
delete data.children;
|
|
7650
|
+
this.children ? this.clear() : this.__setBranch();
|
|
7651
|
+
super.set(data, transition);
|
|
7652
|
+
children.forEach(child => this.add(child));
|
|
7653
|
+
data.children = children;
|
|
7654
|
+
}
|
|
7655
|
+
else
|
|
7656
|
+
super.set(data, transition);
|
|
7765
7657
|
}
|
|
7766
|
-
else
|
|
7767
|
-
super.set(data, transition);
|
|
7768
7658
|
}
|
|
7769
7659
|
toJSON(options) {
|
|
7770
7660
|
const data = super.toJSON(options);
|
|
@@ -7796,7 +7686,7 @@ Group = __decorate([
|
|
|
7796
7686
|
], Group);
|
|
7797
7687
|
|
|
7798
7688
|
var Leafer_1;
|
|
7799
|
-
const debug$
|
|
7689
|
+
const debug$1 = Debug.get('Leafer');
|
|
7800
7690
|
let Leafer = Leafer_1 = class Leafer extends Group {
|
|
7801
7691
|
get __tag() { return 'Leafer'; }
|
|
7802
7692
|
get isApp() { return false; }
|
|
@@ -7961,7 +7851,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7961
7851
|
if (this.canvas) {
|
|
7962
7852
|
if (canvasSizeAttrs.includes(attrName)) {
|
|
7963
7853
|
if (!newValue)
|
|
7964
|
-
debug$
|
|
7854
|
+
debug$1.warn(attrName + ' is 0');
|
|
7965
7855
|
this.__changeCanvasSize(attrName, newValue);
|
|
7966
7856
|
}
|
|
7967
7857
|
else if (attrName === 'fill') {
|
|
@@ -8102,9 +7992,6 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8102
7992
|
this.canvas && this.canvas.updateClientBounds();
|
|
8103
7993
|
}
|
|
8104
7994
|
receiveEvent(_event) { }
|
|
8105
|
-
__checkUpdateLayout() {
|
|
8106
|
-
this.__layout.update();
|
|
8107
|
-
}
|
|
8108
7995
|
emitLeafer(type) {
|
|
8109
7996
|
this.emitEvent(new LeaferEvent(type, this));
|
|
8110
7997
|
}
|
|
@@ -8115,7 +8002,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8115
8002
|
this.once(LayoutEvent.END, () => this.__onReady());
|
|
8116
8003
|
this.once(RenderEvent.START, () => this.__onCreated());
|
|
8117
8004
|
this.once(RenderEvent.END, () => this.__onViewReady());
|
|
8118
|
-
this.__eventIds.push(this.on_(WatchEvent.DATA, this.__onWatchData, this), this.on_(RenderEvent.NEXT, this.__onNextRender, this)
|
|
8005
|
+
this.__eventIds.push(this.on_(WatchEvent.DATA, this.__onWatchData, this), this.on_(RenderEvent.NEXT, this.__onNextRender, this));
|
|
8119
8006
|
}
|
|
8120
8007
|
__removeListenEvents() {
|
|
8121
8008
|
this.off_(this.__eventIds);
|
|
@@ -8146,7 +8033,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8146
8033
|
setTimeout(() => { ImageManager.clearRecycled(); }, 100);
|
|
8147
8034
|
}
|
|
8148
8035
|
catch (e) {
|
|
8149
|
-
debug$
|
|
8036
|
+
debug$1.error(e);
|
|
8150
8037
|
}
|
|
8151
8038
|
}
|
|
8152
8039
|
};
|
|
@@ -8180,7 +8067,7 @@ Rect = __decorate([
|
|
|
8180
8067
|
], Rect);
|
|
8181
8068
|
|
|
8182
8069
|
const { copy: copy$3, add, includes: includes$1 } = BoundsHelper;
|
|
8183
|
-
const rect$1 = Rect.prototype, group
|
|
8070
|
+
const rect$1 = Rect.prototype, group = Group.prototype;
|
|
8184
8071
|
const childrenRenderBounds = {};
|
|
8185
8072
|
let Box = class Box extends Group {
|
|
8186
8073
|
get __tag() { return 'Box'; }
|
|
@@ -8290,7 +8177,7 @@ __decorate([
|
|
|
8290
8177
|
rewrite(rect$1.__render)
|
|
8291
8178
|
], Box.prototype, "__renderRect", null);
|
|
8292
8179
|
__decorate([
|
|
8293
|
-
rewrite(group
|
|
8180
|
+
rewrite(group.__render)
|
|
8294
8181
|
], Box.prototype, "__renderGroup", null);
|
|
8295
8182
|
Box = __decorate([
|
|
8296
8183
|
rewriteAble(),
|
|
@@ -8375,7 +8262,7 @@ Ellipse = __decorate([
|
|
|
8375
8262
|
|
|
8376
8263
|
const { moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1 } = PathCommandDataHelper;
|
|
8377
8264
|
const { rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$3, defaultPoint } = PointHelper;
|
|
8378
|
-
const { toBounds
|
|
8265
|
+
const { toBounds } = PathBounds;
|
|
8379
8266
|
let Line = class Line extends UI {
|
|
8380
8267
|
get __tag() { return 'Line'; }
|
|
8381
8268
|
get toPoint() {
|
|
@@ -8419,7 +8306,7 @@ let Line = class Line extends UI {
|
|
|
8419
8306
|
}
|
|
8420
8307
|
__updateBoxBounds() {
|
|
8421
8308
|
if (this.points) {
|
|
8422
|
-
toBounds
|
|
8309
|
+
toBounds(this.__.__pathForRender, this.__layout.boxBounds);
|
|
8423
8310
|
}
|
|
8424
8311
|
else
|
|
8425
8312
|
super.__updateBoxBounds();
|
|
@@ -8771,6 +8658,9 @@ __decorate([
|
|
|
8771
8658
|
__decorate([
|
|
8772
8659
|
boundsType(0)
|
|
8773
8660
|
], Text.prototype, "paraSpacing", void 0);
|
|
8661
|
+
__decorate([
|
|
8662
|
+
boundsType('x')
|
|
8663
|
+
], Text.prototype, "writingMode", void 0);
|
|
8774
8664
|
__decorate([
|
|
8775
8665
|
boundsType('left')
|
|
8776
8666
|
], Text.prototype, "textAlign", void 0);
|
|
@@ -8957,8 +8847,8 @@ let App = class App extends Leafer {
|
|
|
8957
8847
|
this.children.forEach(leafer => leafer.resize(event));
|
|
8958
8848
|
super.__onResize(event);
|
|
8959
8849
|
}
|
|
8960
|
-
|
|
8961
|
-
this.children.forEach(leafer => leafer.
|
|
8850
|
+
updateLayout() {
|
|
8851
|
+
this.children.forEach(leafer => leafer.updateLayout());
|
|
8962
8852
|
}
|
|
8963
8853
|
__getChildConfig(userConfig) {
|
|
8964
8854
|
let config = Object.assign({}, this.config);
|
|
@@ -9448,7 +9338,7 @@ class Dragger {
|
|
|
9448
9338
|
}
|
|
9449
9339
|
}
|
|
9450
9340
|
|
|
9451
|
-
const debug
|
|
9341
|
+
const debug = Debug.get('emit');
|
|
9452
9342
|
function emit$1(type, data, path, excludePath) {
|
|
9453
9343
|
if (!path && !data.path)
|
|
9454
9344
|
return;
|
|
@@ -9478,7 +9368,7 @@ function emit$1(type, data, path, excludePath) {
|
|
|
9478
9368
|
}
|
|
9479
9369
|
}
|
|
9480
9370
|
catch (e) {
|
|
9481
|
-
debug
|
|
9371
|
+
debug.error(e);
|
|
9482
9372
|
}
|
|
9483
9373
|
}
|
|
9484
9374
|
const allowTypes = ['move', 'zoom', 'rotate', 'key'];
|
|
@@ -10114,32 +10004,24 @@ rect.__hitFill = box$1.__hitFill = function (inner) {
|
|
|
10114
10004
|
return this.__hitCanvas ? ui$4.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
|
|
10115
10005
|
};
|
|
10116
10006
|
|
|
10117
|
-
|
|
10118
|
-
function getSelector(ui) {
|
|
10007
|
+
function getSelector$1(ui) {
|
|
10119
10008
|
return ui.leafer ? ui.leafer.selector : (Platform.selector || (Platform.selector = Creator.selector()));
|
|
10120
10009
|
}
|
|
10121
|
-
|
|
10122
|
-
|
|
10123
|
-
|
|
10124
|
-
|
|
10125
|
-
return getSelector(this).getBy(condition, this, true, options);
|
|
10126
|
-
};
|
|
10127
|
-
group.pick = function (hitPoint, options) {
|
|
10128
|
-
this.__layout.update();
|
|
10129
|
-
if (!options)
|
|
10130
|
-
options = {};
|
|
10131
|
-
return getSelector(this).getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this }));
|
|
10010
|
+
Group.prototype.pick = function (hitPoint, options) {
|
|
10011
|
+
this.leafer || this.updateLayout();
|
|
10012
|
+
options || (options = emptyData);
|
|
10013
|
+
return getSelector$1(this).getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this }));
|
|
10132
10014
|
};
|
|
10133
10015
|
|
|
10134
|
-
const canvas
|
|
10135
|
-
canvas
|
|
10016
|
+
const canvas = LeaferCanvasBase.prototype;
|
|
10017
|
+
canvas.hitFill = function (point, fillRule) {
|
|
10136
10018
|
return fillRule ? this.context.isPointInPath(point.x, point.y, fillRule) : this.context.isPointInPath(point.x, point.y);
|
|
10137
10019
|
};
|
|
10138
|
-
canvas
|
|
10020
|
+
canvas.hitStroke = function (point, strokeWidth) {
|
|
10139
10021
|
this.strokeWidth = strokeWidth;
|
|
10140
10022
|
return this.context.isPointInStroke(point.x, point.y);
|
|
10141
10023
|
};
|
|
10142
|
-
canvas
|
|
10024
|
+
canvas.hitPixel = function (radiusPoint, offset, scale = 1) {
|
|
10143
10025
|
let { x, y, radiusX, radiusY } = radiusPoint;
|
|
10144
10026
|
if (offset)
|
|
10145
10027
|
x -= offset.x, y -= offset.y;
|
|
@@ -11631,197 +11513,12 @@ const ColorConvertModule = {
|
|
|
11631
11513
|
string
|
|
11632
11514
|
};
|
|
11633
11515
|
|
|
11634
|
-
const { setPoint, addPoint, toBounds } = TwoPointBoundsHelper;
|
|
11635
|
-
function getTrimBounds(canvas) {
|
|
11636
|
-
const { width, height } = canvas.view;
|
|
11637
|
-
const { data } = canvas.context.getImageData(0, 0, width, height);
|
|
11638
|
-
let x, y, pointBounds, index = 0;
|
|
11639
|
-
for (let i = 0; i < data.length; i += 4) {
|
|
11640
|
-
if (data[i + 3] !== 0) {
|
|
11641
|
-
x = index % width;
|
|
11642
|
-
y = (index - x) / width;
|
|
11643
|
-
pointBounds ? addPoint(pointBounds, x, y) : setPoint(pointBounds = {}, x, y);
|
|
11644
|
-
}
|
|
11645
|
-
index++;
|
|
11646
|
-
}
|
|
11647
|
-
const bounds = new Bounds();
|
|
11648
|
-
toBounds(pointBounds, bounds);
|
|
11649
|
-
return bounds.scale(1 / canvas.pixelRatio).ceil();
|
|
11650
|
-
}
|
|
11651
|
-
|
|
11652
|
-
const ExportModule = {
|
|
11653
|
-
export(leaf, filename, options) {
|
|
11654
|
-
this.running = true;
|
|
11655
|
-
const fileType = FileHelper.fileType(filename);
|
|
11656
|
-
const isDownload = filename.includes('.');
|
|
11657
|
-
options = FileHelper.getExportOptions(options);
|
|
11658
|
-
return addTask((success) => new Promise((resolve) => {
|
|
11659
|
-
const over = (result) => {
|
|
11660
|
-
success(result);
|
|
11661
|
-
resolve();
|
|
11662
|
-
this.running = false;
|
|
11663
|
-
};
|
|
11664
|
-
const { toURL } = Platform;
|
|
11665
|
-
const { download } = Platform.origin;
|
|
11666
|
-
if (fileType === 'json') {
|
|
11667
|
-
isDownload && download(toURL(JSON.stringify(leaf.toJSON(options.json)), 'text'), filename);
|
|
11668
|
-
return over({ data: isDownload ? true : leaf.toJSON(options.json) });
|
|
11669
|
-
}
|
|
11670
|
-
if (fileType === 'svg') {
|
|
11671
|
-
isDownload && download(toURL(leaf.toSVG(), 'svg'), filename);
|
|
11672
|
-
return over({ data: isDownload ? true : leaf.toSVG() });
|
|
11673
|
-
}
|
|
11674
|
-
const { leafer } = leaf;
|
|
11675
|
-
if (leafer) {
|
|
11676
|
-
checkLazy(leaf);
|
|
11677
|
-
leafer.waitViewCompleted(() => __awaiter(this, void 0, void 0, function* () {
|
|
11678
|
-
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
11679
|
-
const { worldTransform, isLeafer, isFrame } = leaf;
|
|
11680
|
-
const { slice, trim, onCanvas } = options;
|
|
11681
|
-
const smooth = options.smooth === undefined ? leafer.config.smooth : options.smooth;
|
|
11682
|
-
const contextSettings = options.contextSettings || leafer.config.contextSettings;
|
|
11683
|
-
const screenshot = options.screenshot || leaf.isApp;
|
|
11684
|
-
const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill : options.fill) : options.fill;
|
|
11685
|
-
const needFill = FileHelper.isOpaqueImage(filename) || fill, matrix = new Matrix();
|
|
11686
|
-
if (screenshot) {
|
|
11687
|
-
renderBounds = screenshot === true ? (isLeafer ? leafer.canvas.bounds : leaf.worldRenderBounds) : screenshot;
|
|
11688
|
-
}
|
|
11689
|
-
else {
|
|
11690
|
-
let relative = options.relative || (isLeafer ? 'inner' : 'local');
|
|
11691
|
-
scaleX = worldTransform.scaleX;
|
|
11692
|
-
scaleY = worldTransform.scaleY;
|
|
11693
|
-
switch (relative) {
|
|
11694
|
-
case 'inner':
|
|
11695
|
-
matrix.set(worldTransform);
|
|
11696
|
-
break;
|
|
11697
|
-
case 'local':
|
|
11698
|
-
matrix.set(worldTransform).divide(leaf.localTransform);
|
|
11699
|
-
scaleX /= leaf.scaleX;
|
|
11700
|
-
scaleY /= leaf.scaleY;
|
|
11701
|
-
break;
|
|
11702
|
-
case 'world':
|
|
11703
|
-
scaleX = 1;
|
|
11704
|
-
scaleY = 1;
|
|
11705
|
-
break;
|
|
11706
|
-
case 'page':
|
|
11707
|
-
relative = leaf.leafer;
|
|
11708
|
-
default:
|
|
11709
|
-
matrix.set(worldTransform).divide(leaf.getTransform(relative));
|
|
11710
|
-
const l = relative.worldTransform;
|
|
11711
|
-
scaleX /= scaleX / l.scaleX;
|
|
11712
|
-
scaleY /= scaleY / l.scaleY;
|
|
11713
|
-
}
|
|
11714
|
-
renderBounds = leaf.getBounds('render', relative);
|
|
11715
|
-
}
|
|
11716
|
-
const scaleData = { scaleX: 1, scaleY: 1 };
|
|
11717
|
-
MathHelper.getScaleData(options.scale, options.size, renderBounds, scaleData);
|
|
11718
|
-
let pixelRatio = options.pixelRatio || 1;
|
|
11719
|
-
if (leaf.isApp) {
|
|
11720
|
-
scaleData.scaleX *= pixelRatio;
|
|
11721
|
-
scaleData.scaleY *= pixelRatio;
|
|
11722
|
-
pixelRatio = leaf.app.pixelRatio;
|
|
11723
|
-
}
|
|
11724
|
-
const { x, y, width, height } = new Bounds(renderBounds).scale(scaleData.scaleX, scaleData.scaleY);
|
|
11725
|
-
const renderOptions = { matrix: matrix.scale(1 / scaleData.scaleX, 1 / scaleData.scaleY).invert().translate(-x, -y).withScale(1 / scaleX * scaleData.scaleX, 1 / scaleY * scaleData.scaleY) };
|
|
11726
|
-
let canvas = Creator.canvas({ width: Math.round(width), height: Math.round(height), pixelRatio, smooth, contextSettings });
|
|
11727
|
-
let sliceLeaf;
|
|
11728
|
-
if (slice) {
|
|
11729
|
-
sliceLeaf = leaf;
|
|
11730
|
-
sliceLeaf.__worldOpacity = 0;
|
|
11731
|
-
leaf = leafer;
|
|
11732
|
-
renderOptions.bounds = canvas.bounds;
|
|
11733
|
-
}
|
|
11734
|
-
canvas.save();
|
|
11735
|
-
if (isFrame && fill !== undefined) {
|
|
11736
|
-
const oldFill = leaf.get('fill');
|
|
11737
|
-
leaf.fill = '';
|
|
11738
|
-
leaf.__render(canvas, renderOptions);
|
|
11739
|
-
leaf.fill = oldFill;
|
|
11740
|
-
}
|
|
11741
|
-
else {
|
|
11742
|
-
leaf.__render(canvas, renderOptions);
|
|
11743
|
-
}
|
|
11744
|
-
canvas.restore();
|
|
11745
|
-
if (sliceLeaf)
|
|
11746
|
-
sliceLeaf.__updateWorldOpacity();
|
|
11747
|
-
if (trim) {
|
|
11748
|
-
trimBounds = getTrimBounds(canvas);
|
|
11749
|
-
const old = canvas, { width, height } = trimBounds;
|
|
11750
|
-
const config = { x: 0, y: 0, width, height, pixelRatio };
|
|
11751
|
-
canvas = Creator.canvas(config);
|
|
11752
|
-
canvas.copyWorld(old, trimBounds, config);
|
|
11753
|
-
}
|
|
11754
|
-
if (needFill)
|
|
11755
|
-
canvas.fillWorld(canvas.bounds, fill || '#FFFFFF', 'destination-over');
|
|
11756
|
-
if (onCanvas)
|
|
11757
|
-
onCanvas(canvas);
|
|
11758
|
-
const data = filename === 'canvas' ? canvas : yield canvas.export(filename, options);
|
|
11759
|
-
over({ data, width: canvas.pixelWidth, height: canvas.pixelHeight, renderBounds, trimBounds });
|
|
11760
|
-
}));
|
|
11761
|
-
}
|
|
11762
|
-
else {
|
|
11763
|
-
over({ data: false });
|
|
11764
|
-
}
|
|
11765
|
-
}));
|
|
11766
|
-
}
|
|
11767
|
-
};
|
|
11768
|
-
let tasker;
|
|
11769
|
-
function addTask(task) {
|
|
11770
|
-
if (!tasker)
|
|
11771
|
-
tasker = new TaskProcessor();
|
|
11772
|
-
return new Promise((resolve) => {
|
|
11773
|
-
tasker.add(() => __awaiter(this, void 0, void 0, function* () { return yield task(resolve); }), { parallel: false });
|
|
11774
|
-
});
|
|
11775
|
-
}
|
|
11776
|
-
function checkLazy(leaf) {
|
|
11777
|
-
if (leaf.__.__needComputePaint)
|
|
11778
|
-
leaf.__.__computePaint();
|
|
11779
|
-
if (leaf.isBranch)
|
|
11780
|
-
leaf.children.forEach(child => checkLazy(child));
|
|
11781
|
-
}
|
|
11782
|
-
|
|
11783
|
-
const canvas = LeaferCanvasBase.prototype;
|
|
11784
|
-
const debug = Debug.get('@leafer-ui/export');
|
|
11785
|
-
canvas.export = function (filename, options) {
|
|
11786
|
-
const { quality, blob } = FileHelper.getExportOptions(options);
|
|
11787
|
-
if (filename.includes('.'))
|
|
11788
|
-
return this.saveAs(filename, quality);
|
|
11789
|
-
else if (blob)
|
|
11790
|
-
return this.toBlob(filename, quality);
|
|
11791
|
-
else
|
|
11792
|
-
return this.toDataURL(filename, quality);
|
|
11793
|
-
};
|
|
11794
|
-
canvas.toBlob = function (type, quality) {
|
|
11795
|
-
return new Promise((resolve) => {
|
|
11796
|
-
Platform.origin.canvasToBolb(this.view, type, quality).then((blob) => {
|
|
11797
|
-
resolve(blob);
|
|
11798
|
-
}).catch((e) => {
|
|
11799
|
-
debug.error(e);
|
|
11800
|
-
resolve(null);
|
|
11801
|
-
});
|
|
11802
|
-
});
|
|
11803
|
-
};
|
|
11804
|
-
canvas.toDataURL = function (type, quality) {
|
|
11805
|
-
return Platform.origin.canvasToDataURL(this.view, type, quality);
|
|
11806
|
-
};
|
|
11807
|
-
canvas.saveAs = function (filename, quality) {
|
|
11808
|
-
return new Promise((resolve) => {
|
|
11809
|
-
Platform.origin.canvasSaveAs(this.view, filename, quality).then(() => {
|
|
11810
|
-
resolve(true);
|
|
11811
|
-
}).catch((e) => {
|
|
11812
|
-
debug.error(e);
|
|
11813
|
-
resolve(false);
|
|
11814
|
-
});
|
|
11815
|
-
});
|
|
11816
|
-
};
|
|
11817
|
-
|
|
11818
11516
|
Object.assign(TextConvert, TextConvertModule);
|
|
11819
11517
|
Object.assign(ColorConvert, ColorConvertModule);
|
|
11820
11518
|
Object.assign(Paint, PaintModule);
|
|
11821
11519
|
Object.assign(PaintImage, PaintImageModule);
|
|
11822
11520
|
Object.assign(PaintGradient, PaintGradientModule);
|
|
11823
11521
|
Object.assign(Effect, EffectModule);
|
|
11824
|
-
Object.assign(Export, ExportModule);
|
|
11825
11522
|
|
|
11826
11523
|
Object.assign(Creator, {
|
|
11827
11524
|
interaction: (target, canvas, selector, options) => new InteractionBase(target, canvas, selector, options),
|
|
@@ -12284,19 +11981,19 @@ State.set = function (leaf, stateName) { const style = leaf.states[stateName]; s
|
|
|
12284
11981
|
State.getStyle = getStyle;
|
|
12285
11982
|
State.updateStyle = updateStyle;
|
|
12286
11983
|
State.updateEventStyle = updateEventStyle;
|
|
12287
|
-
const ui$
|
|
12288
|
-
stateType(false, 'selectedStyle')(ui$
|
|
12289
|
-
stateType(false, 'disabledStyle')(ui$
|
|
12290
|
-
stateStyleType({})(ui$
|
|
12291
|
-
stateType('')(ui$
|
|
12292
|
-
dataType()(ui$
|
|
12293
|
-
stateStyleType()(ui$
|
|
12294
|
-
stateStyleType()(ui$
|
|
12295
|
-
stateStyleType()(ui$
|
|
12296
|
-
stateStyleType()(ui$
|
|
12297
|
-
stateStyleType()(ui$
|
|
12298
|
-
dataType(false)(ui$
|
|
12299
|
-
ui$
|
|
11984
|
+
const ui$3 = UI.prototype;
|
|
11985
|
+
stateType(false, 'selectedStyle')(ui$3, 'selected');
|
|
11986
|
+
stateType(false, 'disabledStyle')(ui$3, 'disabled');
|
|
11987
|
+
stateStyleType({})(ui$3, 'states');
|
|
11988
|
+
stateType('')(ui$3, 'state');
|
|
11989
|
+
dataType()(ui$3, 'normalStyle');
|
|
11990
|
+
stateStyleType()(ui$3, 'hoverStyle');
|
|
11991
|
+
stateStyleType()(ui$3, 'pressStyle');
|
|
11992
|
+
stateStyleType()(ui$3, 'focusStyle');
|
|
11993
|
+
stateStyleType()(ui$3, 'selectedStyle');
|
|
11994
|
+
stateStyleType()(ui$3, 'disabledStyle');
|
|
11995
|
+
dataType(false)(ui$3, 'button');
|
|
11996
|
+
ui$3.focus = function (value = true) {
|
|
12300
11997
|
this.waitLeafer(() => {
|
|
12301
11998
|
let { focusData } = this.app.interaction;
|
|
12302
11999
|
if (value) {
|
|
@@ -12310,7 +12007,7 @@ ui$2.focus = function (value = true) {
|
|
|
12310
12007
|
value ? setPointerState(this, 'focusStyle') : unsetPointerState(this, 'focusStyle');
|
|
12311
12008
|
});
|
|
12312
12009
|
};
|
|
12313
|
-
ui$
|
|
12010
|
+
ui$3.updateState = function () {
|
|
12314
12011
|
State.updateStyle(this, undefined, 'in');
|
|
12315
12012
|
};
|
|
12316
12013
|
|
|
@@ -12526,7 +12223,6 @@ let Animate = class Animate extends Eventer {
|
|
|
12526
12223
|
stop() {
|
|
12527
12224
|
if (this.destroyed)
|
|
12528
12225
|
return;
|
|
12529
|
-
this.end();
|
|
12530
12226
|
this.complete();
|
|
12531
12227
|
this.emit(AnimateEvent.STOP, this);
|
|
12532
12228
|
}
|
|
@@ -12544,8 +12240,9 @@ let Animate = class Animate extends Eventer {
|
|
|
12544
12240
|
this.clearTimer(() => this.requestAnimate());
|
|
12545
12241
|
this.emit(AnimateEvent.SEEK, this);
|
|
12546
12242
|
}
|
|
12547
|
-
kill() {
|
|
12548
|
-
this.
|
|
12243
|
+
kill(complete = true, killStyle) {
|
|
12244
|
+
this.killStyle = killStyle;
|
|
12245
|
+
this.destroy(complete);
|
|
12549
12246
|
}
|
|
12550
12247
|
create() {
|
|
12551
12248
|
const { target, frames, keyframes, config } = this, { length } = keyframes, joinBefore = length > 1 ? this.join : true;
|
|
@@ -12716,11 +12413,12 @@ let Animate = class Animate extends Eventer {
|
|
|
12716
12413
|
complete() {
|
|
12717
12414
|
this.requestAnimateTime = 0;
|
|
12718
12415
|
this.running = false;
|
|
12719
|
-
const {
|
|
12720
|
-
|
|
12721
|
-
|
|
12722
|
-
|
|
12723
|
-
|
|
12416
|
+
const { endingStyle, killStyle } = this;
|
|
12417
|
+
const style = killStyle ? {} : endingStyle;
|
|
12418
|
+
if (killStyle)
|
|
12419
|
+
for (let key in endingStyle)
|
|
12420
|
+
key in killStyle || (style[key] = endingStyle[key]);
|
|
12421
|
+
this.setStyle(style);
|
|
12724
12422
|
this.clearTimer();
|
|
12725
12423
|
this.emit(AnimateEvent.COMPLETED, this);
|
|
12726
12424
|
}
|
|
@@ -12771,7 +12469,11 @@ let Animate = class Animate extends Eventer {
|
|
|
12771
12469
|
this.emit(AnimateEvent.UPDATE, this);
|
|
12772
12470
|
}
|
|
12773
12471
|
setStyle(style) {
|
|
12774
|
-
|
|
12472
|
+
const { target } = this;
|
|
12473
|
+
if (target && style) {
|
|
12474
|
+
this.style = style;
|
|
12475
|
+
target.__ ? target.set(style, this.isTemp ? 'temp' : false) : Object.assign(target, style);
|
|
12476
|
+
}
|
|
12775
12477
|
}
|
|
12776
12478
|
clearTimer(fn) {
|
|
12777
12479
|
if (this.timer) {
|
|
@@ -12787,7 +12489,7 @@ let Animate = class Animate extends Eventer {
|
|
|
12787
12489
|
this.stop();
|
|
12788
12490
|
else
|
|
12789
12491
|
this.pause();
|
|
12790
|
-
this.target = this.config = this.frames = null;
|
|
12492
|
+
this.target = this.config = this.frames = this.fromStyle = this.toStyle = this.style = this.killStyle = null;
|
|
12791
12493
|
this.destroyed = true;
|
|
12792
12494
|
}
|
|
12793
12495
|
}
|
|
@@ -13149,6 +12851,10 @@ const TransitionList = {
|
|
|
13149
12851
|
return from.map((f, i) => number(f, to[i], t));
|
|
13150
12852
|
},
|
|
13151
12853
|
text(from, to, t) {
|
|
12854
|
+
if (typeof from === 'string' && typeof to === 'string') {
|
|
12855
|
+
const fl = from.length, tl = to.length, len = number(fl, tl, t, 1);
|
|
12856
|
+
return fl < tl ? to.substring(0, len) : from.substring(0, len);
|
|
12857
|
+
}
|
|
13152
12858
|
return (typeof from === 'number' || typeof to === 'number') ? MathHelper.float(number(from, to, t), Math.max(getDecimalLen(from), getDecimalLen(to))) : to;
|
|
13153
12859
|
},
|
|
13154
12860
|
shadow,
|
|
@@ -13196,17 +12902,16 @@ function shadow(from, to, t) {
|
|
|
13196
12902
|
};
|
|
13197
12903
|
}
|
|
13198
12904
|
|
|
13199
|
-
Plugin.add('animate');
|
|
13200
|
-
setTimeout(() => Plugin.check('color', true));
|
|
12905
|
+
Plugin.add('animate', 'color');
|
|
13201
12906
|
State.canAnimate = true;
|
|
13202
12907
|
Object.assign(Transition, TransitionModule);
|
|
13203
12908
|
Object.assign(Transition.list, TransitionList);
|
|
13204
|
-
const ui$
|
|
13205
|
-
animationType()(ui$
|
|
13206
|
-
dataType()(ui$
|
|
13207
|
-
dataType(true)(ui$
|
|
13208
|
-
dataType()(ui$
|
|
13209
|
-
ui$
|
|
12909
|
+
const ui$2 = UI.prototype;
|
|
12910
|
+
animationType()(ui$2, 'animation');
|
|
12911
|
+
dataType()(ui$2, 'animationOut');
|
|
12912
|
+
dataType(true)(ui$2, 'transition');
|
|
12913
|
+
dataType()(ui$2, 'transitionOut');
|
|
12914
|
+
ui$2.animate = function (keyframe, options, kill, isTemp) {
|
|
13210
12915
|
if (keyframe === undefined)
|
|
13211
12916
|
return this.__animate;
|
|
13212
12917
|
if (typeof keyframe === 'object') {
|
|
@@ -13215,15 +12920,16 @@ ui$1.animate = function (keyframe, options, kill, isTemp) {
|
|
|
13215
12920
|
else if (keyframe.style)
|
|
13216
12921
|
options = keyframe, keyframe = keyframe.style;
|
|
13217
12922
|
}
|
|
13218
|
-
this
|
|
13219
|
-
|
|
12923
|
+
const animate = new Animate(this, keyframe, options, isTemp);
|
|
12924
|
+
this.killAnimate(kill, animate.toStyle);
|
|
12925
|
+
return this.__animate = animate;
|
|
13220
12926
|
};
|
|
13221
|
-
ui$
|
|
12927
|
+
ui$2.killAnimate = function (_type, killStyle) {
|
|
13222
12928
|
const animate = this.__animate;
|
|
13223
12929
|
if (animate)
|
|
13224
|
-
animate.kill(), this.__animate = null;
|
|
12930
|
+
animate.kill(true, killStyle), this.__animate = null;
|
|
13225
12931
|
};
|
|
13226
|
-
ui$
|
|
12932
|
+
ui$2.__runAnimation = function (type, complete) {
|
|
13227
12933
|
this.animate(type === 'in' ? this.animation : this.animationOut);
|
|
13228
12934
|
if (complete)
|
|
13229
12935
|
this.__animate.on(AnimateEvent.COMPLETED, complete);
|
|
@@ -13485,17 +13191,17 @@ Transition.register('motion', function (from, to, t, target) {
|
|
|
13485
13191
|
Transition.register('motionRotation', function (from, to, t) {
|
|
13486
13192
|
return Transition.number(from, to, t);
|
|
13487
13193
|
});
|
|
13488
|
-
const ui = UI.prototype;
|
|
13194
|
+
const ui$1 = UI.prototype;
|
|
13489
13195
|
const { updateMatrix, updateAllMatrix } = LeafHelper;
|
|
13490
13196
|
const { updateBounds } = BranchHelper;
|
|
13491
|
-
motionPathType()(ui, 'motionPath');
|
|
13492
|
-
motionPathType(1)(ui, 'motionPrecision');
|
|
13493
|
-
motionPathType()(ui, 'motion');
|
|
13494
|
-
motionPathType(true)(ui, 'motionRotation');
|
|
13495
|
-
ui.getMotionPathData = function () {
|
|
13197
|
+
motionPathType()(ui$1, 'motionPath');
|
|
13198
|
+
motionPathType(1)(ui$1, 'motionPrecision');
|
|
13199
|
+
motionPathType()(ui$1, 'motion');
|
|
13200
|
+
motionPathType(true)(ui$1, 'motionRotation');
|
|
13201
|
+
ui$1.getMotionPathData = function () {
|
|
13496
13202
|
return getMotionPathData(getMotionPath(this));
|
|
13497
13203
|
};
|
|
13498
|
-
ui.getMotionPoint = function (motionDistance) {
|
|
13204
|
+
ui$1.getMotionPoint = function (motionDistance) {
|
|
13499
13205
|
const path = getMotionPath(this);
|
|
13500
13206
|
const data = getMotionPathData(path);
|
|
13501
13207
|
if (!data.total)
|
|
@@ -13509,10 +13215,10 @@ ui.getMotionPoint = function (motionDistance) {
|
|
|
13509
13215
|
point.rotation += motionRotation;
|
|
13510
13216
|
return point;
|
|
13511
13217
|
};
|
|
13512
|
-
ui.getMotionTotal = function () {
|
|
13218
|
+
ui$1.getMotionTotal = function () {
|
|
13513
13219
|
return this.getMotionPathData().total;
|
|
13514
13220
|
};
|
|
13515
|
-
ui.__updateMotionPath = function () {
|
|
13221
|
+
ui$1.__updateMotionPath = function () {
|
|
13516
13222
|
const data = this.__;
|
|
13517
13223
|
if (this.__layout.resized && data.__pathForMotion)
|
|
13518
13224
|
data.__pathForMotion = undefined;
|
|
@@ -13572,4 +13278,150 @@ function getMotionPathData(leaf) {
|
|
|
13572
13278
|
return data.__pathForMotion = HighCurveHelper.getMotionPathData(leaf.getPath(true, true));
|
|
13573
13279
|
}
|
|
13574
13280
|
|
|
13575
|
-
|
|
13281
|
+
const { Yes, NoAndSkip, YesAndSkip } = Answer;
|
|
13282
|
+
const idCondition = {}, classNameCondition = {}, tagCondition = {};
|
|
13283
|
+
class Finder {
|
|
13284
|
+
constructor(target) {
|
|
13285
|
+
this.innerIdMap = {};
|
|
13286
|
+
this.idMap = {};
|
|
13287
|
+
this.methods = {
|
|
13288
|
+
id: (leaf, name) => leaf.id === name ? (this.target && (this.idMap[name] = leaf), 1) : 0,
|
|
13289
|
+
innerId: (leaf, innerId) => leaf.innerId === innerId ? (this.target && (this.innerIdMap[innerId] = leaf), 1) : 0,
|
|
13290
|
+
className: (leaf, name) => leaf.className === name ? 1 : 0,
|
|
13291
|
+
tag: (leaf, name) => leaf.__tag === name ? 1 : 0,
|
|
13292
|
+
tags: (leaf, nameMap) => nameMap[leaf.__tag] ? 1 : 0
|
|
13293
|
+
};
|
|
13294
|
+
if (this.target = target)
|
|
13295
|
+
this.__listenEvents();
|
|
13296
|
+
}
|
|
13297
|
+
getBy(condition, branch, one, options) {
|
|
13298
|
+
switch (typeof condition) {
|
|
13299
|
+
case 'number':
|
|
13300
|
+
const leaf = this.getByInnerId(condition, branch);
|
|
13301
|
+
return one ? leaf : (leaf ? [leaf] : []);
|
|
13302
|
+
case 'string':
|
|
13303
|
+
switch (condition[0]) {
|
|
13304
|
+
case '#':
|
|
13305
|
+
idCondition.id = condition.substring(1), condition = idCondition;
|
|
13306
|
+
break;
|
|
13307
|
+
case '.':
|
|
13308
|
+
classNameCondition.className = condition.substring(1), condition = classNameCondition;
|
|
13309
|
+
break;
|
|
13310
|
+
default:
|
|
13311
|
+
tagCondition.tag = condition, condition = tagCondition;
|
|
13312
|
+
}
|
|
13313
|
+
case 'object':
|
|
13314
|
+
if (condition.id !== undefined) {
|
|
13315
|
+
const leaf = this.getById(condition.id, branch);
|
|
13316
|
+
return one ? leaf : (leaf ? [leaf] : []);
|
|
13317
|
+
}
|
|
13318
|
+
else if (condition.tag) {
|
|
13319
|
+
const { tag } = condition, isArray = tag instanceof Array;
|
|
13320
|
+
return this.getByMethod(isArray ? this.methods.tags : this.methods.tag, branch, one, isArray ? DataHelper.toMap(tag) : tag);
|
|
13321
|
+
}
|
|
13322
|
+
else {
|
|
13323
|
+
return this.getByMethod(this.methods.className, branch, one, condition.className);
|
|
13324
|
+
}
|
|
13325
|
+
case 'function':
|
|
13326
|
+
return this.getByMethod(condition, branch, one, options);
|
|
13327
|
+
}
|
|
13328
|
+
}
|
|
13329
|
+
getByInnerId(innerId, branch) {
|
|
13330
|
+
const cache = this.innerIdMap[innerId];
|
|
13331
|
+
if (cache)
|
|
13332
|
+
return cache;
|
|
13333
|
+
this.eachFind(this.toChildren(branch), this.methods.innerId, null, innerId);
|
|
13334
|
+
return this.findLeaf;
|
|
13335
|
+
}
|
|
13336
|
+
getById(id, branch) {
|
|
13337
|
+
const cache = this.idMap[id];
|
|
13338
|
+
if (cache && LeafHelper.hasParent(cache, branch || this.target))
|
|
13339
|
+
return cache;
|
|
13340
|
+
this.eachFind(this.toChildren(branch), this.methods.id, null, id);
|
|
13341
|
+
return this.findLeaf;
|
|
13342
|
+
}
|
|
13343
|
+
getByClassName(className, branch) {
|
|
13344
|
+
return this.getByMethod(this.methods.className, branch, false, className);
|
|
13345
|
+
}
|
|
13346
|
+
getByTag(tag, branch) {
|
|
13347
|
+
return this.getByMethod(this.methods.tag, branch, false, tag);
|
|
13348
|
+
}
|
|
13349
|
+
getByMethod(method, branch, one, options) {
|
|
13350
|
+
const list = one ? null : [];
|
|
13351
|
+
this.eachFind(this.toChildren(branch), method, list, options);
|
|
13352
|
+
return list || this.findLeaf;
|
|
13353
|
+
}
|
|
13354
|
+
eachFind(children, method, list, options) {
|
|
13355
|
+
let child, result;
|
|
13356
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
13357
|
+
child = children[i];
|
|
13358
|
+
result = method(child, options);
|
|
13359
|
+
if (result === Yes || result === YesAndSkip) {
|
|
13360
|
+
if (list) {
|
|
13361
|
+
list.push(child);
|
|
13362
|
+
}
|
|
13363
|
+
else {
|
|
13364
|
+
this.findLeaf = child;
|
|
13365
|
+
return;
|
|
13366
|
+
}
|
|
13367
|
+
}
|
|
13368
|
+
if (child.isBranch && result < NoAndSkip)
|
|
13369
|
+
this.eachFind(child.children, method, list, options);
|
|
13370
|
+
}
|
|
13371
|
+
}
|
|
13372
|
+
toChildren(branch) {
|
|
13373
|
+
this.findLeaf = null;
|
|
13374
|
+
return [branch || this.target];
|
|
13375
|
+
}
|
|
13376
|
+
__onRemoveChild(event) {
|
|
13377
|
+
const { id, innerId } = event.child;
|
|
13378
|
+
if (this.idMap[id])
|
|
13379
|
+
delete this.idMap[id];
|
|
13380
|
+
if (this.innerIdMap[innerId])
|
|
13381
|
+
delete this.innerIdMap[innerId];
|
|
13382
|
+
}
|
|
13383
|
+
__checkIdChange(event) {
|
|
13384
|
+
if (event.attrName === 'id') {
|
|
13385
|
+
const id = event.oldValue;
|
|
13386
|
+
if (this.idMap[id])
|
|
13387
|
+
delete this.idMap[id];
|
|
13388
|
+
}
|
|
13389
|
+
}
|
|
13390
|
+
__listenEvents() {
|
|
13391
|
+
this.__eventIds = [
|
|
13392
|
+
this.target.on_(ChildEvent.REMOVE, this.__onRemoveChild, this),
|
|
13393
|
+
this.target.on_(PropertyEvent.CHANGE, this.__checkIdChange, this)
|
|
13394
|
+
];
|
|
13395
|
+
}
|
|
13396
|
+
__removeListenEvents() {
|
|
13397
|
+
this.target.off_(this.__eventIds);
|
|
13398
|
+
this.__eventIds.length = 0;
|
|
13399
|
+
}
|
|
13400
|
+
destroy() {
|
|
13401
|
+
const { __eventIds } = this;
|
|
13402
|
+
if (__eventIds && __eventIds.length) {
|
|
13403
|
+
this.__removeListenEvents();
|
|
13404
|
+
this.innerIdMap = {};
|
|
13405
|
+
this.idMap = {};
|
|
13406
|
+
}
|
|
13407
|
+
this.findLeaf = null;
|
|
13408
|
+
}
|
|
13409
|
+
}
|
|
13410
|
+
|
|
13411
|
+
const ui = UI.prototype;
|
|
13412
|
+
function getSelector(ui) {
|
|
13413
|
+
return ui.leafer ? ui.leafer.selector : (Platform.selector || (Platform.selector = Creator.selector()));
|
|
13414
|
+
}
|
|
13415
|
+
ui.find = function (condition, options) {
|
|
13416
|
+
return getSelector(this).getBy(condition, this, false, options);
|
|
13417
|
+
};
|
|
13418
|
+
ui.findOne = function (condition, options) {
|
|
13419
|
+
return getSelector(this).getBy(condition, this, true, options);
|
|
13420
|
+
};
|
|
13421
|
+
|
|
13422
|
+
Plugin.add('find');
|
|
13423
|
+
Creator.finder = function (target) {
|
|
13424
|
+
return new Finder(target);
|
|
13425
|
+
};
|
|
13426
|
+
|
|
13427
|
+
export { AlignHelper, Animate, AnimateEasing, AnimateEvent, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Finder, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Robot, RobotData, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isNull, layoutProcessor, maskType, motionPathType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$4 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };
|