@leafer-draw/miniapp 1.6.3 → 1.6.4
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/miniapp.cjs +17 -27
- package/dist/miniapp.esm.js +18 -28
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.esm.min.js.map +1 -1
- package/dist/miniapp.min.cjs +1 -1
- package/dist/miniapp.min.cjs.map +1 -1
- package/dist/miniapp.module.js +85 -611
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +9 -9
package/dist/miniapp.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.4";
|
|
6234
6237
|
|
|
6235
6238
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6236
6239
|
get allowBackgroundColor() { return false; }
|
|
@@ -7508,7 +7511,7 @@ const UIRender = {
|
|
|
7508
7511
|
__drawAfterFill(canvas, options) {
|
|
7509
7512
|
if (this.__.__clipAfterFill) {
|
|
7510
7513
|
canvas.save();
|
|
7511
|
-
|
|
7514
|
+
canvas.clipUI();
|
|
7512
7515
|
this.__drawContent(canvas, options);
|
|
7513
7516
|
canvas.restore();
|
|
7514
7517
|
}
|
|
@@ -8374,8 +8377,8 @@ Rect = __decorate([
|
|
|
8374
8377
|
registerUI()
|
|
8375
8378
|
], Rect);
|
|
8376
8379
|
|
|
8377
|
-
const { copy: copy$
|
|
8378
|
-
const rect
|
|
8380
|
+
const { copy: copy$2, add, includes: includes$1 } = BoundsHelper;
|
|
8381
|
+
const rect = Rect.prototype, group = Group.prototype;
|
|
8379
8382
|
const childrenRenderBounds = {};
|
|
8380
8383
|
let Box = class Box extends Group {
|
|
8381
8384
|
get __tag() { return 'Box'; }
|
|
@@ -8420,7 +8423,7 @@ let Box = class Box extends Group {
|
|
|
8420
8423
|
const { renderBounds } = this.__layout;
|
|
8421
8424
|
if (this.children.length) {
|
|
8422
8425
|
super.__updateRenderBounds();
|
|
8423
|
-
copy$
|
|
8426
|
+
copy$2(childrenRenderBounds, renderBounds);
|
|
8424
8427
|
this.__updateRectRenderBounds();
|
|
8425
8428
|
isOverflow = !includes$1(renderBounds, childrenRenderBounds);
|
|
8426
8429
|
if (isOverflow && this.__.overflow !== 'hide')
|
|
@@ -8472,25 +8475,25 @@ __decorate([
|
|
|
8472
8475
|
affectRenderBoundsType('show')
|
|
8473
8476
|
], Box.prototype, "overflow", void 0);
|
|
8474
8477
|
__decorate([
|
|
8475
|
-
rewrite(rect
|
|
8478
|
+
rewrite(rect.__updateStrokeSpread)
|
|
8476
8479
|
], Box.prototype, "__updateStrokeSpread", null);
|
|
8477
8480
|
__decorate([
|
|
8478
|
-
rewrite(rect
|
|
8481
|
+
rewrite(rect.__updateRenderSpread)
|
|
8479
8482
|
], Box.prototype, "__updateRectRenderSpread", null);
|
|
8480
8483
|
__decorate([
|
|
8481
|
-
rewrite(rect
|
|
8484
|
+
rewrite(rect.__updateBoxBounds)
|
|
8482
8485
|
], Box.prototype, "__updateRectBoxBounds", null);
|
|
8483
8486
|
__decorate([
|
|
8484
|
-
rewrite(rect
|
|
8487
|
+
rewrite(rect.__updateStrokeBounds)
|
|
8485
8488
|
], Box.prototype, "__updateStrokeBounds", null);
|
|
8486
8489
|
__decorate([
|
|
8487
|
-
rewrite(rect
|
|
8490
|
+
rewrite(rect.__updateRenderBounds)
|
|
8488
8491
|
], Box.prototype, "__updateRectRenderBounds", null);
|
|
8489
8492
|
__decorate([
|
|
8490
|
-
rewrite(rect
|
|
8493
|
+
rewrite(rect.__updateChange)
|
|
8491
8494
|
], Box.prototype, "__updateRectChange", null);
|
|
8492
8495
|
__decorate([
|
|
8493
|
-
rewrite(rect
|
|
8496
|
+
rewrite(rect.__render)
|
|
8494
8497
|
], Box.prototype, "__renderRect", null);
|
|
8495
8498
|
__decorate([
|
|
8496
8499
|
rewrite(group.__render)
|
|
@@ -8993,6 +8996,9 @@ __decorate([
|
|
|
8993
8996
|
__decorate([
|
|
8994
8997
|
boundsType('show')
|
|
8995
8998
|
], Text.prototype, "textOverflow", void 0);
|
|
8999
|
+
__decorate([
|
|
9000
|
+
surfaceType(false)
|
|
9001
|
+
], Text.prototype, "textEditing", void 0);
|
|
8996
9002
|
Text = __decorate([
|
|
8997
9003
|
registerUI()
|
|
8998
9004
|
], Text);
|
|
@@ -9124,531 +9130,6 @@ function fillPathOrText(ui, canvas) {
|
|
|
9124
9130
|
ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
|
|
9125
9131
|
}
|
|
9126
9132
|
|
|
9127
|
-
let App = class App extends Leafer {
|
|
9128
|
-
get __tag() { return 'App'; }
|
|
9129
|
-
get isApp() { return true; }
|
|
9130
|
-
constructor(userConfig, data) {
|
|
9131
|
-
super(userConfig, data);
|
|
9132
|
-
}
|
|
9133
|
-
init(userConfig, parentApp) {
|
|
9134
|
-
super.init(userConfig, parentApp);
|
|
9135
|
-
if (userConfig) {
|
|
9136
|
-
const { ground, tree, sky, editor } = userConfig;
|
|
9137
|
-
if (ground)
|
|
9138
|
-
this.ground = this.addLeafer(ground);
|
|
9139
|
-
if (tree || editor)
|
|
9140
|
-
this.tree = this.addLeafer(tree || { type: userConfig.type || 'design' });
|
|
9141
|
-
if (sky || editor)
|
|
9142
|
-
this.sky = this.addLeafer(sky);
|
|
9143
|
-
if (editor)
|
|
9144
|
-
Creator.editor(editor, this);
|
|
9145
|
-
}
|
|
9146
|
-
}
|
|
9147
|
-
__setApp() {
|
|
9148
|
-
const { canvas } = this;
|
|
9149
|
-
const { realCanvas, view } = this.config;
|
|
9150
|
-
if (realCanvas || view === this.canvas.view || !canvas.parentView)
|
|
9151
|
-
this.realCanvas = true;
|
|
9152
|
-
else
|
|
9153
|
-
canvas.unrealCanvas();
|
|
9154
|
-
this.leafer = this;
|
|
9155
|
-
this.watcher.disable();
|
|
9156
|
-
this.layouter.disable();
|
|
9157
|
-
}
|
|
9158
|
-
__updateLocalBounds() {
|
|
9159
|
-
this.forEach(leafer => leafer.updateLayout());
|
|
9160
|
-
super.__updateLocalBounds();
|
|
9161
|
-
}
|
|
9162
|
-
start() {
|
|
9163
|
-
super.start();
|
|
9164
|
-
this.forEach(leafer => leafer.start());
|
|
9165
|
-
}
|
|
9166
|
-
stop() {
|
|
9167
|
-
this.forEach(leafer => leafer.stop());
|
|
9168
|
-
super.stop();
|
|
9169
|
-
}
|
|
9170
|
-
unlockLayout() {
|
|
9171
|
-
super.unlockLayout();
|
|
9172
|
-
this.forEach(leafer => leafer.unlockLayout());
|
|
9173
|
-
}
|
|
9174
|
-
lockLayout() {
|
|
9175
|
-
super.lockLayout();
|
|
9176
|
-
this.forEach(leafer => leafer.lockLayout());
|
|
9177
|
-
}
|
|
9178
|
-
forceRender(bounds, sync) {
|
|
9179
|
-
this.forEach(leafer => leafer.forceRender(bounds, sync));
|
|
9180
|
-
}
|
|
9181
|
-
addLeafer(merge) {
|
|
9182
|
-
const leafer = new Leafer(merge);
|
|
9183
|
-
this.add(leafer);
|
|
9184
|
-
return leafer;
|
|
9185
|
-
}
|
|
9186
|
-
add(leafer, index) {
|
|
9187
|
-
if (!leafer.view) {
|
|
9188
|
-
if (this.realCanvas && !this.canvas.bounds) {
|
|
9189
|
-
setTimeout(() => this.add(leafer, index), 10);
|
|
9190
|
-
return;
|
|
9191
|
-
}
|
|
9192
|
-
leafer.init(this.__getChildConfig(leafer.userConfig), this);
|
|
9193
|
-
}
|
|
9194
|
-
super.add(leafer, index);
|
|
9195
|
-
if (index !== undefined)
|
|
9196
|
-
leafer.canvas.childIndex = index;
|
|
9197
|
-
this.__listenChildEvents(leafer);
|
|
9198
|
-
}
|
|
9199
|
-
forEach(fn) {
|
|
9200
|
-
this.children.forEach(fn);
|
|
9201
|
-
}
|
|
9202
|
-
__onCreated() {
|
|
9203
|
-
this.created = this.children.every(child => child.created);
|
|
9204
|
-
}
|
|
9205
|
-
__onReady() {
|
|
9206
|
-
if (this.children.every(child => child.ready))
|
|
9207
|
-
super.__onReady();
|
|
9208
|
-
}
|
|
9209
|
-
__onViewReady() {
|
|
9210
|
-
if (this.children.every(child => child.viewReady))
|
|
9211
|
-
super.__onViewReady();
|
|
9212
|
-
}
|
|
9213
|
-
__onChildRenderEnd(e) {
|
|
9214
|
-
this.renderer.addBlock(e.renderBounds);
|
|
9215
|
-
if (this.viewReady)
|
|
9216
|
-
this.renderer.update();
|
|
9217
|
-
}
|
|
9218
|
-
__render(canvas, options) {
|
|
9219
|
-
if (canvas.context)
|
|
9220
|
-
this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options && options.bounds));
|
|
9221
|
-
}
|
|
9222
|
-
__onResize(event) {
|
|
9223
|
-
this.forEach(leafer => leafer.resize(event));
|
|
9224
|
-
super.__onResize(event);
|
|
9225
|
-
}
|
|
9226
|
-
updateLayout() {
|
|
9227
|
-
this.forEach(leafer => leafer.updateLayout());
|
|
9228
|
-
}
|
|
9229
|
-
__getChildConfig(userConfig) {
|
|
9230
|
-
const config = Object.assign({}, this.config);
|
|
9231
|
-
config.hittable = config.realCanvas = undefined;
|
|
9232
|
-
if (userConfig)
|
|
9233
|
-
DataHelper.assign(config, userConfig);
|
|
9234
|
-
if (this.autoLayout)
|
|
9235
|
-
DataHelper.copyAttrs(config, this, canvasSizeAttrs);
|
|
9236
|
-
config.view = this.realCanvas ? undefined : this.view;
|
|
9237
|
-
config.fill = undefined;
|
|
9238
|
-
return config;
|
|
9239
|
-
}
|
|
9240
|
-
__listenChildEvents(leafer) {
|
|
9241
|
-
leafer.once([
|
|
9242
|
-
[LayoutEvent.END, this.__onReady, this],
|
|
9243
|
-
[RenderEvent.START, this.__onCreated, this],
|
|
9244
|
-
[RenderEvent.END, this.__onViewReady, this]
|
|
9245
|
-
]);
|
|
9246
|
-
if (this.realCanvas)
|
|
9247
|
-
this.__eventIds.push(leafer.on_(RenderEvent.END, this.__onChildRenderEnd, this));
|
|
9248
|
-
}
|
|
9249
|
-
};
|
|
9250
|
-
App = __decorate([
|
|
9251
|
-
registerUI()
|
|
9252
|
-
], App);
|
|
9253
|
-
|
|
9254
|
-
const downKeyMap = {};
|
|
9255
|
-
const Keyboard = {
|
|
9256
|
-
isHoldSpaceKey() {
|
|
9257
|
-
return Keyboard.isHold('Space');
|
|
9258
|
-
},
|
|
9259
|
-
isHold(code) {
|
|
9260
|
-
return downKeyMap[code];
|
|
9261
|
-
},
|
|
9262
|
-
setDownCode(code) {
|
|
9263
|
-
if (!downKeyMap[code])
|
|
9264
|
-
downKeyMap[code] = true;
|
|
9265
|
-
},
|
|
9266
|
-
setUpCode(code) {
|
|
9267
|
-
downKeyMap[code] = false;
|
|
9268
|
-
}
|
|
9269
|
-
};
|
|
9270
|
-
|
|
9271
|
-
const PointerButton = {
|
|
9272
|
-
LEFT: 1,
|
|
9273
|
-
RIGHT: 2,
|
|
9274
|
-
MIDDLE: 4,
|
|
9275
|
-
defaultLeft(event) { if (!event.buttons)
|
|
9276
|
-
event.buttons = 1; },
|
|
9277
|
-
left(event) { return event.buttons === 1; },
|
|
9278
|
-
right(event) { return event.buttons === 2; },
|
|
9279
|
-
middle(event) { return event.buttons === 4; }
|
|
9280
|
-
};
|
|
9281
|
-
|
|
9282
|
-
class UIEvent extends Event {
|
|
9283
|
-
get spaceKey() { return Keyboard.isHoldSpaceKey(); }
|
|
9284
|
-
get left() { return PointerButton.left(this); }
|
|
9285
|
-
get right() { return PointerButton.right(this); }
|
|
9286
|
-
get middle() { return PointerButton.middle(this); }
|
|
9287
|
-
constructor(params) {
|
|
9288
|
-
super(params.type);
|
|
9289
|
-
this.bubbles = true;
|
|
9290
|
-
Object.assign(this, params);
|
|
9291
|
-
}
|
|
9292
|
-
getBoxPoint(relative) {
|
|
9293
|
-
return (relative || this.current).getBoxPoint(this);
|
|
9294
|
-
}
|
|
9295
|
-
getInnerPoint(relative) {
|
|
9296
|
-
return (relative || this.current).getInnerPoint(this);
|
|
9297
|
-
}
|
|
9298
|
-
getLocalPoint(relative) {
|
|
9299
|
-
return (relative || this.current).getLocalPoint(this);
|
|
9300
|
-
}
|
|
9301
|
-
getPagePoint() {
|
|
9302
|
-
return this.current.getPagePoint(this);
|
|
9303
|
-
}
|
|
9304
|
-
getInner(relative) { return this.getInnerPoint(relative); }
|
|
9305
|
-
getLocal(relative) { return this.getLocalPoint(relative); }
|
|
9306
|
-
getPage() { return this.getPagePoint(); }
|
|
9307
|
-
static changeName(oldName, newName) {
|
|
9308
|
-
EventCreator.changeName(oldName, newName);
|
|
9309
|
-
}
|
|
9310
|
-
}
|
|
9311
|
-
|
|
9312
|
-
let PointerEvent = class PointerEvent extends UIEvent {
|
|
9313
|
-
};
|
|
9314
|
-
PointerEvent.POINTER = 'pointer';
|
|
9315
|
-
PointerEvent.BEFORE_DOWN = 'pointer.before_down';
|
|
9316
|
-
PointerEvent.BEFORE_MOVE = 'pointer.before_move';
|
|
9317
|
-
PointerEvent.BEFORE_UP = 'pointer.before_up';
|
|
9318
|
-
PointerEvent.DOWN = 'pointer.down';
|
|
9319
|
-
PointerEvent.MOVE = 'pointer.move';
|
|
9320
|
-
PointerEvent.UP = 'pointer.up';
|
|
9321
|
-
PointerEvent.OVER = 'pointer.over';
|
|
9322
|
-
PointerEvent.OUT = 'pointer.out';
|
|
9323
|
-
PointerEvent.ENTER = 'pointer.enter';
|
|
9324
|
-
PointerEvent.LEAVE = 'pointer.leave';
|
|
9325
|
-
PointerEvent.TAP = 'tap';
|
|
9326
|
-
PointerEvent.DOUBLE_TAP = 'double_tap';
|
|
9327
|
-
PointerEvent.CLICK = 'click';
|
|
9328
|
-
PointerEvent.DOUBLE_CLICK = 'double_click';
|
|
9329
|
-
PointerEvent.LONG_PRESS = 'long_press';
|
|
9330
|
-
PointerEvent.LONG_TAP = 'long_tap';
|
|
9331
|
-
PointerEvent.MENU = 'pointer.menu';
|
|
9332
|
-
PointerEvent.MENU_TAP = 'pointer.menu_tap';
|
|
9333
|
-
PointerEvent = __decorate([
|
|
9334
|
-
registerUIEvent()
|
|
9335
|
-
], PointerEvent);
|
|
9336
|
-
|
|
9337
|
-
const tempMove = {};
|
|
9338
|
-
let DragEvent = class DragEvent extends PointerEvent {
|
|
9339
|
-
static setList(data) {
|
|
9340
|
-
this.list = data instanceof LeafList ? data : new LeafList(data);
|
|
9341
|
-
}
|
|
9342
|
-
static setData(data) {
|
|
9343
|
-
this.data = data;
|
|
9344
|
-
}
|
|
9345
|
-
static getValidMove(leaf, start, total) {
|
|
9346
|
-
const { draggable, dragBounds } = leaf, move = leaf.getLocalPoint(total, null, true);
|
|
9347
|
-
PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
|
|
9348
|
-
if (dragBounds)
|
|
9349
|
-
this.getMoveInDragBounds(leaf.__localBoxBounds, dragBounds === 'parent' ? leaf.parent.boxBounds : dragBounds, move, true);
|
|
9350
|
-
if (draggable === 'x')
|
|
9351
|
-
move.y = 0;
|
|
9352
|
-
if (draggable === 'y')
|
|
9353
|
-
move.x = 0;
|
|
9354
|
-
return move;
|
|
9355
|
-
}
|
|
9356
|
-
static getMoveInDragBounds(childBox, dragBounds, move, change) {
|
|
9357
|
-
const x = childBox.x + move.x, y = childBox.y + move.y, right = x + childBox.width, bottom = y + childBox.height;
|
|
9358
|
-
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
9359
|
-
if (!change)
|
|
9360
|
-
move = Object.assign({}, move);
|
|
9361
|
-
if (BoundsHelper.includes(childBox, dragBounds)) {
|
|
9362
|
-
if (x > dragBounds.x)
|
|
9363
|
-
move.x += dragBounds.x - x;
|
|
9364
|
-
else if (right < boundsRight)
|
|
9365
|
-
move.x += boundsRight - right;
|
|
9366
|
-
if (y > dragBounds.y)
|
|
9367
|
-
move.y += dragBounds.y - y;
|
|
9368
|
-
else if (bottom < boundsBottom)
|
|
9369
|
-
move.y += boundsBottom - bottom;
|
|
9370
|
-
}
|
|
9371
|
-
else {
|
|
9372
|
-
if (x < dragBounds.x)
|
|
9373
|
-
move.x += dragBounds.x - x;
|
|
9374
|
-
else if (right > boundsRight)
|
|
9375
|
-
move.x += boundsRight - right;
|
|
9376
|
-
if (y < dragBounds.y)
|
|
9377
|
-
move.y += dragBounds.y - y;
|
|
9378
|
-
else if (bottom > boundsBottom)
|
|
9379
|
-
move.y += boundsBottom - bottom;
|
|
9380
|
-
}
|
|
9381
|
-
return move;
|
|
9382
|
-
}
|
|
9383
|
-
getPageMove(total) {
|
|
9384
|
-
this.assignMove(total);
|
|
9385
|
-
return this.current.getPagePoint(tempMove, null, true);
|
|
9386
|
-
}
|
|
9387
|
-
getInnerMove(relative, total) {
|
|
9388
|
-
if (!relative)
|
|
9389
|
-
relative = this.current;
|
|
9390
|
-
this.assignMove(total);
|
|
9391
|
-
return relative.getInnerPoint(tempMove, null, true);
|
|
9392
|
-
}
|
|
9393
|
-
getLocalMove(relative, total) {
|
|
9394
|
-
if (!relative)
|
|
9395
|
-
relative = this.current;
|
|
9396
|
-
this.assignMove(total);
|
|
9397
|
-
return relative.getLocalPoint(tempMove, null, true);
|
|
9398
|
-
}
|
|
9399
|
-
getPageTotal() {
|
|
9400
|
-
return this.getPageMove(true);
|
|
9401
|
-
}
|
|
9402
|
-
getInnerTotal(relative) {
|
|
9403
|
-
return this.getInnerMove(relative, true);
|
|
9404
|
-
}
|
|
9405
|
-
getLocalTotal(relative) {
|
|
9406
|
-
return this.getLocalMove(relative, true);
|
|
9407
|
-
}
|
|
9408
|
-
getPageBounds() {
|
|
9409
|
-
const total = this.getPageTotal(), start = this.getPagePoint(), bounds = {};
|
|
9410
|
-
BoundsHelper.set(bounds, start.x - total.x, start.y - total.y, total.x, total.y);
|
|
9411
|
-
BoundsHelper.unsign(bounds);
|
|
9412
|
-
return bounds;
|
|
9413
|
-
}
|
|
9414
|
-
assignMove(total) {
|
|
9415
|
-
tempMove.x = total ? this.totalX : this.moveX;
|
|
9416
|
-
tempMove.y = total ? this.totalY : this.moveY;
|
|
9417
|
-
}
|
|
9418
|
-
};
|
|
9419
|
-
DragEvent.BEFORE_DRAG = 'drag.before_drag';
|
|
9420
|
-
DragEvent.START = 'drag.start';
|
|
9421
|
-
DragEvent.DRAG = 'drag';
|
|
9422
|
-
DragEvent.END = 'drag.end';
|
|
9423
|
-
DragEvent.OVER = 'drag.over';
|
|
9424
|
-
DragEvent.OUT = 'drag.out';
|
|
9425
|
-
DragEvent.ENTER = 'drag.enter';
|
|
9426
|
-
DragEvent.LEAVE = 'drag.leave';
|
|
9427
|
-
DragEvent = __decorate([
|
|
9428
|
-
registerUIEvent()
|
|
9429
|
-
], DragEvent);
|
|
9430
|
-
|
|
9431
|
-
let DropEvent = class DropEvent extends PointerEvent {
|
|
9432
|
-
static setList(data) {
|
|
9433
|
-
DragEvent.setList(data);
|
|
9434
|
-
}
|
|
9435
|
-
static setData(data) {
|
|
9436
|
-
DragEvent.setData(data);
|
|
9437
|
-
}
|
|
9438
|
-
};
|
|
9439
|
-
DropEvent.DROP = 'drop';
|
|
9440
|
-
DropEvent = __decorate([
|
|
9441
|
-
registerUIEvent()
|
|
9442
|
-
], DropEvent);
|
|
9443
|
-
|
|
9444
|
-
let MoveEvent = class MoveEvent extends DragEvent {
|
|
9445
|
-
};
|
|
9446
|
-
MoveEvent.BEFORE_MOVE = 'move.before_move';
|
|
9447
|
-
MoveEvent.START = 'move.start';
|
|
9448
|
-
MoveEvent.MOVE = 'move';
|
|
9449
|
-
MoveEvent.END = 'move.end';
|
|
9450
|
-
MoveEvent = __decorate([
|
|
9451
|
-
registerUIEvent()
|
|
9452
|
-
], MoveEvent);
|
|
9453
|
-
|
|
9454
|
-
let RotateEvent = class RotateEvent extends PointerEvent {
|
|
9455
|
-
};
|
|
9456
|
-
RotateEvent.BEFORE_ROTATE = 'rotate.before_rotate';
|
|
9457
|
-
RotateEvent.START = 'rotate.start';
|
|
9458
|
-
RotateEvent.ROTATE = 'rotate';
|
|
9459
|
-
RotateEvent.END = 'rotate.end';
|
|
9460
|
-
RotateEvent = __decorate([
|
|
9461
|
-
registerUIEvent()
|
|
9462
|
-
], RotateEvent);
|
|
9463
|
-
|
|
9464
|
-
let SwipeEvent = class SwipeEvent extends DragEvent {
|
|
9465
|
-
};
|
|
9466
|
-
SwipeEvent.SWIPE = 'swipe';
|
|
9467
|
-
SwipeEvent.LEFT = 'swipe.left';
|
|
9468
|
-
SwipeEvent.RIGHT = 'swipe.right';
|
|
9469
|
-
SwipeEvent.UP = 'swipe.up';
|
|
9470
|
-
SwipeEvent.DOWN = 'swipe.down';
|
|
9471
|
-
SwipeEvent = __decorate([
|
|
9472
|
-
registerUIEvent()
|
|
9473
|
-
], SwipeEvent);
|
|
9474
|
-
|
|
9475
|
-
let ZoomEvent = class ZoomEvent extends PointerEvent {
|
|
9476
|
-
};
|
|
9477
|
-
ZoomEvent.BEFORE_ZOOM = 'zoom.before_zoom';
|
|
9478
|
-
ZoomEvent.START = 'zoom.start';
|
|
9479
|
-
ZoomEvent.ZOOM = 'zoom';
|
|
9480
|
-
ZoomEvent.END = 'zoom.end';
|
|
9481
|
-
ZoomEvent = __decorate([
|
|
9482
|
-
registerUIEvent()
|
|
9483
|
-
], ZoomEvent);
|
|
9484
|
-
|
|
9485
|
-
let KeyEvent = class KeyEvent extends UIEvent {
|
|
9486
|
-
};
|
|
9487
|
-
KeyEvent.DOWN = 'key.down';
|
|
9488
|
-
KeyEvent.HOLD = 'key.hold';
|
|
9489
|
-
KeyEvent.UP = 'key.up';
|
|
9490
|
-
KeyEvent = __decorate([
|
|
9491
|
-
registerUIEvent()
|
|
9492
|
-
], KeyEvent);
|
|
9493
|
-
|
|
9494
|
-
new LeafList();
|
|
9495
|
-
|
|
9496
|
-
Debug.get('emit');
|
|
9497
|
-
|
|
9498
|
-
const { toInnerRadiusPointOf, copy: copy$2, setRadius } = PointHelper;
|
|
9499
|
-
const inner = {};
|
|
9500
|
-
const leaf = Leaf.prototype;
|
|
9501
|
-
leaf.__hitWorld = function (point) {
|
|
9502
|
-
const data = this.__;
|
|
9503
|
-
if (!data.hitSelf)
|
|
9504
|
-
return false;
|
|
9505
|
-
const world = this.__world, layout = this.__layout;
|
|
9506
|
-
const isSmall = world.width < 10 && world.height < 10;
|
|
9507
|
-
if (data.hitRadius) {
|
|
9508
|
-
copy$2(inner, point), point = inner;
|
|
9509
|
-
setRadius(point, data.hitRadius);
|
|
9510
|
-
}
|
|
9511
|
-
toInnerRadiusPointOf(point, world, inner);
|
|
9512
|
-
if (data.hitBox || isSmall) {
|
|
9513
|
-
if (BoundsHelper.hitRadiusPoint(layout.boxBounds, inner))
|
|
9514
|
-
return true;
|
|
9515
|
-
if (isSmall)
|
|
9516
|
-
return false;
|
|
9517
|
-
}
|
|
9518
|
-
if (layout.hitCanvasChanged || !this.__hitCanvas) {
|
|
9519
|
-
this.__updateHitCanvas();
|
|
9520
|
-
if (!layout.boundsChanged)
|
|
9521
|
-
layout.hitCanvasChanged = false;
|
|
9522
|
-
}
|
|
9523
|
-
return this.__hit(inner);
|
|
9524
|
-
};
|
|
9525
|
-
leaf.__hitFill = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitFill(inner, this.__.windingRule); };
|
|
9526
|
-
leaf.__hitStroke = function (inner, strokeWidth) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitStroke(inner, strokeWidth); };
|
|
9527
|
-
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); };
|
|
9528
|
-
leaf.__drawHitPath = function (canvas) { if (canvas)
|
|
9529
|
-
this.__drawRenderPath(canvas); };
|
|
9530
|
-
|
|
9531
|
-
const matrix = new Matrix();
|
|
9532
|
-
const ui$1 = UI.prototype;
|
|
9533
|
-
ui$1.__updateHitCanvas = function () {
|
|
9534
|
-
if (this.__box)
|
|
9535
|
-
this.__box.__updateHitCanvas();
|
|
9536
|
-
const data = this.__, { hitCanvasManager } = this.leafer || this.parent.leafer;
|
|
9537
|
-
const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === 'pixel';
|
|
9538
|
-
const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === 'pixel';
|
|
9539
|
-
const isHitPixel = isHitPixelFill || isHitPixelStroke;
|
|
9540
|
-
if (!this.__hitCanvas)
|
|
9541
|
-
this.__hitCanvas = isHitPixel ? hitCanvasManager.getPixelType(this, { contextSettings: { willReadFrequently: true } }) : hitCanvasManager.getPathType(this);
|
|
9542
|
-
const h = this.__hitCanvas;
|
|
9543
|
-
if (isHitPixel) {
|
|
9544
|
-
const { renderBounds } = this.__layout;
|
|
9545
|
-
const size = Platform.image.hitCanvasSize;
|
|
9546
|
-
const scale = h.hitScale = tempBounds$1.set(0, 0, size, size).getFitMatrix(renderBounds).a;
|
|
9547
|
-
const { x, y, width, height } = tempBounds$1.set(renderBounds).scale(scale);
|
|
9548
|
-
h.resize({ width, height, pixelRatio: 1 });
|
|
9549
|
-
h.clear();
|
|
9550
|
-
ImageManager.patternLocked = true;
|
|
9551
|
-
this.__renderShape(h, { matrix: matrix.setWith(this.__world).scaleWith(1 / scale).invertWith().translate(-x, -y) }, !isHitPixelFill, !isHitPixelStroke);
|
|
9552
|
-
ImageManager.patternLocked = false;
|
|
9553
|
-
h.resetTransform();
|
|
9554
|
-
data.__isHitPixel = true;
|
|
9555
|
-
}
|
|
9556
|
-
else {
|
|
9557
|
-
data.__isHitPixel && (data.__isHitPixel = false);
|
|
9558
|
-
}
|
|
9559
|
-
this.__drawHitPath(h);
|
|
9560
|
-
h.setStrokeOptions(data);
|
|
9561
|
-
};
|
|
9562
|
-
ui$1.__hit = function (inner) {
|
|
9563
|
-
if (this.__box && this.__box.__hit(inner))
|
|
9564
|
-
return true;
|
|
9565
|
-
const data = this.__;
|
|
9566
|
-
if (data.__isHitPixel && this.__hitPixel(inner))
|
|
9567
|
-
return true;
|
|
9568
|
-
const { hitFill } = data;
|
|
9569
|
-
const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.__isAlphaPixelFill || data.__isCanvas)))) || hitFill === 'all';
|
|
9570
|
-
if (needHitFillPath && this.__hitFill(inner))
|
|
9571
|
-
return true;
|
|
9572
|
-
const { hitStroke, __strokeWidth } = data;
|
|
9573
|
-
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.__isAlphaPixelStroke))) || hitStroke === 'all';
|
|
9574
|
-
if (!needHitFillPath && !needHitStrokePath)
|
|
9575
|
-
return false;
|
|
9576
|
-
const radiusWidth = inner.radiusX * 2;
|
|
9577
|
-
let hitWidth = radiusWidth;
|
|
9578
|
-
if (needHitStrokePath) {
|
|
9579
|
-
switch (data.strokeAlign) {
|
|
9580
|
-
case 'inside':
|
|
9581
|
-
hitWidth += __strokeWidth * 2;
|
|
9582
|
-
if (!needHitFillPath && this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
|
|
9583
|
-
return true;
|
|
9584
|
-
hitWidth = radiusWidth;
|
|
9585
|
-
break;
|
|
9586
|
-
case 'center':
|
|
9587
|
-
hitWidth += __strokeWidth;
|
|
9588
|
-
break;
|
|
9589
|
-
case 'outside':
|
|
9590
|
-
hitWidth += __strokeWidth * 2;
|
|
9591
|
-
if (!needHitFillPath) {
|
|
9592
|
-
if (!this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
|
|
9593
|
-
return true;
|
|
9594
|
-
hitWidth = radiusWidth;
|
|
9595
|
-
}
|
|
9596
|
-
break;
|
|
9597
|
-
}
|
|
9598
|
-
}
|
|
9599
|
-
return hitWidth ? this.__hitStroke(inner, hitWidth) : false;
|
|
9600
|
-
};
|
|
9601
|
-
|
|
9602
|
-
const ui = UI.prototype, rect = Rect.prototype, box$1 = Box.prototype;
|
|
9603
|
-
rect.__updateHitCanvas = box$1.__updateHitCanvas = function () {
|
|
9604
|
-
if (this.stroke || this.cornerRadius || ((this.fill || this.__.__isCanvas) && this.hitFill === 'pixel') || this.hitStroke === 'all')
|
|
9605
|
-
ui.__updateHitCanvas.call(this);
|
|
9606
|
-
else if (this.__hitCanvas)
|
|
9607
|
-
this.__hitCanvas = null;
|
|
9608
|
-
};
|
|
9609
|
-
rect.__hitFill = box$1.__hitFill = function (inner) {
|
|
9610
|
-
return this.__hitCanvas ? ui.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
|
|
9611
|
-
};
|
|
9612
|
-
|
|
9613
|
-
Text.prototype.__drawHitPath = function (canvas) {
|
|
9614
|
-
const { __lineHeight, fontSize, __baseLine, __letterSpacing, __textDrawData: data } = this.__;
|
|
9615
|
-
canvas.beginPath();
|
|
9616
|
-
if (__letterSpacing < 0)
|
|
9617
|
-
this.__drawPathByBox(canvas);
|
|
9618
|
-
else
|
|
9619
|
-
data.rows.forEach(row => canvas.rect(row.x, row.y - __baseLine, row.width, __lineHeight < fontSize ? fontSize : __lineHeight));
|
|
9620
|
-
};
|
|
9621
|
-
|
|
9622
|
-
function getSelector(ui) {
|
|
9623
|
-
return ui.leafer ? ui.leafer.selector : (Platform.selector || (Platform.selector = Creator.selector()));
|
|
9624
|
-
}
|
|
9625
|
-
Group.prototype.pick = function (hitPoint, options) {
|
|
9626
|
-
options || (options = emptyData);
|
|
9627
|
-
this.updateLayout();
|
|
9628
|
-
return getSelector(this).getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this }));
|
|
9629
|
-
};
|
|
9630
|
-
|
|
9631
|
-
const canvas = LeaferCanvasBase.prototype;
|
|
9632
|
-
canvas.hitFill = function (point, fillRule) {
|
|
9633
|
-
return fillRule ? this.context.isPointInPath(point.x, point.y, fillRule) : this.context.isPointInPath(point.x, point.y);
|
|
9634
|
-
};
|
|
9635
|
-
canvas.hitStroke = function (point, strokeWidth) {
|
|
9636
|
-
this.strokeWidth = strokeWidth;
|
|
9637
|
-
return this.context.isPointInStroke(point.x, point.y);
|
|
9638
|
-
};
|
|
9639
|
-
canvas.hitPixel = function (radiusPoint, offset, scale = 1) {
|
|
9640
|
-
let { x, y, radiusX, radiusY } = radiusPoint;
|
|
9641
|
-
if (offset)
|
|
9642
|
-
x -= offset.x, y -= offset.y;
|
|
9643
|
-
tempBounds$1.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
|
|
9644
|
-
const { data } = this.context.getImageData(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width || 1, tempBounds$1.height || 1);
|
|
9645
|
-
for (let i = 0, len = data.length; i < len; i += 4) {
|
|
9646
|
-
if (data[i + 3] > 0)
|
|
9647
|
-
return true;
|
|
9648
|
-
}
|
|
9649
|
-
return data[3] > 0;
|
|
9650
|
-
};
|
|
9651
|
-
|
|
9652
9133
|
function strokeText(stroke, ui, canvas) {
|
|
9653
9134
|
switch (ui.__.strokeAlign) {
|
|
9654
9135
|
case 'center':
|
|
@@ -9674,11 +9155,14 @@ function drawAlign(stroke, align, ui, canvas) {
|
|
|
9674
9155
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
9675
9156
|
fillText(ui, out);
|
|
9676
9157
|
out.blendMode = 'normal';
|
|
9158
|
+
copyWorld(canvas, out, ui);
|
|
9159
|
+
out.recycle(ui.__nowWorld);
|
|
9160
|
+
}
|
|
9161
|
+
function copyWorld(canvas, out, ui) {
|
|
9677
9162
|
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
9678
9163
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9679
9164
|
else
|
|
9680
9165
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
9681
|
-
out.recycle(ui.__nowWorld);
|
|
9682
9166
|
}
|
|
9683
9167
|
function drawTextStroke(ui, canvas) {
|
|
9684
9168
|
let row, data = ui.__.__textDrawData;
|
|
@@ -9747,9 +9231,8 @@ function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
|
9747
9231
|
Paint.strokeArrow(stroke, ui, canvas);
|
|
9748
9232
|
}
|
|
9749
9233
|
function drawInside(stroke, ui, canvas) {
|
|
9750
|
-
const data = ui.__;
|
|
9751
9234
|
canvas.save();
|
|
9752
|
-
|
|
9235
|
+
canvas.clipUI(ui);
|
|
9753
9236
|
drawCenter(stroke, 2, ui, canvas);
|
|
9754
9237
|
canvas.restore();
|
|
9755
9238
|
}
|
|
@@ -9763,12 +9246,9 @@ function drawOutside(stroke, ui, canvas) {
|
|
|
9763
9246
|
const out = canvas.getSameCanvas(true, true);
|
|
9764
9247
|
ui.__drawRenderPath(out);
|
|
9765
9248
|
drawCenter(stroke, 2, ui, out);
|
|
9766
|
-
|
|
9249
|
+
out.clipUI(data);
|
|
9767
9250
|
out.clearWorld(renderBounds);
|
|
9768
|
-
|
|
9769
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9770
|
-
else
|
|
9771
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
9251
|
+
copyWorld(canvas, out, ui);
|
|
9772
9252
|
out.recycle(ui.__nowWorld);
|
|
9773
9253
|
}
|
|
9774
9254
|
}
|
|
@@ -9824,9 +9304,7 @@ function compute(attrName, ui) {
|
|
|
9824
9304
|
paints = [paints];
|
|
9825
9305
|
recycleMap = PaintImage.recycleImage(attrName, data);
|
|
9826
9306
|
for (let i = 0, len = paints.length, item; i < len; i++) {
|
|
9827
|
-
item = getLeafPaint(attrName, paints[i], ui);
|
|
9828
|
-
if (item)
|
|
9829
|
-
leafPaints.push(item);
|
|
9307
|
+
(item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item);
|
|
9830
9308
|
}
|
|
9831
9309
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
9832
9310
|
if (leafPaints.length) {
|
|
@@ -9864,8 +9342,8 @@ function getLeafPaint(attrName, paint, ui) {
|
|
|
9864
9342
|
data = PaintGradient.conicGradient(paint, boxBounds);
|
|
9865
9343
|
break;
|
|
9866
9344
|
case 'solid':
|
|
9867
|
-
const { type,
|
|
9868
|
-
data = { type,
|
|
9345
|
+
const { type, color, opacity } = paint;
|
|
9346
|
+
data = { type, style: ColorConvert.string(color, opacity) };
|
|
9869
9347
|
break;
|
|
9870
9348
|
default:
|
|
9871
9349
|
if (paint.r !== undefined)
|
|
@@ -10242,7 +9720,7 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
10242
9720
|
}
|
|
10243
9721
|
function drawImage(ui, canvas, paint, data) {
|
|
10244
9722
|
canvas.save();
|
|
10245
|
-
|
|
9723
|
+
canvas.clipUI(ui);
|
|
10246
9724
|
if (paint.blendMode)
|
|
10247
9725
|
canvas.blendMode = paint.blendMode;
|
|
10248
9726
|
if (data.opacity)
|
|
@@ -10407,12 +9885,10 @@ function shadow(ui, current, shape) {
|
|
|
10407
9885
|
}
|
|
10408
9886
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
|
|
10409
9887
|
}
|
|
10410
|
-
if (ui.__worldFlipped)
|
|
9888
|
+
if (ui.__worldFlipped)
|
|
10411
9889
|
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
10412
|
-
|
|
10413
|
-
else {
|
|
9890
|
+
else
|
|
10414
9891
|
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
10415
|
-
}
|
|
10416
9892
|
if (end && index < end)
|
|
10417
9893
|
other.clearWorld(copyBounds, true);
|
|
10418
9894
|
});
|
|
@@ -10471,12 +9947,10 @@ function innerShadow(ui, current, shape) {
|
|
|
10471
9947
|
copyBounds = bounds;
|
|
10472
9948
|
}
|
|
10473
9949
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
|
|
10474
|
-
if (ui.__worldFlipped)
|
|
9950
|
+
if (ui.__worldFlipped)
|
|
10475
9951
|
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
10476
|
-
|
|
10477
|
-
else {
|
|
9952
|
+
else
|
|
10478
9953
|
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
10479
|
-
}
|
|
10480
9954
|
if (end && index < end)
|
|
10481
9955
|
other.clearWorld(copyBounds, true);
|
|
10482
9956
|
});
|