@leafer-draw/worker 1.6.3 → 1.6.5
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 +17 -27
- package/dist/worker.esm.js +18 -28
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +85 -611
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +85 -611
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +9 -9
package/dist/worker.module.js
CHANGED
|
@@ -490,19 +490,19 @@ const PointHelper = {
|
|
|
490
490
|
},
|
|
491
491
|
tempToInnerOf(t, matrix) {
|
|
492
492
|
const { tempPoint: temp } = P$5;
|
|
493
|
-
copy$
|
|
493
|
+
copy$a(temp, t);
|
|
494
494
|
toInnerPoint$2(matrix, temp, temp);
|
|
495
495
|
return temp;
|
|
496
496
|
},
|
|
497
497
|
tempToOuterOf(t, matrix) {
|
|
498
498
|
const { tempPoint: temp } = P$5;
|
|
499
|
-
copy$
|
|
499
|
+
copy$a(temp, t);
|
|
500
500
|
toOuterPoint$3(matrix, temp, temp);
|
|
501
501
|
return temp;
|
|
502
502
|
},
|
|
503
503
|
tempToInnerRadiusPointOf(t, matrix) {
|
|
504
504
|
const { tempRadiusPoint: temp } = P$5;
|
|
505
|
-
copy$
|
|
505
|
+
copy$a(temp, t);
|
|
506
506
|
P$5.toInnerRadiusPointOf(t, matrix, temp);
|
|
507
507
|
return temp;
|
|
508
508
|
},
|
|
@@ -575,7 +575,7 @@ const PointHelper = {
|
|
|
575
575
|
}
|
|
576
576
|
};
|
|
577
577
|
const P$5 = PointHelper;
|
|
578
|
-
const { getDistanceFrom, copy: copy$
|
|
578
|
+
const { getDistanceFrom, copy: copy$a, getAtan2 } = P$5;
|
|
579
579
|
|
|
580
580
|
class Point {
|
|
581
581
|
constructor(x, y) {
|
|
@@ -932,7 +932,7 @@ const BoundsHelper = {
|
|
|
932
932
|
to = t;
|
|
933
933
|
}
|
|
934
934
|
else {
|
|
935
|
-
copy$
|
|
935
|
+
copy$9(to, t);
|
|
936
936
|
}
|
|
937
937
|
if (parent) {
|
|
938
938
|
to.offsetX = -(B.maxX(parent) - t.x);
|
|
@@ -1090,7 +1090,7 @@ const BoundsHelper = {
|
|
|
1090
1090
|
if (first) {
|
|
1091
1091
|
first = false;
|
|
1092
1092
|
if (!addMode)
|
|
1093
|
-
copy$
|
|
1093
|
+
copy$9(t, bounds);
|
|
1094
1094
|
}
|
|
1095
1095
|
else {
|
|
1096
1096
|
add$1(t, bounds);
|
|
@@ -1171,7 +1171,7 @@ const BoundsHelper = {
|
|
|
1171
1171
|
}
|
|
1172
1172
|
};
|
|
1173
1173
|
const B = BoundsHelper;
|
|
1174
|
-
const { add: add$1, copy: copy$
|
|
1174
|
+
const { add: add$1, copy: copy$9 } = B;
|
|
1175
1175
|
|
|
1176
1176
|
class Bounds {
|
|
1177
1177
|
get minX() { return BoundsHelper.minX(this); }
|
|
@@ -2066,7 +2066,7 @@ __decorate([
|
|
|
2066
2066
|
contextMethod()
|
|
2067
2067
|
], Canvas$1.prototype, "strokeText", null);
|
|
2068
2068
|
|
|
2069
|
-
const { copy: copy$
|
|
2069
|
+
const { copy: copy$8, multiplyParent: multiplyParent$3 } = MatrixHelper, { round: round$1 } = Math;
|
|
2070
2070
|
const minSize = { width: 1, height: 1, pixelRatio: 1 };
|
|
2071
2071
|
const canvasSizeAttrs = ['width', 'height', 'pixelRatio'];
|
|
2072
2072
|
class LeaferCanvasBase extends Canvas$1 {
|
|
@@ -2269,16 +2269,19 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2269
2269
|
if (blendMode)
|
|
2270
2270
|
this.blendMode = 'source-over';
|
|
2271
2271
|
}
|
|
2272
|
-
clearWorld(bounds, ceilPixel) {
|
|
2273
|
-
this.setTempBounds(bounds, ceilPixel);
|
|
2274
|
-
this.clearRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
|
|
2275
|
-
}
|
|
2276
2272
|
clipWorld(bounds, ceilPixel) {
|
|
2277
2273
|
this.beginPath();
|
|
2278
2274
|
this.setTempBounds(bounds, ceilPixel);
|
|
2279
2275
|
this.rect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
|
|
2280
2276
|
this.clip();
|
|
2281
2277
|
}
|
|
2278
|
+
clipUI(ruleData) {
|
|
2279
|
+
ruleData.windingRule ? this.clip(ruleData.windingRule) : this.clip();
|
|
2280
|
+
}
|
|
2281
|
+
clearWorld(bounds, ceilPixel) {
|
|
2282
|
+
this.setTempBounds(bounds, ceilPixel);
|
|
2283
|
+
this.clearRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
|
|
2284
|
+
}
|
|
2282
2285
|
clear() {
|
|
2283
2286
|
const { pixelRatio } = this;
|
|
2284
2287
|
this.clearRect(0, 0, this.width * pixelRatio + 2, this.height * pixelRatio + 2);
|
|
@@ -2298,7 +2301,7 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2298
2301
|
const { size, pixelSnap } = this, canvas = this.manager ? this.manager.get(size) : Creator.canvas(Object.assign({}, size));
|
|
2299
2302
|
canvas.save();
|
|
2300
2303
|
if (useSameWorldTransform)
|
|
2301
|
-
copy$
|
|
2304
|
+
copy$8(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
|
|
2302
2305
|
if (useSameSmooth)
|
|
2303
2306
|
canvas.smooth = this.smooth;
|
|
2304
2307
|
canvas.pixelSnap !== pixelSnap && (canvas.pixelSnap = pixelSnap);
|
|
@@ -2677,7 +2680,7 @@ const EllipseHelper = {
|
|
|
2677
2680
|
};
|
|
2678
2681
|
|
|
2679
2682
|
const { M: M$4, m, L: L$5, l, H, h, V, v, C: C$3, 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;
|
|
2680
|
-
const { rect: rect$
|
|
2683
|
+
const { rect: rect$2, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1 } = BezierHelper;
|
|
2681
2684
|
const { ellipticalArc } = EllipseHelper;
|
|
2682
2685
|
const debug$b = Debug.get('PathConvert');
|
|
2683
2686
|
const setEndPoint$1 = {};
|
|
@@ -2874,7 +2877,7 @@ const PathConvert = {
|
|
|
2874
2877
|
case N$3:
|
|
2875
2878
|
x = old[i + 1];
|
|
2876
2879
|
y = old[i + 2];
|
|
2877
|
-
curveMode ? rect$
|
|
2880
|
+
curveMode ? rect$2(data, x, y, old[i + 3], old[i + 4]) : copyData(data, old, i, 5);
|
|
2878
2881
|
i += 5;
|
|
2879
2882
|
break;
|
|
2880
2883
|
case D$3:
|
|
@@ -3050,7 +3053,7 @@ const PathCommandDataHelper = {
|
|
|
3050
3053
|
};
|
|
3051
3054
|
const { ellipse: ellipse$3, arc: arc$2 } = PathCommandDataHelper;
|
|
3052
3055
|
|
|
3053
|
-
const { moveTo: moveTo$4, lineTo: lineTo$3, quadraticCurveTo, bezierCurveTo, closePath: closePath$3, beginPath, rect: rect$
|
|
3056
|
+
const { moveTo: moveTo$4, lineTo: lineTo$3, quadraticCurveTo, bezierCurveTo, closePath: closePath$3, beginPath, rect: rect$1, roundRect: roundRect$1, ellipse: ellipse$2, arc: arc$1, arcTo: arcTo$2, drawEllipse, drawArc, drawPoints: drawPoints$2 } = PathCommandDataHelper;
|
|
3054
3057
|
class PathCreator {
|
|
3055
3058
|
set path(value) { this.__path = value; }
|
|
3056
3059
|
get path() { return this.__path; }
|
|
@@ -3097,7 +3100,7 @@ class PathCreator {
|
|
|
3097
3100
|
return this;
|
|
3098
3101
|
}
|
|
3099
3102
|
rect(x, y, width, height) {
|
|
3100
|
-
rect$
|
|
3103
|
+
rect$1(this.__path, x, y, width, height);
|
|
3101
3104
|
this.paint();
|
|
3102
3105
|
return this;
|
|
3103
3106
|
}
|
|
@@ -3215,7 +3218,7 @@ const PathDrawer = {
|
|
|
3215
3218
|
|
|
3216
3219
|
const { M: M$1, L: L$2, C, Q, Z: Z$1, N, D, X, G, F: F$1, O, P, U } = PathCommandMap;
|
|
3217
3220
|
const { toTwoPointBounds, toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc, ellipse: ellipse$1 } = BezierHelper;
|
|
3218
|
-
const { addPointBounds, copy: copy$
|
|
3221
|
+
const { addPointBounds, copy: copy$7, addPoint, setPoint, addBounds, toBounds: toBounds$2 } = TwoPointBoundsHelper;
|
|
3219
3222
|
const debug$9 = Debug.get('PathBounds');
|
|
3220
3223
|
let radius, radiusX, radiusY;
|
|
3221
3224
|
const tempPointBounds = {};
|
|
@@ -3287,7 +3290,7 @@ const PathBounds = {
|
|
|
3287
3290
|
break;
|
|
3288
3291
|
case G:
|
|
3289
3292
|
ellipse$1(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], data[i + 7], data[i + 8], tempPointBounds, setEndPoint);
|
|
3290
|
-
i === 0 ? copy$
|
|
3293
|
+
i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3291
3294
|
x = setEndPoint.x;
|
|
3292
3295
|
y = setEndPoint.y;
|
|
3293
3296
|
i += 9;
|
|
@@ -3303,7 +3306,7 @@ const PathBounds = {
|
|
|
3303
3306
|
break;
|
|
3304
3307
|
case O:
|
|
3305
3308
|
arc(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], tempPointBounds, setEndPoint);
|
|
3306
|
-
i === 0 ? copy$
|
|
3309
|
+
i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3307
3310
|
x = setEndPoint.x;
|
|
3308
3311
|
y = setEndPoint.y;
|
|
3309
3312
|
i += 7;
|
|
@@ -3318,7 +3321,7 @@ const PathBounds = {
|
|
|
3318
3321
|
break;
|
|
3319
3322
|
case U:
|
|
3320
3323
|
arcTo$1(null, x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], tempPointBounds, setEndPoint);
|
|
3321
|
-
i === 0 ? copy$
|
|
3324
|
+
i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3322
3325
|
x = setEndPoint.x;
|
|
3323
3326
|
y = setEndPoint.y;
|
|
3324
3327
|
i += 6;
|
|
@@ -4254,8 +4257,8 @@ function registerUIEvent() {
|
|
|
4254
4257
|
};
|
|
4255
4258
|
}
|
|
4256
4259
|
|
|
4257
|
-
const { copy: copy$
|
|
4258
|
-
const matrix
|
|
4260
|
+
const { copy: copy$6, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
|
|
4261
|
+
const matrix = {}, { round } = Math;
|
|
4259
4262
|
const LeafHelper = {
|
|
4260
4263
|
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
4261
4264
|
if (checkAutoLayout && leaf.__hasAutoLayout && leaf.__layout.matrixChanged)
|
|
@@ -4350,13 +4353,13 @@ const LeafHelper = {
|
|
|
4350
4353
|
transition = scaleY;
|
|
4351
4354
|
scaleY = scaleX;
|
|
4352
4355
|
}
|
|
4353
|
-
copy$
|
|
4354
|
-
scaleOfOuter$2(matrix
|
|
4356
|
+
copy$6(matrix, o);
|
|
4357
|
+
scaleOfOuter$2(matrix, origin, scaleX, scaleY);
|
|
4355
4358
|
if (t.origin || t.around) {
|
|
4356
|
-
L.setTransform(t, matrix
|
|
4359
|
+
L.setTransform(t, matrix, resize, transition);
|
|
4357
4360
|
}
|
|
4358
4361
|
else {
|
|
4359
|
-
const x = t.x + matrix
|
|
4362
|
+
const x = t.x + matrix.e - o.e, y = t.y + matrix.f - o.f;
|
|
4360
4363
|
if (transition && !resize)
|
|
4361
4364
|
t.animate({ x, y, scaleX: t.scaleX * scaleX, scaleY: t.scaleY * scaleY }, transition);
|
|
4362
4365
|
else
|
|
@@ -4368,32 +4371,32 @@ const LeafHelper = {
|
|
|
4368
4371
|
},
|
|
4369
4372
|
rotateOfLocal(t, origin, angle, transition) {
|
|
4370
4373
|
const o = t.__localMatrix;
|
|
4371
|
-
copy$
|
|
4372
|
-
rotateOfOuter$2(matrix
|
|
4374
|
+
copy$6(matrix, o);
|
|
4375
|
+
rotateOfOuter$2(matrix, origin, angle);
|
|
4373
4376
|
if (t.origin || t.around)
|
|
4374
|
-
L.setTransform(t, matrix
|
|
4377
|
+
L.setTransform(t, matrix, false, transition);
|
|
4375
4378
|
else
|
|
4376
|
-
t.set({ x: t.x + matrix
|
|
4379
|
+
t.set({ x: t.x + matrix.e - o.e, y: t.y + matrix.f - o.f, rotation: MathHelper.formatRotation(t.rotation + angle) }, transition);
|
|
4377
4380
|
},
|
|
4378
4381
|
skewOfWorld(t, origin, skewX, skewY, resize, transition) {
|
|
4379
4382
|
L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
|
|
4380
4383
|
},
|
|
4381
4384
|
skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
|
|
4382
|
-
copy$
|
|
4383
|
-
skewOfOuter(matrix
|
|
4384
|
-
L.setTransform(t, matrix
|
|
4385
|
+
copy$6(matrix, t.__localMatrix);
|
|
4386
|
+
skewOfOuter(matrix, origin, skewX, skewY);
|
|
4387
|
+
L.setTransform(t, matrix, resize, transition);
|
|
4385
4388
|
},
|
|
4386
4389
|
transformWorld(t, transform, resize, transition) {
|
|
4387
|
-
copy$
|
|
4388
|
-
multiplyParent$2(matrix
|
|
4390
|
+
copy$6(matrix, t.worldTransform);
|
|
4391
|
+
multiplyParent$2(matrix, transform);
|
|
4389
4392
|
if (t.parent)
|
|
4390
|
-
divideParent(matrix
|
|
4391
|
-
L.setTransform(t, matrix
|
|
4393
|
+
divideParent(matrix, t.parent.worldTransform);
|
|
4394
|
+
L.setTransform(t, matrix, resize, transition);
|
|
4392
4395
|
},
|
|
4393
4396
|
transform(t, transform, resize, transition) {
|
|
4394
|
-
copy$
|
|
4395
|
-
multiplyParent$2(matrix
|
|
4396
|
-
L.setTransform(t, matrix
|
|
4397
|
+
copy$6(matrix, t.localTransform);
|
|
4398
|
+
multiplyParent$2(matrix, transform);
|
|
4399
|
+
L.setTransform(t, matrix, resize, transition);
|
|
4397
4400
|
},
|
|
4398
4401
|
setTransform(t, transform, resize, transition) {
|
|
4399
4402
|
const data = t.__, originPoint = data.origin && L.getInnerOrigin(t, data.origin);
|
|
@@ -4427,9 +4430,9 @@ const LeafHelper = {
|
|
|
4427
4430
|
return innerOrigin;
|
|
4428
4431
|
},
|
|
4429
4432
|
getRelativeWorld(t, relative, temp) {
|
|
4430
|
-
copy$
|
|
4431
|
-
divideParent(matrix
|
|
4432
|
-
return temp ? matrix
|
|
4433
|
+
copy$6(matrix, t.worldTransform);
|
|
4434
|
+
divideParent(matrix, relative.worldTransform);
|
|
4435
|
+
return temp ? matrix : Object.assign({}, matrix);
|
|
4433
4436
|
},
|
|
4434
4437
|
drop(t, parent, index, resize) {
|
|
4435
4438
|
t.setTransform(L.getRelativeWorld(t, parent, true), resize);
|
|
@@ -4568,7 +4571,7 @@ const WaitHelper = {
|
|
|
4568
4571
|
};
|
|
4569
4572
|
|
|
4570
4573
|
const { getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$2 } = LeafHelper;
|
|
4571
|
-
const { toOuterOf: toOuterOf$2, getPoints, copy: copy$
|
|
4574
|
+
const { toOuterOf: toOuterOf$2, getPoints, copy: copy$5 } = BoundsHelper;
|
|
4572
4575
|
const localContent = '_localContentBounds';
|
|
4573
4576
|
const worldContent = '_worldContentBounds', worldBox = '_worldBoxBounds', worldStroke = '_worldStrokeBounds';
|
|
4574
4577
|
class LeafLayout {
|
|
@@ -4728,7 +4731,7 @@ class LeafLayout {
|
|
|
4728
4731
|
}
|
|
4729
4732
|
if (!layoutBounds)
|
|
4730
4733
|
layoutBounds = MatrixHelper.getLayout(matrix);
|
|
4731
|
-
copy$
|
|
4734
|
+
copy$5(layoutBounds, bounds);
|
|
4732
4735
|
PointHelper.copy(layoutBounds, point);
|
|
4733
4736
|
if (unscale) {
|
|
4734
4737
|
const { scaleX, scaleY } = layoutBounds;
|
|
@@ -5282,7 +5285,7 @@ const LeafMatrix = {
|
|
|
5282
5285
|
|
|
5283
5286
|
const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2 } = LeafHelper;
|
|
5284
5287
|
const { updateBounds: updateBounds$1 } = BranchHelper;
|
|
5285
|
-
const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$
|
|
5288
|
+
const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$4 } = BoundsHelper;
|
|
5286
5289
|
const { toBounds: toBounds$1 } = PathBounds;
|
|
5287
5290
|
const LeafBounds = {
|
|
5288
5291
|
__updateWorldBounds() {
|
|
@@ -5413,7 +5416,7 @@ const LeafBounds = {
|
|
|
5413
5416
|
},
|
|
5414
5417
|
__updateRenderBounds() {
|
|
5415
5418
|
const layout = this.__layout;
|
|
5416
|
-
layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$
|
|
5419
|
+
layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$4(layout.renderBounds, layout.strokeBounds);
|
|
5417
5420
|
}
|
|
5418
5421
|
};
|
|
5419
5422
|
|
|
@@ -5447,7 +5450,7 @@ const LeafRender = {
|
|
|
5447
5450
|
if (this.__worldOpacity) {
|
|
5448
5451
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
5449
5452
|
this.__drawRenderPath(canvas);
|
|
5450
|
-
|
|
5453
|
+
canvas.clipUI(this);
|
|
5451
5454
|
}
|
|
5452
5455
|
},
|
|
5453
5456
|
__updateWorldOpacity() {
|
|
@@ -5518,7 +5521,7 @@ const BranchRender = {
|
|
|
5518
5521
|
const { LEAF, create } = IncrementId;
|
|
5519
5522
|
const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
|
|
5520
5523
|
const { toOuterOf } = BoundsHelper;
|
|
5521
|
-
const { copy: copy$
|
|
5524
|
+
const { copy: copy$3, move } = PointHelper;
|
|
5522
5525
|
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
|
|
5523
5526
|
let Leaf = class Leaf {
|
|
5524
5527
|
get tag() { return this.__tag; }
|
|
@@ -5731,7 +5734,7 @@ let Leaf = class Leaf {
|
|
|
5731
5734
|
}
|
|
5732
5735
|
else {
|
|
5733
5736
|
if (to)
|
|
5734
|
-
copy$
|
|
5737
|
+
copy$3(to, world);
|
|
5735
5738
|
}
|
|
5736
5739
|
}
|
|
5737
5740
|
localToWorld(local, to, distance, relative) {
|
|
@@ -5740,7 +5743,7 @@ let Leaf = class Leaf {
|
|
|
5740
5743
|
}
|
|
5741
5744
|
else {
|
|
5742
5745
|
if (to)
|
|
5743
|
-
copy$
|
|
5746
|
+
copy$3(to, local);
|
|
5744
5747
|
}
|
|
5745
5748
|
}
|
|
5746
5749
|
worldToInner(world, to, distance, relative) {
|
|
@@ -6230,7 +6233,7 @@ class LeafLevelList {
|
|
|
6230
6233
|
}
|
|
6231
6234
|
}
|
|
6232
6235
|
|
|
6233
|
-
const version = "1.6.
|
|
6236
|
+
const version = "1.6.5";
|
|
6234
6237
|
|
|
6235
6238
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6236
6239
|
get allowBackgroundColor() { return true; }
|
|
@@ -7369,7 +7372,7 @@ const UIRender = {
|
|
|
7369
7372
|
__drawAfterFill(canvas, options) {
|
|
7370
7373
|
if (this.__.__clipAfterFill) {
|
|
7371
7374
|
canvas.save();
|
|
7372
|
-
|
|
7375
|
+
canvas.clipUI();
|
|
7373
7376
|
this.__drawContent(canvas, options);
|
|
7374
7377
|
canvas.restore();
|
|
7375
7378
|
}
|
|
@@ -8235,8 +8238,8 @@ Rect = __decorate([
|
|
|
8235
8238
|
registerUI()
|
|
8236
8239
|
], Rect);
|
|
8237
8240
|
|
|
8238
|
-
const { copy: copy$
|
|
8239
|
-
const rect
|
|
8241
|
+
const { copy: copy$2, add, includes: includes$1 } = BoundsHelper;
|
|
8242
|
+
const rect = Rect.prototype, group = Group.prototype;
|
|
8240
8243
|
const childrenRenderBounds = {};
|
|
8241
8244
|
let Box = class Box extends Group {
|
|
8242
8245
|
get __tag() { return 'Box'; }
|
|
@@ -8281,7 +8284,7 @@ let Box = class Box extends Group {
|
|
|
8281
8284
|
const { renderBounds } = this.__layout;
|
|
8282
8285
|
if (this.children.length) {
|
|
8283
8286
|
super.__updateRenderBounds();
|
|
8284
|
-
copy$
|
|
8287
|
+
copy$2(childrenRenderBounds, renderBounds);
|
|
8285
8288
|
this.__updateRectRenderBounds();
|
|
8286
8289
|
isOverflow = !includes$1(renderBounds, childrenRenderBounds);
|
|
8287
8290
|
if (isOverflow && this.__.overflow !== 'hide')
|
|
@@ -8333,25 +8336,25 @@ __decorate([
|
|
|
8333
8336
|
affectRenderBoundsType('show')
|
|
8334
8337
|
], Box.prototype, "overflow", void 0);
|
|
8335
8338
|
__decorate([
|
|
8336
|
-
rewrite(rect
|
|
8339
|
+
rewrite(rect.__updateStrokeSpread)
|
|
8337
8340
|
], Box.prototype, "__updateStrokeSpread", null);
|
|
8338
8341
|
__decorate([
|
|
8339
|
-
rewrite(rect
|
|
8342
|
+
rewrite(rect.__updateRenderSpread)
|
|
8340
8343
|
], Box.prototype, "__updateRectRenderSpread", null);
|
|
8341
8344
|
__decorate([
|
|
8342
|
-
rewrite(rect
|
|
8345
|
+
rewrite(rect.__updateBoxBounds)
|
|
8343
8346
|
], Box.prototype, "__updateRectBoxBounds", null);
|
|
8344
8347
|
__decorate([
|
|
8345
|
-
rewrite(rect
|
|
8348
|
+
rewrite(rect.__updateStrokeBounds)
|
|
8346
8349
|
], Box.prototype, "__updateStrokeBounds", null);
|
|
8347
8350
|
__decorate([
|
|
8348
|
-
rewrite(rect
|
|
8351
|
+
rewrite(rect.__updateRenderBounds)
|
|
8349
8352
|
], Box.prototype, "__updateRectRenderBounds", null);
|
|
8350
8353
|
__decorate([
|
|
8351
|
-
rewrite(rect
|
|
8354
|
+
rewrite(rect.__updateChange)
|
|
8352
8355
|
], Box.prototype, "__updateRectChange", null);
|
|
8353
8356
|
__decorate([
|
|
8354
|
-
rewrite(rect
|
|
8357
|
+
rewrite(rect.__render)
|
|
8355
8358
|
], Box.prototype, "__renderRect", null);
|
|
8356
8359
|
__decorate([
|
|
8357
8360
|
rewrite(group.__render)
|
|
@@ -8854,6 +8857,9 @@ __decorate([
|
|
|
8854
8857
|
__decorate([
|
|
8855
8858
|
boundsType('show')
|
|
8856
8859
|
], Text.prototype, "textOverflow", void 0);
|
|
8860
|
+
__decorate([
|
|
8861
|
+
surfaceType(false)
|
|
8862
|
+
], Text.prototype, "textEditing", void 0);
|
|
8857
8863
|
Text = __decorate([
|
|
8858
8864
|
registerUI()
|
|
8859
8865
|
], Text);
|
|
@@ -8985,531 +8991,6 @@ function fillPathOrText(ui, canvas) {
|
|
|
8985
8991
|
ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
|
|
8986
8992
|
}
|
|
8987
8993
|
|
|
8988
|
-
let App = class App extends Leafer {
|
|
8989
|
-
get __tag() { return 'App'; }
|
|
8990
|
-
get isApp() { return true; }
|
|
8991
|
-
constructor(userConfig, data) {
|
|
8992
|
-
super(userConfig, data);
|
|
8993
|
-
}
|
|
8994
|
-
init(userConfig, parentApp) {
|
|
8995
|
-
super.init(userConfig, parentApp);
|
|
8996
|
-
if (userConfig) {
|
|
8997
|
-
const { ground, tree, sky, editor } = userConfig;
|
|
8998
|
-
if (ground)
|
|
8999
|
-
this.ground = this.addLeafer(ground);
|
|
9000
|
-
if (tree || editor)
|
|
9001
|
-
this.tree = this.addLeafer(tree || { type: userConfig.type || 'design' });
|
|
9002
|
-
if (sky || editor)
|
|
9003
|
-
this.sky = this.addLeafer(sky);
|
|
9004
|
-
if (editor)
|
|
9005
|
-
Creator.editor(editor, this);
|
|
9006
|
-
}
|
|
9007
|
-
}
|
|
9008
|
-
__setApp() {
|
|
9009
|
-
const { canvas } = this;
|
|
9010
|
-
const { realCanvas, view } = this.config;
|
|
9011
|
-
if (realCanvas || view === this.canvas.view || !canvas.parentView)
|
|
9012
|
-
this.realCanvas = true;
|
|
9013
|
-
else
|
|
9014
|
-
canvas.unrealCanvas();
|
|
9015
|
-
this.leafer = this;
|
|
9016
|
-
this.watcher.disable();
|
|
9017
|
-
this.layouter.disable();
|
|
9018
|
-
}
|
|
9019
|
-
__updateLocalBounds() {
|
|
9020
|
-
this.forEach(leafer => leafer.updateLayout());
|
|
9021
|
-
super.__updateLocalBounds();
|
|
9022
|
-
}
|
|
9023
|
-
start() {
|
|
9024
|
-
super.start();
|
|
9025
|
-
this.forEach(leafer => leafer.start());
|
|
9026
|
-
}
|
|
9027
|
-
stop() {
|
|
9028
|
-
this.forEach(leafer => leafer.stop());
|
|
9029
|
-
super.stop();
|
|
9030
|
-
}
|
|
9031
|
-
unlockLayout() {
|
|
9032
|
-
super.unlockLayout();
|
|
9033
|
-
this.forEach(leafer => leafer.unlockLayout());
|
|
9034
|
-
}
|
|
9035
|
-
lockLayout() {
|
|
9036
|
-
super.lockLayout();
|
|
9037
|
-
this.forEach(leafer => leafer.lockLayout());
|
|
9038
|
-
}
|
|
9039
|
-
forceRender(bounds, sync) {
|
|
9040
|
-
this.forEach(leafer => leafer.forceRender(bounds, sync));
|
|
9041
|
-
}
|
|
9042
|
-
addLeafer(merge) {
|
|
9043
|
-
const leafer = new Leafer(merge);
|
|
9044
|
-
this.add(leafer);
|
|
9045
|
-
return leafer;
|
|
9046
|
-
}
|
|
9047
|
-
add(leafer, index) {
|
|
9048
|
-
if (!leafer.view) {
|
|
9049
|
-
if (this.realCanvas && !this.canvas.bounds) {
|
|
9050
|
-
setTimeout(() => this.add(leafer, index), 10);
|
|
9051
|
-
return;
|
|
9052
|
-
}
|
|
9053
|
-
leafer.init(this.__getChildConfig(leafer.userConfig), this);
|
|
9054
|
-
}
|
|
9055
|
-
super.add(leafer, index);
|
|
9056
|
-
if (index !== undefined)
|
|
9057
|
-
leafer.canvas.childIndex = index;
|
|
9058
|
-
this.__listenChildEvents(leafer);
|
|
9059
|
-
}
|
|
9060
|
-
forEach(fn) {
|
|
9061
|
-
this.children.forEach(fn);
|
|
9062
|
-
}
|
|
9063
|
-
__onCreated() {
|
|
9064
|
-
this.created = this.children.every(child => child.created);
|
|
9065
|
-
}
|
|
9066
|
-
__onReady() {
|
|
9067
|
-
if (this.children.every(child => child.ready))
|
|
9068
|
-
super.__onReady();
|
|
9069
|
-
}
|
|
9070
|
-
__onViewReady() {
|
|
9071
|
-
if (this.children.every(child => child.viewReady))
|
|
9072
|
-
super.__onViewReady();
|
|
9073
|
-
}
|
|
9074
|
-
__onChildRenderEnd(e) {
|
|
9075
|
-
this.renderer.addBlock(e.renderBounds);
|
|
9076
|
-
if (this.viewReady)
|
|
9077
|
-
this.renderer.update();
|
|
9078
|
-
}
|
|
9079
|
-
__render(canvas, options) {
|
|
9080
|
-
if (canvas.context)
|
|
9081
|
-
this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options && options.bounds));
|
|
9082
|
-
}
|
|
9083
|
-
__onResize(event) {
|
|
9084
|
-
this.forEach(leafer => leafer.resize(event));
|
|
9085
|
-
super.__onResize(event);
|
|
9086
|
-
}
|
|
9087
|
-
updateLayout() {
|
|
9088
|
-
this.forEach(leafer => leafer.updateLayout());
|
|
9089
|
-
}
|
|
9090
|
-
__getChildConfig(userConfig) {
|
|
9091
|
-
const config = Object.assign({}, this.config);
|
|
9092
|
-
config.hittable = config.realCanvas = undefined;
|
|
9093
|
-
if (userConfig)
|
|
9094
|
-
DataHelper.assign(config, userConfig);
|
|
9095
|
-
if (this.autoLayout)
|
|
9096
|
-
DataHelper.copyAttrs(config, this, canvasSizeAttrs);
|
|
9097
|
-
config.view = this.realCanvas ? undefined : this.view;
|
|
9098
|
-
config.fill = undefined;
|
|
9099
|
-
return config;
|
|
9100
|
-
}
|
|
9101
|
-
__listenChildEvents(leafer) {
|
|
9102
|
-
leafer.once([
|
|
9103
|
-
[LayoutEvent.END, this.__onReady, this],
|
|
9104
|
-
[RenderEvent.START, this.__onCreated, this],
|
|
9105
|
-
[RenderEvent.END, this.__onViewReady, this]
|
|
9106
|
-
]);
|
|
9107
|
-
if (this.realCanvas)
|
|
9108
|
-
this.__eventIds.push(leafer.on_(RenderEvent.END, this.__onChildRenderEnd, this));
|
|
9109
|
-
}
|
|
9110
|
-
};
|
|
9111
|
-
App = __decorate([
|
|
9112
|
-
registerUI()
|
|
9113
|
-
], App);
|
|
9114
|
-
|
|
9115
|
-
const downKeyMap = {};
|
|
9116
|
-
const Keyboard = {
|
|
9117
|
-
isHoldSpaceKey() {
|
|
9118
|
-
return Keyboard.isHold('Space');
|
|
9119
|
-
},
|
|
9120
|
-
isHold(code) {
|
|
9121
|
-
return downKeyMap[code];
|
|
9122
|
-
},
|
|
9123
|
-
setDownCode(code) {
|
|
9124
|
-
if (!downKeyMap[code])
|
|
9125
|
-
downKeyMap[code] = true;
|
|
9126
|
-
},
|
|
9127
|
-
setUpCode(code) {
|
|
9128
|
-
downKeyMap[code] = false;
|
|
9129
|
-
}
|
|
9130
|
-
};
|
|
9131
|
-
|
|
9132
|
-
const PointerButton = {
|
|
9133
|
-
LEFT: 1,
|
|
9134
|
-
RIGHT: 2,
|
|
9135
|
-
MIDDLE: 4,
|
|
9136
|
-
defaultLeft(event) { if (!event.buttons)
|
|
9137
|
-
event.buttons = 1; },
|
|
9138
|
-
left(event) { return event.buttons === 1; },
|
|
9139
|
-
right(event) { return event.buttons === 2; },
|
|
9140
|
-
middle(event) { return event.buttons === 4; }
|
|
9141
|
-
};
|
|
9142
|
-
|
|
9143
|
-
class UIEvent extends Event {
|
|
9144
|
-
get spaceKey() { return Keyboard.isHoldSpaceKey(); }
|
|
9145
|
-
get left() { return PointerButton.left(this); }
|
|
9146
|
-
get right() { return PointerButton.right(this); }
|
|
9147
|
-
get middle() { return PointerButton.middle(this); }
|
|
9148
|
-
constructor(params) {
|
|
9149
|
-
super(params.type);
|
|
9150
|
-
this.bubbles = true;
|
|
9151
|
-
Object.assign(this, params);
|
|
9152
|
-
}
|
|
9153
|
-
getBoxPoint(relative) {
|
|
9154
|
-
return (relative || this.current).getBoxPoint(this);
|
|
9155
|
-
}
|
|
9156
|
-
getInnerPoint(relative) {
|
|
9157
|
-
return (relative || this.current).getInnerPoint(this);
|
|
9158
|
-
}
|
|
9159
|
-
getLocalPoint(relative) {
|
|
9160
|
-
return (relative || this.current).getLocalPoint(this);
|
|
9161
|
-
}
|
|
9162
|
-
getPagePoint() {
|
|
9163
|
-
return this.current.getPagePoint(this);
|
|
9164
|
-
}
|
|
9165
|
-
getInner(relative) { return this.getInnerPoint(relative); }
|
|
9166
|
-
getLocal(relative) { return this.getLocalPoint(relative); }
|
|
9167
|
-
getPage() { return this.getPagePoint(); }
|
|
9168
|
-
static changeName(oldName, newName) {
|
|
9169
|
-
EventCreator.changeName(oldName, newName);
|
|
9170
|
-
}
|
|
9171
|
-
}
|
|
9172
|
-
|
|
9173
|
-
let PointerEvent = class PointerEvent extends UIEvent {
|
|
9174
|
-
};
|
|
9175
|
-
PointerEvent.POINTER = 'pointer';
|
|
9176
|
-
PointerEvent.BEFORE_DOWN = 'pointer.before_down';
|
|
9177
|
-
PointerEvent.BEFORE_MOVE = 'pointer.before_move';
|
|
9178
|
-
PointerEvent.BEFORE_UP = 'pointer.before_up';
|
|
9179
|
-
PointerEvent.DOWN = 'pointer.down';
|
|
9180
|
-
PointerEvent.MOVE = 'pointer.move';
|
|
9181
|
-
PointerEvent.UP = 'pointer.up';
|
|
9182
|
-
PointerEvent.OVER = 'pointer.over';
|
|
9183
|
-
PointerEvent.OUT = 'pointer.out';
|
|
9184
|
-
PointerEvent.ENTER = 'pointer.enter';
|
|
9185
|
-
PointerEvent.LEAVE = 'pointer.leave';
|
|
9186
|
-
PointerEvent.TAP = 'tap';
|
|
9187
|
-
PointerEvent.DOUBLE_TAP = 'double_tap';
|
|
9188
|
-
PointerEvent.CLICK = 'click';
|
|
9189
|
-
PointerEvent.DOUBLE_CLICK = 'double_click';
|
|
9190
|
-
PointerEvent.LONG_PRESS = 'long_press';
|
|
9191
|
-
PointerEvent.LONG_TAP = 'long_tap';
|
|
9192
|
-
PointerEvent.MENU = 'pointer.menu';
|
|
9193
|
-
PointerEvent.MENU_TAP = 'pointer.menu_tap';
|
|
9194
|
-
PointerEvent = __decorate([
|
|
9195
|
-
registerUIEvent()
|
|
9196
|
-
], PointerEvent);
|
|
9197
|
-
|
|
9198
|
-
const tempMove = {};
|
|
9199
|
-
let DragEvent = class DragEvent extends PointerEvent {
|
|
9200
|
-
static setList(data) {
|
|
9201
|
-
this.list = data instanceof LeafList ? data : new LeafList(data);
|
|
9202
|
-
}
|
|
9203
|
-
static setData(data) {
|
|
9204
|
-
this.data = data;
|
|
9205
|
-
}
|
|
9206
|
-
static getValidMove(leaf, start, total) {
|
|
9207
|
-
const { draggable, dragBounds } = leaf, move = leaf.getLocalPoint(total, null, true);
|
|
9208
|
-
PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
|
|
9209
|
-
if (dragBounds)
|
|
9210
|
-
this.getMoveInDragBounds(leaf.__localBoxBounds, dragBounds === 'parent' ? leaf.parent.boxBounds : dragBounds, move, true);
|
|
9211
|
-
if (draggable === 'x')
|
|
9212
|
-
move.y = 0;
|
|
9213
|
-
if (draggable === 'y')
|
|
9214
|
-
move.x = 0;
|
|
9215
|
-
return move;
|
|
9216
|
-
}
|
|
9217
|
-
static getMoveInDragBounds(childBox, dragBounds, move, change) {
|
|
9218
|
-
const x = childBox.x + move.x, y = childBox.y + move.y, right = x + childBox.width, bottom = y + childBox.height;
|
|
9219
|
-
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
9220
|
-
if (!change)
|
|
9221
|
-
move = Object.assign({}, move);
|
|
9222
|
-
if (BoundsHelper.includes(childBox, dragBounds)) {
|
|
9223
|
-
if (x > dragBounds.x)
|
|
9224
|
-
move.x += dragBounds.x - x;
|
|
9225
|
-
else if (right < boundsRight)
|
|
9226
|
-
move.x += boundsRight - right;
|
|
9227
|
-
if (y > dragBounds.y)
|
|
9228
|
-
move.y += dragBounds.y - y;
|
|
9229
|
-
else if (bottom < boundsBottom)
|
|
9230
|
-
move.y += boundsBottom - bottom;
|
|
9231
|
-
}
|
|
9232
|
-
else {
|
|
9233
|
-
if (x < dragBounds.x)
|
|
9234
|
-
move.x += dragBounds.x - x;
|
|
9235
|
-
else if (right > boundsRight)
|
|
9236
|
-
move.x += boundsRight - right;
|
|
9237
|
-
if (y < dragBounds.y)
|
|
9238
|
-
move.y += dragBounds.y - y;
|
|
9239
|
-
else if (bottom > boundsBottom)
|
|
9240
|
-
move.y += boundsBottom - bottom;
|
|
9241
|
-
}
|
|
9242
|
-
return move;
|
|
9243
|
-
}
|
|
9244
|
-
getPageMove(total) {
|
|
9245
|
-
this.assignMove(total);
|
|
9246
|
-
return this.current.getPagePoint(tempMove, null, true);
|
|
9247
|
-
}
|
|
9248
|
-
getInnerMove(relative, total) {
|
|
9249
|
-
if (!relative)
|
|
9250
|
-
relative = this.current;
|
|
9251
|
-
this.assignMove(total);
|
|
9252
|
-
return relative.getInnerPoint(tempMove, null, true);
|
|
9253
|
-
}
|
|
9254
|
-
getLocalMove(relative, total) {
|
|
9255
|
-
if (!relative)
|
|
9256
|
-
relative = this.current;
|
|
9257
|
-
this.assignMove(total);
|
|
9258
|
-
return relative.getLocalPoint(tempMove, null, true);
|
|
9259
|
-
}
|
|
9260
|
-
getPageTotal() {
|
|
9261
|
-
return this.getPageMove(true);
|
|
9262
|
-
}
|
|
9263
|
-
getInnerTotal(relative) {
|
|
9264
|
-
return this.getInnerMove(relative, true);
|
|
9265
|
-
}
|
|
9266
|
-
getLocalTotal(relative) {
|
|
9267
|
-
return this.getLocalMove(relative, true);
|
|
9268
|
-
}
|
|
9269
|
-
getPageBounds() {
|
|
9270
|
-
const total = this.getPageTotal(), start = this.getPagePoint(), bounds = {};
|
|
9271
|
-
BoundsHelper.set(bounds, start.x - total.x, start.y - total.y, total.x, total.y);
|
|
9272
|
-
BoundsHelper.unsign(bounds);
|
|
9273
|
-
return bounds;
|
|
9274
|
-
}
|
|
9275
|
-
assignMove(total) {
|
|
9276
|
-
tempMove.x = total ? this.totalX : this.moveX;
|
|
9277
|
-
tempMove.y = total ? this.totalY : this.moveY;
|
|
9278
|
-
}
|
|
9279
|
-
};
|
|
9280
|
-
DragEvent.BEFORE_DRAG = 'drag.before_drag';
|
|
9281
|
-
DragEvent.START = 'drag.start';
|
|
9282
|
-
DragEvent.DRAG = 'drag';
|
|
9283
|
-
DragEvent.END = 'drag.end';
|
|
9284
|
-
DragEvent.OVER = 'drag.over';
|
|
9285
|
-
DragEvent.OUT = 'drag.out';
|
|
9286
|
-
DragEvent.ENTER = 'drag.enter';
|
|
9287
|
-
DragEvent.LEAVE = 'drag.leave';
|
|
9288
|
-
DragEvent = __decorate([
|
|
9289
|
-
registerUIEvent()
|
|
9290
|
-
], DragEvent);
|
|
9291
|
-
|
|
9292
|
-
let DropEvent = class DropEvent extends PointerEvent {
|
|
9293
|
-
static setList(data) {
|
|
9294
|
-
DragEvent.setList(data);
|
|
9295
|
-
}
|
|
9296
|
-
static setData(data) {
|
|
9297
|
-
DragEvent.setData(data);
|
|
9298
|
-
}
|
|
9299
|
-
};
|
|
9300
|
-
DropEvent.DROP = 'drop';
|
|
9301
|
-
DropEvent = __decorate([
|
|
9302
|
-
registerUIEvent()
|
|
9303
|
-
], DropEvent);
|
|
9304
|
-
|
|
9305
|
-
let MoveEvent = class MoveEvent extends DragEvent {
|
|
9306
|
-
};
|
|
9307
|
-
MoveEvent.BEFORE_MOVE = 'move.before_move';
|
|
9308
|
-
MoveEvent.START = 'move.start';
|
|
9309
|
-
MoveEvent.MOVE = 'move';
|
|
9310
|
-
MoveEvent.END = 'move.end';
|
|
9311
|
-
MoveEvent = __decorate([
|
|
9312
|
-
registerUIEvent()
|
|
9313
|
-
], MoveEvent);
|
|
9314
|
-
|
|
9315
|
-
let RotateEvent = class RotateEvent extends PointerEvent {
|
|
9316
|
-
};
|
|
9317
|
-
RotateEvent.BEFORE_ROTATE = 'rotate.before_rotate';
|
|
9318
|
-
RotateEvent.START = 'rotate.start';
|
|
9319
|
-
RotateEvent.ROTATE = 'rotate';
|
|
9320
|
-
RotateEvent.END = 'rotate.end';
|
|
9321
|
-
RotateEvent = __decorate([
|
|
9322
|
-
registerUIEvent()
|
|
9323
|
-
], RotateEvent);
|
|
9324
|
-
|
|
9325
|
-
let SwipeEvent = class SwipeEvent extends DragEvent {
|
|
9326
|
-
};
|
|
9327
|
-
SwipeEvent.SWIPE = 'swipe';
|
|
9328
|
-
SwipeEvent.LEFT = 'swipe.left';
|
|
9329
|
-
SwipeEvent.RIGHT = 'swipe.right';
|
|
9330
|
-
SwipeEvent.UP = 'swipe.up';
|
|
9331
|
-
SwipeEvent.DOWN = 'swipe.down';
|
|
9332
|
-
SwipeEvent = __decorate([
|
|
9333
|
-
registerUIEvent()
|
|
9334
|
-
], SwipeEvent);
|
|
9335
|
-
|
|
9336
|
-
let ZoomEvent = class ZoomEvent extends PointerEvent {
|
|
9337
|
-
};
|
|
9338
|
-
ZoomEvent.BEFORE_ZOOM = 'zoom.before_zoom';
|
|
9339
|
-
ZoomEvent.START = 'zoom.start';
|
|
9340
|
-
ZoomEvent.ZOOM = 'zoom';
|
|
9341
|
-
ZoomEvent.END = 'zoom.end';
|
|
9342
|
-
ZoomEvent = __decorate([
|
|
9343
|
-
registerUIEvent()
|
|
9344
|
-
], ZoomEvent);
|
|
9345
|
-
|
|
9346
|
-
let KeyEvent = class KeyEvent extends UIEvent {
|
|
9347
|
-
};
|
|
9348
|
-
KeyEvent.DOWN = 'key.down';
|
|
9349
|
-
KeyEvent.HOLD = 'key.hold';
|
|
9350
|
-
KeyEvent.UP = 'key.up';
|
|
9351
|
-
KeyEvent = __decorate([
|
|
9352
|
-
registerUIEvent()
|
|
9353
|
-
], KeyEvent);
|
|
9354
|
-
|
|
9355
|
-
new LeafList();
|
|
9356
|
-
|
|
9357
|
-
Debug.get('emit');
|
|
9358
|
-
|
|
9359
|
-
const { toInnerRadiusPointOf, copy: copy$2, setRadius } = PointHelper;
|
|
9360
|
-
const inner = {};
|
|
9361
|
-
const leaf = Leaf.prototype;
|
|
9362
|
-
leaf.__hitWorld = function (point) {
|
|
9363
|
-
const data = this.__;
|
|
9364
|
-
if (!data.hitSelf)
|
|
9365
|
-
return false;
|
|
9366
|
-
const world = this.__world, layout = this.__layout;
|
|
9367
|
-
const isSmall = world.width < 10 && world.height < 10;
|
|
9368
|
-
if (data.hitRadius) {
|
|
9369
|
-
copy$2(inner, point), point = inner;
|
|
9370
|
-
setRadius(point, data.hitRadius);
|
|
9371
|
-
}
|
|
9372
|
-
toInnerRadiusPointOf(point, world, inner);
|
|
9373
|
-
if (data.hitBox || isSmall) {
|
|
9374
|
-
if (BoundsHelper.hitRadiusPoint(layout.boxBounds, inner))
|
|
9375
|
-
return true;
|
|
9376
|
-
if (isSmall)
|
|
9377
|
-
return false;
|
|
9378
|
-
}
|
|
9379
|
-
if (layout.hitCanvasChanged || !this.__hitCanvas) {
|
|
9380
|
-
this.__updateHitCanvas();
|
|
9381
|
-
if (!layout.boundsChanged)
|
|
9382
|
-
layout.hitCanvasChanged = false;
|
|
9383
|
-
}
|
|
9384
|
-
return this.__hit(inner);
|
|
9385
|
-
};
|
|
9386
|
-
leaf.__hitFill = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitFill(inner, this.__.windingRule); };
|
|
9387
|
-
leaf.__hitStroke = function (inner, strokeWidth) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitStroke(inner, strokeWidth); };
|
|
9388
|
-
leaf.__hitPixel = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitPixel(inner, this.__layout.renderBounds, this.__hitCanvas.hitScale); };
|
|
9389
|
-
leaf.__drawHitPath = function (canvas) { if (canvas)
|
|
9390
|
-
this.__drawRenderPath(canvas); };
|
|
9391
|
-
|
|
9392
|
-
const matrix = new Matrix();
|
|
9393
|
-
const ui$1 = UI.prototype;
|
|
9394
|
-
ui$1.__updateHitCanvas = function () {
|
|
9395
|
-
if (this.__box)
|
|
9396
|
-
this.__box.__updateHitCanvas();
|
|
9397
|
-
const data = this.__, { hitCanvasManager } = this.leafer || this.parent.leafer;
|
|
9398
|
-
const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === 'pixel';
|
|
9399
|
-
const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === 'pixel';
|
|
9400
|
-
const isHitPixel = isHitPixelFill || isHitPixelStroke;
|
|
9401
|
-
if (!this.__hitCanvas)
|
|
9402
|
-
this.__hitCanvas = isHitPixel ? hitCanvasManager.getPixelType(this, { contextSettings: { willReadFrequently: true } }) : hitCanvasManager.getPathType(this);
|
|
9403
|
-
const h = this.__hitCanvas;
|
|
9404
|
-
if (isHitPixel) {
|
|
9405
|
-
const { renderBounds } = this.__layout;
|
|
9406
|
-
const size = Platform.image.hitCanvasSize;
|
|
9407
|
-
const scale = h.hitScale = tempBounds$1.set(0, 0, size, size).getFitMatrix(renderBounds).a;
|
|
9408
|
-
const { x, y, width, height } = tempBounds$1.set(renderBounds).scale(scale);
|
|
9409
|
-
h.resize({ width, height, pixelRatio: 1 });
|
|
9410
|
-
h.clear();
|
|
9411
|
-
ImageManager.patternLocked = true;
|
|
9412
|
-
this.__renderShape(h, { matrix: matrix.setWith(this.__world).scaleWith(1 / scale).invertWith().translate(-x, -y) }, !isHitPixelFill, !isHitPixelStroke);
|
|
9413
|
-
ImageManager.patternLocked = false;
|
|
9414
|
-
h.resetTransform();
|
|
9415
|
-
data.__isHitPixel = true;
|
|
9416
|
-
}
|
|
9417
|
-
else {
|
|
9418
|
-
data.__isHitPixel && (data.__isHitPixel = false);
|
|
9419
|
-
}
|
|
9420
|
-
this.__drawHitPath(h);
|
|
9421
|
-
h.setStrokeOptions(data);
|
|
9422
|
-
};
|
|
9423
|
-
ui$1.__hit = function (inner) {
|
|
9424
|
-
if (this.__box && this.__box.__hit(inner))
|
|
9425
|
-
return true;
|
|
9426
|
-
const data = this.__;
|
|
9427
|
-
if (data.__isHitPixel && this.__hitPixel(inner))
|
|
9428
|
-
return true;
|
|
9429
|
-
const { hitFill } = data;
|
|
9430
|
-
const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.__isAlphaPixelFill || data.__isCanvas)))) || hitFill === 'all';
|
|
9431
|
-
if (needHitFillPath && this.__hitFill(inner))
|
|
9432
|
-
return true;
|
|
9433
|
-
const { hitStroke, __strokeWidth } = data;
|
|
9434
|
-
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.__isAlphaPixelStroke))) || hitStroke === 'all';
|
|
9435
|
-
if (!needHitFillPath && !needHitStrokePath)
|
|
9436
|
-
return false;
|
|
9437
|
-
const radiusWidth = inner.radiusX * 2;
|
|
9438
|
-
let hitWidth = radiusWidth;
|
|
9439
|
-
if (needHitStrokePath) {
|
|
9440
|
-
switch (data.strokeAlign) {
|
|
9441
|
-
case 'inside':
|
|
9442
|
-
hitWidth += __strokeWidth * 2;
|
|
9443
|
-
if (!needHitFillPath && this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
|
|
9444
|
-
return true;
|
|
9445
|
-
hitWidth = radiusWidth;
|
|
9446
|
-
break;
|
|
9447
|
-
case 'center':
|
|
9448
|
-
hitWidth += __strokeWidth;
|
|
9449
|
-
break;
|
|
9450
|
-
case 'outside':
|
|
9451
|
-
hitWidth += __strokeWidth * 2;
|
|
9452
|
-
if (!needHitFillPath) {
|
|
9453
|
-
if (!this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
|
|
9454
|
-
return true;
|
|
9455
|
-
hitWidth = radiusWidth;
|
|
9456
|
-
}
|
|
9457
|
-
break;
|
|
9458
|
-
}
|
|
9459
|
-
}
|
|
9460
|
-
return hitWidth ? this.__hitStroke(inner, hitWidth) : false;
|
|
9461
|
-
};
|
|
9462
|
-
|
|
9463
|
-
const ui = UI.prototype, rect = Rect.prototype, box$1 = Box.prototype;
|
|
9464
|
-
rect.__updateHitCanvas = box$1.__updateHitCanvas = function () {
|
|
9465
|
-
if (this.stroke || this.cornerRadius || ((this.fill || this.__.__isCanvas) && this.hitFill === 'pixel') || this.hitStroke === 'all')
|
|
9466
|
-
ui.__updateHitCanvas.call(this);
|
|
9467
|
-
else if (this.__hitCanvas)
|
|
9468
|
-
this.__hitCanvas = null;
|
|
9469
|
-
};
|
|
9470
|
-
rect.__hitFill = box$1.__hitFill = function (inner) {
|
|
9471
|
-
return this.__hitCanvas ? ui.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
|
|
9472
|
-
};
|
|
9473
|
-
|
|
9474
|
-
Text.prototype.__drawHitPath = function (canvas) {
|
|
9475
|
-
const { __lineHeight, fontSize, __baseLine, __letterSpacing, __textDrawData: data } = this.__;
|
|
9476
|
-
canvas.beginPath();
|
|
9477
|
-
if (__letterSpacing < 0)
|
|
9478
|
-
this.__drawPathByBox(canvas);
|
|
9479
|
-
else
|
|
9480
|
-
data.rows.forEach(row => canvas.rect(row.x, row.y - __baseLine, row.width, __lineHeight < fontSize ? fontSize : __lineHeight));
|
|
9481
|
-
};
|
|
9482
|
-
|
|
9483
|
-
function getSelector(ui) {
|
|
9484
|
-
return ui.leafer ? ui.leafer.selector : (Platform.selector || (Platform.selector = Creator.selector()));
|
|
9485
|
-
}
|
|
9486
|
-
Group.prototype.pick = function (hitPoint, options) {
|
|
9487
|
-
options || (options = emptyData);
|
|
9488
|
-
this.updateLayout();
|
|
9489
|
-
return getSelector(this).getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this }));
|
|
9490
|
-
};
|
|
9491
|
-
|
|
9492
|
-
const canvas = LeaferCanvasBase.prototype;
|
|
9493
|
-
canvas.hitFill = function (point, fillRule) {
|
|
9494
|
-
return fillRule ? this.context.isPointInPath(point.x, point.y, fillRule) : this.context.isPointInPath(point.x, point.y);
|
|
9495
|
-
};
|
|
9496
|
-
canvas.hitStroke = function (point, strokeWidth) {
|
|
9497
|
-
this.strokeWidth = strokeWidth;
|
|
9498
|
-
return this.context.isPointInStroke(point.x, point.y);
|
|
9499
|
-
};
|
|
9500
|
-
canvas.hitPixel = function (radiusPoint, offset, scale = 1) {
|
|
9501
|
-
let { x, y, radiusX, radiusY } = radiusPoint;
|
|
9502
|
-
if (offset)
|
|
9503
|
-
x -= offset.x, y -= offset.y;
|
|
9504
|
-
tempBounds$1.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
|
|
9505
|
-
const { data } = this.context.getImageData(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width || 1, tempBounds$1.height || 1);
|
|
9506
|
-
for (let i = 0, len = data.length; i < len; i += 4) {
|
|
9507
|
-
if (data[i + 3] > 0)
|
|
9508
|
-
return true;
|
|
9509
|
-
}
|
|
9510
|
-
return data[3] > 0;
|
|
9511
|
-
};
|
|
9512
|
-
|
|
9513
8994
|
function strokeText(stroke, ui, canvas) {
|
|
9514
8995
|
switch (ui.__.strokeAlign) {
|
|
9515
8996
|
case 'center':
|
|
@@ -9535,11 +9016,14 @@ function drawAlign(stroke, align, ui, canvas) {
|
|
|
9535
9016
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
9536
9017
|
fillText(ui, out);
|
|
9537
9018
|
out.blendMode = 'normal';
|
|
9019
|
+
copyWorld(canvas, out, ui);
|
|
9020
|
+
out.recycle(ui.__nowWorld);
|
|
9021
|
+
}
|
|
9022
|
+
function copyWorld(canvas, out, ui) {
|
|
9538
9023
|
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
9539
9024
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9540
9025
|
else
|
|
9541
9026
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
9542
|
-
out.recycle(ui.__nowWorld);
|
|
9543
9027
|
}
|
|
9544
9028
|
function drawTextStroke(ui, canvas) {
|
|
9545
9029
|
let row, data = ui.__.__textDrawData;
|
|
@@ -9608,9 +9092,8 @@ function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
|
9608
9092
|
Paint.strokeArrow(stroke, ui, canvas);
|
|
9609
9093
|
}
|
|
9610
9094
|
function drawInside(stroke, ui, canvas) {
|
|
9611
|
-
const data = ui.__;
|
|
9612
9095
|
canvas.save();
|
|
9613
|
-
|
|
9096
|
+
canvas.clipUI(ui);
|
|
9614
9097
|
drawCenter(stroke, 2, ui, canvas);
|
|
9615
9098
|
canvas.restore();
|
|
9616
9099
|
}
|
|
@@ -9624,12 +9107,9 @@ function drawOutside(stroke, ui, canvas) {
|
|
|
9624
9107
|
const out = canvas.getSameCanvas(true, true);
|
|
9625
9108
|
ui.__drawRenderPath(out);
|
|
9626
9109
|
drawCenter(stroke, 2, ui, out);
|
|
9627
|
-
|
|
9110
|
+
out.clipUI(data);
|
|
9628
9111
|
out.clearWorld(renderBounds);
|
|
9629
|
-
|
|
9630
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9631
|
-
else
|
|
9632
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
9112
|
+
copyWorld(canvas, out, ui);
|
|
9633
9113
|
out.recycle(ui.__nowWorld);
|
|
9634
9114
|
}
|
|
9635
9115
|
}
|
|
@@ -9685,9 +9165,7 @@ function compute(attrName, ui) {
|
|
|
9685
9165
|
paints = [paints];
|
|
9686
9166
|
recycleMap = PaintImage.recycleImage(attrName, data);
|
|
9687
9167
|
for (let i = 0, len = paints.length, item; i < len; i++) {
|
|
9688
|
-
item = getLeafPaint(attrName, paints[i], ui);
|
|
9689
|
-
if (item)
|
|
9690
|
-
leafPaints.push(item);
|
|
9168
|
+
(item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item);
|
|
9691
9169
|
}
|
|
9692
9170
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
9693
9171
|
if (leafPaints.length) {
|
|
@@ -9725,8 +9203,8 @@ function getLeafPaint(attrName, paint, ui) {
|
|
|
9725
9203
|
data = PaintGradient.conicGradient(paint, boxBounds);
|
|
9726
9204
|
break;
|
|
9727
9205
|
case 'solid':
|
|
9728
|
-
const { type,
|
|
9729
|
-
data = { type,
|
|
9206
|
+
const { type, color, opacity } = paint;
|
|
9207
|
+
data = { type, style: ColorConvert.string(color, opacity) };
|
|
9730
9208
|
break;
|
|
9731
9209
|
default:
|
|
9732
9210
|
if (paint.r !== undefined)
|
|
@@ -10103,7 +9581,7 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
10103
9581
|
}
|
|
10104
9582
|
function drawImage(ui, canvas, paint, data) {
|
|
10105
9583
|
canvas.save();
|
|
10106
|
-
|
|
9584
|
+
canvas.clipUI(ui);
|
|
10107
9585
|
if (paint.blendMode)
|
|
10108
9586
|
canvas.blendMode = paint.blendMode;
|
|
10109
9587
|
if (data.opacity)
|
|
@@ -10268,12 +9746,10 @@ function shadow(ui, current, shape) {
|
|
|
10268
9746
|
}
|
|
10269
9747
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
|
|
10270
9748
|
}
|
|
10271
|
-
if (ui.__worldFlipped)
|
|
9749
|
+
if (ui.__worldFlipped)
|
|
10272
9750
|
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
10273
|
-
|
|
10274
|
-
else {
|
|
9751
|
+
else
|
|
10275
9752
|
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
10276
|
-
}
|
|
10277
9753
|
if (end && index < end)
|
|
10278
9754
|
other.clearWorld(copyBounds, true);
|
|
10279
9755
|
});
|
|
@@ -10332,12 +9808,10 @@ function innerShadow(ui, current, shape) {
|
|
|
10332
9808
|
copyBounds = bounds;
|
|
10333
9809
|
}
|
|
10334
9810
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
|
|
10335
|
-
if (ui.__worldFlipped)
|
|
9811
|
+
if (ui.__worldFlipped)
|
|
10336
9812
|
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
10337
|
-
|
|
10338
|
-
else {
|
|
9813
|
+
else
|
|
10339
9814
|
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
10340
|
-
}
|
|
10341
9815
|
if (end && index < end)
|
|
10342
9816
|
other.clearWorld(copyBounds, true);
|
|
10343
9817
|
});
|