leafer-draw 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/web.cjs +17 -27
- package/dist/web.esm.js +18 -28
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +85 -611
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.cjs.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +85 -611
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +2 -2
package/dist/web.js
CHANGED
|
@@ -493,19 +493,19 @@ var LeaferUI = (function (exports) {
|
|
|
493
493
|
},
|
|
494
494
|
tempToInnerOf(t, matrix) {
|
|
495
495
|
const { tempPoint: temp } = P$5;
|
|
496
|
-
copy$
|
|
496
|
+
copy$a(temp, t);
|
|
497
497
|
toInnerPoint$2(matrix, temp, temp);
|
|
498
498
|
return temp;
|
|
499
499
|
},
|
|
500
500
|
tempToOuterOf(t, matrix) {
|
|
501
501
|
const { tempPoint: temp } = P$5;
|
|
502
|
-
copy$
|
|
502
|
+
copy$a(temp, t);
|
|
503
503
|
toOuterPoint$3(matrix, temp, temp);
|
|
504
504
|
return temp;
|
|
505
505
|
},
|
|
506
506
|
tempToInnerRadiusPointOf(t, matrix) {
|
|
507
507
|
const { tempRadiusPoint: temp } = P$5;
|
|
508
|
-
copy$
|
|
508
|
+
copy$a(temp, t);
|
|
509
509
|
P$5.toInnerRadiusPointOf(t, matrix, temp);
|
|
510
510
|
return temp;
|
|
511
511
|
},
|
|
@@ -578,7 +578,7 @@ var LeaferUI = (function (exports) {
|
|
|
578
578
|
}
|
|
579
579
|
};
|
|
580
580
|
const P$5 = PointHelper;
|
|
581
|
-
const { getDistanceFrom, copy: copy$
|
|
581
|
+
const { getDistanceFrom, copy: copy$a, getAtan2 } = P$5;
|
|
582
582
|
|
|
583
583
|
class Point {
|
|
584
584
|
constructor(x, y) {
|
|
@@ -935,7 +935,7 @@ var LeaferUI = (function (exports) {
|
|
|
935
935
|
to = t;
|
|
936
936
|
}
|
|
937
937
|
else {
|
|
938
|
-
copy$
|
|
938
|
+
copy$9(to, t);
|
|
939
939
|
}
|
|
940
940
|
if (parent) {
|
|
941
941
|
to.offsetX = -(B.maxX(parent) - t.x);
|
|
@@ -1093,7 +1093,7 @@ var LeaferUI = (function (exports) {
|
|
|
1093
1093
|
if (first) {
|
|
1094
1094
|
first = false;
|
|
1095
1095
|
if (!addMode)
|
|
1096
|
-
copy$
|
|
1096
|
+
copy$9(t, bounds);
|
|
1097
1097
|
}
|
|
1098
1098
|
else {
|
|
1099
1099
|
add$1(t, bounds);
|
|
@@ -1174,7 +1174,7 @@ var LeaferUI = (function (exports) {
|
|
|
1174
1174
|
}
|
|
1175
1175
|
};
|
|
1176
1176
|
const B = BoundsHelper;
|
|
1177
|
-
const { add: add$1, copy: copy$
|
|
1177
|
+
const { add: add$1, copy: copy$9 } = B;
|
|
1178
1178
|
|
|
1179
1179
|
class Bounds {
|
|
1180
1180
|
get minX() { return BoundsHelper.minX(this); }
|
|
@@ -2069,7 +2069,7 @@ var LeaferUI = (function (exports) {
|
|
|
2069
2069
|
contextMethod()
|
|
2070
2070
|
], Canvas.prototype, "strokeText", null);
|
|
2071
2071
|
|
|
2072
|
-
const { copy: copy$
|
|
2072
|
+
const { copy: copy$8, multiplyParent: multiplyParent$3 } = MatrixHelper, { round: round$1 } = Math;
|
|
2073
2073
|
const minSize = { width: 1, height: 1, pixelRatio: 1 };
|
|
2074
2074
|
const canvasSizeAttrs = ['width', 'height', 'pixelRatio'];
|
|
2075
2075
|
class LeaferCanvasBase extends Canvas {
|
|
@@ -2272,16 +2272,19 @@ var LeaferUI = (function (exports) {
|
|
|
2272
2272
|
if (blendMode)
|
|
2273
2273
|
this.blendMode = 'source-over';
|
|
2274
2274
|
}
|
|
2275
|
-
clearWorld(bounds, ceilPixel) {
|
|
2276
|
-
this.setTempBounds(bounds, ceilPixel);
|
|
2277
|
-
this.clearRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
|
|
2278
|
-
}
|
|
2279
2275
|
clipWorld(bounds, ceilPixel) {
|
|
2280
2276
|
this.beginPath();
|
|
2281
2277
|
this.setTempBounds(bounds, ceilPixel);
|
|
2282
2278
|
this.rect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
|
|
2283
2279
|
this.clip();
|
|
2284
2280
|
}
|
|
2281
|
+
clipUI(ruleData) {
|
|
2282
|
+
ruleData.windingRule ? this.clip(ruleData.windingRule) : this.clip();
|
|
2283
|
+
}
|
|
2284
|
+
clearWorld(bounds, ceilPixel) {
|
|
2285
|
+
this.setTempBounds(bounds, ceilPixel);
|
|
2286
|
+
this.clearRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
|
|
2287
|
+
}
|
|
2285
2288
|
clear() {
|
|
2286
2289
|
const { pixelRatio } = this;
|
|
2287
2290
|
this.clearRect(0, 0, this.width * pixelRatio + 2, this.height * pixelRatio + 2);
|
|
@@ -2301,7 +2304,7 @@ var LeaferUI = (function (exports) {
|
|
|
2301
2304
|
const { size, pixelSnap } = this, canvas = this.manager ? this.manager.get(size) : Creator.canvas(Object.assign({}, size));
|
|
2302
2305
|
canvas.save();
|
|
2303
2306
|
if (useSameWorldTransform)
|
|
2304
|
-
copy$
|
|
2307
|
+
copy$8(canvas.worldTransform, this.worldTransform), canvas.useWorldTransform();
|
|
2305
2308
|
if (useSameSmooth)
|
|
2306
2309
|
canvas.smooth = this.smooth;
|
|
2307
2310
|
canvas.pixelSnap !== pixelSnap && (canvas.pixelSnap = pixelSnap);
|
|
@@ -2680,7 +2683,7 @@ var LeaferUI = (function (exports) {
|
|
|
2680
2683
|
};
|
|
2681
2684
|
|
|
2682
2685
|
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;
|
|
2683
|
-
const { rect: rect$
|
|
2686
|
+
const { rect: rect$2, roundRect: roundRect$2, arcTo: arcTo$3, arc: arc$3, ellipse: ellipse$4, quadraticCurveTo: quadraticCurveTo$1 } = BezierHelper;
|
|
2684
2687
|
const { ellipticalArc } = EllipseHelper;
|
|
2685
2688
|
const debug$c = Debug.get('PathConvert');
|
|
2686
2689
|
const setEndPoint$1 = {};
|
|
@@ -2877,7 +2880,7 @@ var LeaferUI = (function (exports) {
|
|
|
2877
2880
|
case N$3:
|
|
2878
2881
|
x = old[i + 1];
|
|
2879
2882
|
y = old[i + 2];
|
|
2880
|
-
curveMode ? rect$
|
|
2883
|
+
curveMode ? rect$2(data, x, y, old[i + 3], old[i + 4]) : copyData(data, old, i, 5);
|
|
2881
2884
|
i += 5;
|
|
2882
2885
|
break;
|
|
2883
2886
|
case D$3:
|
|
@@ -3053,7 +3056,7 @@ var LeaferUI = (function (exports) {
|
|
|
3053
3056
|
};
|
|
3054
3057
|
const { ellipse: ellipse$3, arc: arc$2 } = PathCommandDataHelper;
|
|
3055
3058
|
|
|
3056
|
-
const { moveTo: moveTo$4, lineTo: lineTo$3, quadraticCurveTo, bezierCurveTo, closePath: closePath$3, beginPath, rect: rect$
|
|
3059
|
+
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;
|
|
3057
3060
|
class PathCreator {
|
|
3058
3061
|
set path(value) { this.__path = value; }
|
|
3059
3062
|
get path() { return this.__path; }
|
|
@@ -3100,7 +3103,7 @@ var LeaferUI = (function (exports) {
|
|
|
3100
3103
|
return this;
|
|
3101
3104
|
}
|
|
3102
3105
|
rect(x, y, width, height) {
|
|
3103
|
-
rect$
|
|
3106
|
+
rect$1(this.__path, x, y, width, height);
|
|
3104
3107
|
this.paint();
|
|
3105
3108
|
return this;
|
|
3106
3109
|
}
|
|
@@ -3218,7 +3221,7 @@ var LeaferUI = (function (exports) {
|
|
|
3218
3221
|
|
|
3219
3222
|
const { M: M$1, L: L$2, C, Q, Z: Z$1, N, D, X, G, F: F$1, O, P, U } = PathCommandMap;
|
|
3220
3223
|
const { toTwoPointBounds, toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc, ellipse: ellipse$1 } = BezierHelper;
|
|
3221
|
-
const { addPointBounds, copy: copy$
|
|
3224
|
+
const { addPointBounds, copy: copy$7, addPoint, setPoint, addBounds, toBounds: toBounds$2 } = TwoPointBoundsHelper;
|
|
3222
3225
|
const debug$a = Debug.get('PathBounds');
|
|
3223
3226
|
let radius, radiusX, radiusY;
|
|
3224
3227
|
const tempPointBounds = {};
|
|
@@ -3290,7 +3293,7 @@ var LeaferUI = (function (exports) {
|
|
|
3290
3293
|
break;
|
|
3291
3294
|
case G:
|
|
3292
3295
|
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);
|
|
3293
|
-
i === 0 ? copy$
|
|
3296
|
+
i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3294
3297
|
x = setEndPoint.x;
|
|
3295
3298
|
y = setEndPoint.y;
|
|
3296
3299
|
i += 9;
|
|
@@ -3306,7 +3309,7 @@ var LeaferUI = (function (exports) {
|
|
|
3306
3309
|
break;
|
|
3307
3310
|
case O:
|
|
3308
3311
|
arc(null, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], tempPointBounds, setEndPoint);
|
|
3309
|
-
i === 0 ? copy$
|
|
3312
|
+
i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3310
3313
|
x = setEndPoint.x;
|
|
3311
3314
|
y = setEndPoint.y;
|
|
3312
3315
|
i += 7;
|
|
@@ -3321,7 +3324,7 @@ var LeaferUI = (function (exports) {
|
|
|
3321
3324
|
break;
|
|
3322
3325
|
case U:
|
|
3323
3326
|
arcTo$1(null, x, y, data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], tempPointBounds, setEndPoint);
|
|
3324
|
-
i === 0 ? copy$
|
|
3327
|
+
i === 0 ? copy$7(setPointBounds, tempPointBounds) : addPointBounds(setPointBounds, tempPointBounds);
|
|
3325
3328
|
x = setEndPoint.x;
|
|
3326
3329
|
y = setEndPoint.y;
|
|
3327
3330
|
i += 6;
|
|
@@ -4257,8 +4260,8 @@ var LeaferUI = (function (exports) {
|
|
|
4257
4260
|
};
|
|
4258
4261
|
}
|
|
4259
4262
|
|
|
4260
|
-
const { copy: copy$
|
|
4261
|
-
const matrix
|
|
4263
|
+
const { copy: copy$6, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
|
|
4264
|
+
const matrix = {}, { round } = Math;
|
|
4262
4265
|
const LeafHelper = {
|
|
4263
4266
|
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
4264
4267
|
if (checkAutoLayout && leaf.__hasAutoLayout && leaf.__layout.matrixChanged)
|
|
@@ -4353,13 +4356,13 @@ var LeaferUI = (function (exports) {
|
|
|
4353
4356
|
transition = scaleY;
|
|
4354
4357
|
scaleY = scaleX;
|
|
4355
4358
|
}
|
|
4356
|
-
copy$
|
|
4357
|
-
scaleOfOuter$2(matrix
|
|
4359
|
+
copy$6(matrix, o);
|
|
4360
|
+
scaleOfOuter$2(matrix, origin, scaleX, scaleY);
|
|
4358
4361
|
if (t.origin || t.around) {
|
|
4359
|
-
L.setTransform(t, matrix
|
|
4362
|
+
L.setTransform(t, matrix, resize, transition);
|
|
4360
4363
|
}
|
|
4361
4364
|
else {
|
|
4362
|
-
const x = t.x + matrix
|
|
4365
|
+
const x = t.x + matrix.e - o.e, y = t.y + matrix.f - o.f;
|
|
4363
4366
|
if (transition && !resize)
|
|
4364
4367
|
t.animate({ x, y, scaleX: t.scaleX * scaleX, scaleY: t.scaleY * scaleY }, transition);
|
|
4365
4368
|
else
|
|
@@ -4371,32 +4374,32 @@ var LeaferUI = (function (exports) {
|
|
|
4371
4374
|
},
|
|
4372
4375
|
rotateOfLocal(t, origin, angle, transition) {
|
|
4373
4376
|
const o = t.__localMatrix;
|
|
4374
|
-
copy$
|
|
4375
|
-
rotateOfOuter$2(matrix
|
|
4377
|
+
copy$6(matrix, o);
|
|
4378
|
+
rotateOfOuter$2(matrix, origin, angle);
|
|
4376
4379
|
if (t.origin || t.around)
|
|
4377
|
-
L.setTransform(t, matrix
|
|
4380
|
+
L.setTransform(t, matrix, false, transition);
|
|
4378
4381
|
else
|
|
4379
|
-
t.set({ x: t.x + matrix
|
|
4382
|
+
t.set({ x: t.x + matrix.e - o.e, y: t.y + matrix.f - o.f, rotation: MathHelper.formatRotation(t.rotation + angle) }, transition);
|
|
4380
4383
|
},
|
|
4381
4384
|
skewOfWorld(t, origin, skewX, skewY, resize, transition) {
|
|
4382
4385
|
L.skewOfLocal(t, getTempLocal(t, origin), skewX, skewY, resize, transition);
|
|
4383
4386
|
},
|
|
4384
4387
|
skewOfLocal(t, origin, skewX, skewY = 0, resize, transition) {
|
|
4385
|
-
copy$
|
|
4386
|
-
skewOfOuter(matrix
|
|
4387
|
-
L.setTransform(t, matrix
|
|
4388
|
+
copy$6(matrix, t.__localMatrix);
|
|
4389
|
+
skewOfOuter(matrix, origin, skewX, skewY);
|
|
4390
|
+
L.setTransform(t, matrix, resize, transition);
|
|
4388
4391
|
},
|
|
4389
4392
|
transformWorld(t, transform, resize, transition) {
|
|
4390
|
-
copy$
|
|
4391
|
-
multiplyParent$2(matrix
|
|
4393
|
+
copy$6(matrix, t.worldTransform);
|
|
4394
|
+
multiplyParent$2(matrix, transform);
|
|
4392
4395
|
if (t.parent)
|
|
4393
|
-
divideParent(matrix
|
|
4394
|
-
L.setTransform(t, matrix
|
|
4396
|
+
divideParent(matrix, t.parent.worldTransform);
|
|
4397
|
+
L.setTransform(t, matrix, resize, transition);
|
|
4395
4398
|
},
|
|
4396
4399
|
transform(t, transform, resize, transition) {
|
|
4397
|
-
copy$
|
|
4398
|
-
multiplyParent$2(matrix
|
|
4399
|
-
L.setTransform(t, matrix
|
|
4400
|
+
copy$6(matrix, t.localTransform);
|
|
4401
|
+
multiplyParent$2(matrix, transform);
|
|
4402
|
+
L.setTransform(t, matrix, resize, transition);
|
|
4400
4403
|
},
|
|
4401
4404
|
setTransform(t, transform, resize, transition) {
|
|
4402
4405
|
const data = t.__, originPoint = data.origin && L.getInnerOrigin(t, data.origin);
|
|
@@ -4430,9 +4433,9 @@ var LeaferUI = (function (exports) {
|
|
|
4430
4433
|
return innerOrigin;
|
|
4431
4434
|
},
|
|
4432
4435
|
getRelativeWorld(t, relative, temp) {
|
|
4433
|
-
copy$
|
|
4434
|
-
divideParent(matrix
|
|
4435
|
-
return temp ? matrix
|
|
4436
|
+
copy$6(matrix, t.worldTransform);
|
|
4437
|
+
divideParent(matrix, relative.worldTransform);
|
|
4438
|
+
return temp ? matrix : Object.assign({}, matrix);
|
|
4436
4439
|
},
|
|
4437
4440
|
drop(t, parent, index, resize) {
|
|
4438
4441
|
t.setTransform(L.getRelativeWorld(t, parent, true), resize);
|
|
@@ -4571,7 +4574,7 @@ var LeaferUI = (function (exports) {
|
|
|
4571
4574
|
};
|
|
4572
4575
|
|
|
4573
4576
|
const { getRelativeWorld: getRelativeWorld$1, updateBounds: updateBounds$2 } = LeafHelper;
|
|
4574
|
-
const { toOuterOf: toOuterOf$2, getPoints, copy: copy$
|
|
4577
|
+
const { toOuterOf: toOuterOf$2, getPoints, copy: copy$5 } = BoundsHelper;
|
|
4575
4578
|
const localContent = '_localContentBounds';
|
|
4576
4579
|
const worldContent = '_worldContentBounds', worldBox = '_worldBoxBounds', worldStroke = '_worldStrokeBounds';
|
|
4577
4580
|
class LeafLayout {
|
|
@@ -4731,7 +4734,7 @@ var LeaferUI = (function (exports) {
|
|
|
4731
4734
|
}
|
|
4732
4735
|
if (!layoutBounds)
|
|
4733
4736
|
layoutBounds = MatrixHelper.getLayout(matrix);
|
|
4734
|
-
copy$
|
|
4737
|
+
copy$5(layoutBounds, bounds);
|
|
4735
4738
|
PointHelper.copy(layoutBounds, point);
|
|
4736
4739
|
if (unscale) {
|
|
4737
4740
|
const { scaleX, scaleY } = layoutBounds;
|
|
@@ -5285,7 +5288,7 @@ var LeaferUI = (function (exports) {
|
|
|
5285
5288
|
|
|
5286
5289
|
const { updateMatrix: updateMatrix$1, updateAllMatrix: updateAllMatrix$2 } = LeafHelper;
|
|
5287
5290
|
const { updateBounds: updateBounds$1 } = BranchHelper;
|
|
5288
|
-
const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$
|
|
5291
|
+
const { toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$4 } = BoundsHelper;
|
|
5289
5292
|
const { toBounds: toBounds$1 } = PathBounds;
|
|
5290
5293
|
const LeafBounds = {
|
|
5291
5294
|
__updateWorldBounds() {
|
|
@@ -5416,7 +5419,7 @@ var LeaferUI = (function (exports) {
|
|
|
5416
5419
|
},
|
|
5417
5420
|
__updateRenderBounds() {
|
|
5418
5421
|
const layout = this.__layout;
|
|
5419
|
-
layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$
|
|
5422
|
+
layout.renderSpread > 0 ? copyAndSpread$1(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy$4(layout.renderBounds, layout.strokeBounds);
|
|
5420
5423
|
}
|
|
5421
5424
|
};
|
|
5422
5425
|
|
|
@@ -5450,7 +5453,7 @@ var LeaferUI = (function (exports) {
|
|
|
5450
5453
|
if (this.__worldOpacity) {
|
|
5451
5454
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
5452
5455
|
this.__drawRenderPath(canvas);
|
|
5453
|
-
|
|
5456
|
+
canvas.clipUI(this);
|
|
5454
5457
|
}
|
|
5455
5458
|
},
|
|
5456
5459
|
__updateWorldOpacity() {
|
|
@@ -5521,7 +5524,7 @@ var LeaferUI = (function (exports) {
|
|
|
5521
5524
|
const { LEAF, create } = IncrementId;
|
|
5522
5525
|
const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
|
|
5523
5526
|
const { toOuterOf } = BoundsHelper;
|
|
5524
|
-
const { copy: copy$
|
|
5527
|
+
const { copy: copy$3, move } = PointHelper;
|
|
5525
5528
|
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
|
|
5526
5529
|
exports.Leaf = class Leaf {
|
|
5527
5530
|
get tag() { return this.__tag; }
|
|
@@ -5734,7 +5737,7 @@ var LeaferUI = (function (exports) {
|
|
|
5734
5737
|
}
|
|
5735
5738
|
else {
|
|
5736
5739
|
if (to)
|
|
5737
|
-
copy$
|
|
5740
|
+
copy$3(to, world);
|
|
5738
5741
|
}
|
|
5739
5742
|
}
|
|
5740
5743
|
localToWorld(local, to, distance, relative) {
|
|
@@ -5743,7 +5746,7 @@ var LeaferUI = (function (exports) {
|
|
|
5743
5746
|
}
|
|
5744
5747
|
else {
|
|
5745
5748
|
if (to)
|
|
5746
|
-
copy$
|
|
5749
|
+
copy$3(to, local);
|
|
5747
5750
|
}
|
|
5748
5751
|
}
|
|
5749
5752
|
worldToInner(world, to, distance, relative) {
|
|
@@ -6233,7 +6236,7 @@ var LeaferUI = (function (exports) {
|
|
|
6233
6236
|
}
|
|
6234
6237
|
}
|
|
6235
6238
|
|
|
6236
|
-
const version = "1.6.
|
|
6239
|
+
const version = "1.6.4";
|
|
6237
6240
|
|
|
6238
6241
|
const debug$4 = Debug.get('LeaferCanvas');
|
|
6239
6242
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
@@ -7553,7 +7556,7 @@ var LeaferUI = (function (exports) {
|
|
|
7553
7556
|
__drawAfterFill(canvas, options) {
|
|
7554
7557
|
if (this.__.__clipAfterFill) {
|
|
7555
7558
|
canvas.save();
|
|
7556
|
-
|
|
7559
|
+
canvas.clipUI();
|
|
7557
7560
|
this.__drawContent(canvas, options);
|
|
7558
7561
|
canvas.restore();
|
|
7559
7562
|
}
|
|
@@ -8419,8 +8422,8 @@ var LeaferUI = (function (exports) {
|
|
|
8419
8422
|
registerUI()
|
|
8420
8423
|
], exports.Rect);
|
|
8421
8424
|
|
|
8422
|
-
const { copy: copy$
|
|
8423
|
-
const rect
|
|
8425
|
+
const { copy: copy$2, add, includes: includes$1 } = BoundsHelper;
|
|
8426
|
+
const rect = exports.Rect.prototype, group = exports.Group.prototype;
|
|
8424
8427
|
const childrenRenderBounds = {};
|
|
8425
8428
|
exports.Box = class Box extends exports.Group {
|
|
8426
8429
|
get __tag() { return 'Box'; }
|
|
@@ -8465,7 +8468,7 @@ var LeaferUI = (function (exports) {
|
|
|
8465
8468
|
const { renderBounds } = this.__layout;
|
|
8466
8469
|
if (this.children.length) {
|
|
8467
8470
|
super.__updateRenderBounds();
|
|
8468
|
-
copy$
|
|
8471
|
+
copy$2(childrenRenderBounds, renderBounds);
|
|
8469
8472
|
this.__updateRectRenderBounds();
|
|
8470
8473
|
isOverflow = !includes$1(renderBounds, childrenRenderBounds);
|
|
8471
8474
|
if (isOverflow && this.__.overflow !== 'hide')
|
|
@@ -8517,25 +8520,25 @@ var LeaferUI = (function (exports) {
|
|
|
8517
8520
|
affectRenderBoundsType('show')
|
|
8518
8521
|
], exports.Box.prototype, "overflow", void 0);
|
|
8519
8522
|
__decorate([
|
|
8520
|
-
rewrite(rect
|
|
8523
|
+
rewrite(rect.__updateStrokeSpread)
|
|
8521
8524
|
], exports.Box.prototype, "__updateStrokeSpread", null);
|
|
8522
8525
|
__decorate([
|
|
8523
|
-
rewrite(rect
|
|
8526
|
+
rewrite(rect.__updateRenderSpread)
|
|
8524
8527
|
], exports.Box.prototype, "__updateRectRenderSpread", null);
|
|
8525
8528
|
__decorate([
|
|
8526
|
-
rewrite(rect
|
|
8529
|
+
rewrite(rect.__updateBoxBounds)
|
|
8527
8530
|
], exports.Box.prototype, "__updateRectBoxBounds", null);
|
|
8528
8531
|
__decorate([
|
|
8529
|
-
rewrite(rect
|
|
8532
|
+
rewrite(rect.__updateStrokeBounds)
|
|
8530
8533
|
], exports.Box.prototype, "__updateStrokeBounds", null);
|
|
8531
8534
|
__decorate([
|
|
8532
|
-
rewrite(rect
|
|
8535
|
+
rewrite(rect.__updateRenderBounds)
|
|
8533
8536
|
], exports.Box.prototype, "__updateRectRenderBounds", null);
|
|
8534
8537
|
__decorate([
|
|
8535
|
-
rewrite(rect
|
|
8538
|
+
rewrite(rect.__updateChange)
|
|
8536
8539
|
], exports.Box.prototype, "__updateRectChange", null);
|
|
8537
8540
|
__decorate([
|
|
8538
|
-
rewrite(rect
|
|
8541
|
+
rewrite(rect.__render)
|
|
8539
8542
|
], exports.Box.prototype, "__renderRect", null);
|
|
8540
8543
|
__decorate([
|
|
8541
8544
|
rewrite(group.__render)
|
|
@@ -9038,6 +9041,9 @@ var LeaferUI = (function (exports) {
|
|
|
9038
9041
|
__decorate([
|
|
9039
9042
|
boundsType('show')
|
|
9040
9043
|
], exports.Text.prototype, "textOverflow", void 0);
|
|
9044
|
+
__decorate([
|
|
9045
|
+
surfaceType(false)
|
|
9046
|
+
], exports.Text.prototype, "textEditing", void 0);
|
|
9041
9047
|
exports.Text = __decorate([
|
|
9042
9048
|
registerUI()
|
|
9043
9049
|
], exports.Text);
|
|
@@ -9169,531 +9175,6 @@ var LeaferUI = (function (exports) {
|
|
|
9169
9175
|
ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
|
|
9170
9176
|
}
|
|
9171
9177
|
|
|
9172
|
-
let App = class App extends exports.Leafer {
|
|
9173
|
-
get __tag() { return 'App'; }
|
|
9174
|
-
get isApp() { return true; }
|
|
9175
|
-
constructor(userConfig, data) {
|
|
9176
|
-
super(userConfig, data);
|
|
9177
|
-
}
|
|
9178
|
-
init(userConfig, parentApp) {
|
|
9179
|
-
super.init(userConfig, parentApp);
|
|
9180
|
-
if (userConfig) {
|
|
9181
|
-
const { ground, tree, sky, editor } = userConfig;
|
|
9182
|
-
if (ground)
|
|
9183
|
-
this.ground = this.addLeafer(ground);
|
|
9184
|
-
if (tree || editor)
|
|
9185
|
-
this.tree = this.addLeafer(tree || { type: userConfig.type || 'design' });
|
|
9186
|
-
if (sky || editor)
|
|
9187
|
-
this.sky = this.addLeafer(sky);
|
|
9188
|
-
if (editor)
|
|
9189
|
-
Creator.editor(editor, this);
|
|
9190
|
-
}
|
|
9191
|
-
}
|
|
9192
|
-
__setApp() {
|
|
9193
|
-
const { canvas } = this;
|
|
9194
|
-
const { realCanvas, view } = this.config;
|
|
9195
|
-
if (realCanvas || view === this.canvas.view || !canvas.parentView)
|
|
9196
|
-
this.realCanvas = true;
|
|
9197
|
-
else
|
|
9198
|
-
canvas.unrealCanvas();
|
|
9199
|
-
this.leafer = this;
|
|
9200
|
-
this.watcher.disable();
|
|
9201
|
-
this.layouter.disable();
|
|
9202
|
-
}
|
|
9203
|
-
__updateLocalBounds() {
|
|
9204
|
-
this.forEach(leafer => leafer.updateLayout());
|
|
9205
|
-
super.__updateLocalBounds();
|
|
9206
|
-
}
|
|
9207
|
-
start() {
|
|
9208
|
-
super.start();
|
|
9209
|
-
this.forEach(leafer => leafer.start());
|
|
9210
|
-
}
|
|
9211
|
-
stop() {
|
|
9212
|
-
this.forEach(leafer => leafer.stop());
|
|
9213
|
-
super.stop();
|
|
9214
|
-
}
|
|
9215
|
-
unlockLayout() {
|
|
9216
|
-
super.unlockLayout();
|
|
9217
|
-
this.forEach(leafer => leafer.unlockLayout());
|
|
9218
|
-
}
|
|
9219
|
-
lockLayout() {
|
|
9220
|
-
super.lockLayout();
|
|
9221
|
-
this.forEach(leafer => leafer.lockLayout());
|
|
9222
|
-
}
|
|
9223
|
-
forceRender(bounds, sync) {
|
|
9224
|
-
this.forEach(leafer => leafer.forceRender(bounds, sync));
|
|
9225
|
-
}
|
|
9226
|
-
addLeafer(merge) {
|
|
9227
|
-
const leafer = new exports.Leafer(merge);
|
|
9228
|
-
this.add(leafer);
|
|
9229
|
-
return leafer;
|
|
9230
|
-
}
|
|
9231
|
-
add(leafer, index) {
|
|
9232
|
-
if (!leafer.view) {
|
|
9233
|
-
if (this.realCanvas && !this.canvas.bounds) {
|
|
9234
|
-
setTimeout(() => this.add(leafer, index), 10);
|
|
9235
|
-
return;
|
|
9236
|
-
}
|
|
9237
|
-
leafer.init(this.__getChildConfig(leafer.userConfig), this);
|
|
9238
|
-
}
|
|
9239
|
-
super.add(leafer, index);
|
|
9240
|
-
if (index !== undefined)
|
|
9241
|
-
leafer.canvas.childIndex = index;
|
|
9242
|
-
this.__listenChildEvents(leafer);
|
|
9243
|
-
}
|
|
9244
|
-
forEach(fn) {
|
|
9245
|
-
this.children.forEach(fn);
|
|
9246
|
-
}
|
|
9247
|
-
__onCreated() {
|
|
9248
|
-
this.created = this.children.every(child => child.created);
|
|
9249
|
-
}
|
|
9250
|
-
__onReady() {
|
|
9251
|
-
if (this.children.every(child => child.ready))
|
|
9252
|
-
super.__onReady();
|
|
9253
|
-
}
|
|
9254
|
-
__onViewReady() {
|
|
9255
|
-
if (this.children.every(child => child.viewReady))
|
|
9256
|
-
super.__onViewReady();
|
|
9257
|
-
}
|
|
9258
|
-
__onChildRenderEnd(e) {
|
|
9259
|
-
this.renderer.addBlock(e.renderBounds);
|
|
9260
|
-
if (this.viewReady)
|
|
9261
|
-
this.renderer.update();
|
|
9262
|
-
}
|
|
9263
|
-
__render(canvas, options) {
|
|
9264
|
-
if (canvas.context)
|
|
9265
|
-
this.forEach(leafer => options.matrix ? leafer.__render(canvas, options) : canvas.copyWorld(leafer.canvas, options && options.bounds));
|
|
9266
|
-
}
|
|
9267
|
-
__onResize(event) {
|
|
9268
|
-
this.forEach(leafer => leafer.resize(event));
|
|
9269
|
-
super.__onResize(event);
|
|
9270
|
-
}
|
|
9271
|
-
updateLayout() {
|
|
9272
|
-
this.forEach(leafer => leafer.updateLayout());
|
|
9273
|
-
}
|
|
9274
|
-
__getChildConfig(userConfig) {
|
|
9275
|
-
const config = Object.assign({}, this.config);
|
|
9276
|
-
config.hittable = config.realCanvas = undefined;
|
|
9277
|
-
if (userConfig)
|
|
9278
|
-
DataHelper.assign(config, userConfig);
|
|
9279
|
-
if (this.autoLayout)
|
|
9280
|
-
DataHelper.copyAttrs(config, this, canvasSizeAttrs);
|
|
9281
|
-
config.view = this.realCanvas ? undefined : this.view;
|
|
9282
|
-
config.fill = undefined;
|
|
9283
|
-
return config;
|
|
9284
|
-
}
|
|
9285
|
-
__listenChildEvents(leafer) {
|
|
9286
|
-
leafer.once([
|
|
9287
|
-
[LayoutEvent.END, this.__onReady, this],
|
|
9288
|
-
[RenderEvent.START, this.__onCreated, this],
|
|
9289
|
-
[RenderEvent.END, this.__onViewReady, this]
|
|
9290
|
-
]);
|
|
9291
|
-
if (this.realCanvas)
|
|
9292
|
-
this.__eventIds.push(leafer.on_(RenderEvent.END, this.__onChildRenderEnd, this));
|
|
9293
|
-
}
|
|
9294
|
-
};
|
|
9295
|
-
App = __decorate([
|
|
9296
|
-
registerUI()
|
|
9297
|
-
], App);
|
|
9298
|
-
|
|
9299
|
-
const downKeyMap = {};
|
|
9300
|
-
const Keyboard = {
|
|
9301
|
-
isHoldSpaceKey() {
|
|
9302
|
-
return Keyboard.isHold('Space');
|
|
9303
|
-
},
|
|
9304
|
-
isHold(code) {
|
|
9305
|
-
return downKeyMap[code];
|
|
9306
|
-
},
|
|
9307
|
-
setDownCode(code) {
|
|
9308
|
-
if (!downKeyMap[code])
|
|
9309
|
-
downKeyMap[code] = true;
|
|
9310
|
-
},
|
|
9311
|
-
setUpCode(code) {
|
|
9312
|
-
downKeyMap[code] = false;
|
|
9313
|
-
}
|
|
9314
|
-
};
|
|
9315
|
-
|
|
9316
|
-
const PointerButton = {
|
|
9317
|
-
LEFT: 1,
|
|
9318
|
-
RIGHT: 2,
|
|
9319
|
-
MIDDLE: 4,
|
|
9320
|
-
defaultLeft(event) { if (!event.buttons)
|
|
9321
|
-
event.buttons = 1; },
|
|
9322
|
-
left(event) { return event.buttons === 1; },
|
|
9323
|
-
right(event) { return event.buttons === 2; },
|
|
9324
|
-
middle(event) { return event.buttons === 4; }
|
|
9325
|
-
};
|
|
9326
|
-
|
|
9327
|
-
class UIEvent extends Event {
|
|
9328
|
-
get spaceKey() { return Keyboard.isHoldSpaceKey(); }
|
|
9329
|
-
get left() { return PointerButton.left(this); }
|
|
9330
|
-
get right() { return PointerButton.right(this); }
|
|
9331
|
-
get middle() { return PointerButton.middle(this); }
|
|
9332
|
-
constructor(params) {
|
|
9333
|
-
super(params.type);
|
|
9334
|
-
this.bubbles = true;
|
|
9335
|
-
Object.assign(this, params);
|
|
9336
|
-
}
|
|
9337
|
-
getBoxPoint(relative) {
|
|
9338
|
-
return (relative || this.current).getBoxPoint(this);
|
|
9339
|
-
}
|
|
9340
|
-
getInnerPoint(relative) {
|
|
9341
|
-
return (relative || this.current).getInnerPoint(this);
|
|
9342
|
-
}
|
|
9343
|
-
getLocalPoint(relative) {
|
|
9344
|
-
return (relative || this.current).getLocalPoint(this);
|
|
9345
|
-
}
|
|
9346
|
-
getPagePoint() {
|
|
9347
|
-
return this.current.getPagePoint(this);
|
|
9348
|
-
}
|
|
9349
|
-
getInner(relative) { return this.getInnerPoint(relative); }
|
|
9350
|
-
getLocal(relative) { return this.getLocalPoint(relative); }
|
|
9351
|
-
getPage() { return this.getPagePoint(); }
|
|
9352
|
-
static changeName(oldName, newName) {
|
|
9353
|
-
EventCreator.changeName(oldName, newName);
|
|
9354
|
-
}
|
|
9355
|
-
}
|
|
9356
|
-
|
|
9357
|
-
let PointerEvent$1 = class PointerEvent extends UIEvent {
|
|
9358
|
-
};
|
|
9359
|
-
PointerEvent$1.POINTER = 'pointer';
|
|
9360
|
-
PointerEvent$1.BEFORE_DOWN = 'pointer.before_down';
|
|
9361
|
-
PointerEvent$1.BEFORE_MOVE = 'pointer.before_move';
|
|
9362
|
-
PointerEvent$1.BEFORE_UP = 'pointer.before_up';
|
|
9363
|
-
PointerEvent$1.DOWN = 'pointer.down';
|
|
9364
|
-
PointerEvent$1.MOVE = 'pointer.move';
|
|
9365
|
-
PointerEvent$1.UP = 'pointer.up';
|
|
9366
|
-
PointerEvent$1.OVER = 'pointer.over';
|
|
9367
|
-
PointerEvent$1.OUT = 'pointer.out';
|
|
9368
|
-
PointerEvent$1.ENTER = 'pointer.enter';
|
|
9369
|
-
PointerEvent$1.LEAVE = 'pointer.leave';
|
|
9370
|
-
PointerEvent$1.TAP = 'tap';
|
|
9371
|
-
PointerEvent$1.DOUBLE_TAP = 'double_tap';
|
|
9372
|
-
PointerEvent$1.CLICK = 'click';
|
|
9373
|
-
PointerEvent$1.DOUBLE_CLICK = 'double_click';
|
|
9374
|
-
PointerEvent$1.LONG_PRESS = 'long_press';
|
|
9375
|
-
PointerEvent$1.LONG_TAP = 'long_tap';
|
|
9376
|
-
PointerEvent$1.MENU = 'pointer.menu';
|
|
9377
|
-
PointerEvent$1.MENU_TAP = 'pointer.menu_tap';
|
|
9378
|
-
PointerEvent$1 = __decorate([
|
|
9379
|
-
registerUIEvent()
|
|
9380
|
-
], PointerEvent$1);
|
|
9381
|
-
|
|
9382
|
-
const tempMove = {};
|
|
9383
|
-
let DragEvent$1 = class DragEvent extends PointerEvent$1 {
|
|
9384
|
-
static setList(data) {
|
|
9385
|
-
this.list = data instanceof LeafList ? data : new LeafList(data);
|
|
9386
|
-
}
|
|
9387
|
-
static setData(data) {
|
|
9388
|
-
this.data = data;
|
|
9389
|
-
}
|
|
9390
|
-
static getValidMove(leaf, start, total) {
|
|
9391
|
-
const { draggable, dragBounds } = leaf, move = leaf.getLocalPoint(total, null, true);
|
|
9392
|
-
PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
|
|
9393
|
-
if (dragBounds)
|
|
9394
|
-
this.getMoveInDragBounds(leaf.__localBoxBounds, dragBounds === 'parent' ? leaf.parent.boxBounds : dragBounds, move, true);
|
|
9395
|
-
if (draggable === 'x')
|
|
9396
|
-
move.y = 0;
|
|
9397
|
-
if (draggable === 'y')
|
|
9398
|
-
move.x = 0;
|
|
9399
|
-
return move;
|
|
9400
|
-
}
|
|
9401
|
-
static getMoveInDragBounds(childBox, dragBounds, move, change) {
|
|
9402
|
-
const x = childBox.x + move.x, y = childBox.y + move.y, right = x + childBox.width, bottom = y + childBox.height;
|
|
9403
|
-
const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
|
|
9404
|
-
if (!change)
|
|
9405
|
-
move = Object.assign({}, move);
|
|
9406
|
-
if (BoundsHelper.includes(childBox, dragBounds)) {
|
|
9407
|
-
if (x > dragBounds.x)
|
|
9408
|
-
move.x += dragBounds.x - x;
|
|
9409
|
-
else if (right < boundsRight)
|
|
9410
|
-
move.x += boundsRight - right;
|
|
9411
|
-
if (y > dragBounds.y)
|
|
9412
|
-
move.y += dragBounds.y - y;
|
|
9413
|
-
else if (bottom < boundsBottom)
|
|
9414
|
-
move.y += boundsBottom - bottom;
|
|
9415
|
-
}
|
|
9416
|
-
else {
|
|
9417
|
-
if (x < dragBounds.x)
|
|
9418
|
-
move.x += dragBounds.x - x;
|
|
9419
|
-
else if (right > boundsRight)
|
|
9420
|
-
move.x += boundsRight - right;
|
|
9421
|
-
if (y < dragBounds.y)
|
|
9422
|
-
move.y += dragBounds.y - y;
|
|
9423
|
-
else if (bottom > boundsBottom)
|
|
9424
|
-
move.y += boundsBottom - bottom;
|
|
9425
|
-
}
|
|
9426
|
-
return move;
|
|
9427
|
-
}
|
|
9428
|
-
getPageMove(total) {
|
|
9429
|
-
this.assignMove(total);
|
|
9430
|
-
return this.current.getPagePoint(tempMove, null, true);
|
|
9431
|
-
}
|
|
9432
|
-
getInnerMove(relative, total) {
|
|
9433
|
-
if (!relative)
|
|
9434
|
-
relative = this.current;
|
|
9435
|
-
this.assignMove(total);
|
|
9436
|
-
return relative.getInnerPoint(tempMove, null, true);
|
|
9437
|
-
}
|
|
9438
|
-
getLocalMove(relative, total) {
|
|
9439
|
-
if (!relative)
|
|
9440
|
-
relative = this.current;
|
|
9441
|
-
this.assignMove(total);
|
|
9442
|
-
return relative.getLocalPoint(tempMove, null, true);
|
|
9443
|
-
}
|
|
9444
|
-
getPageTotal() {
|
|
9445
|
-
return this.getPageMove(true);
|
|
9446
|
-
}
|
|
9447
|
-
getInnerTotal(relative) {
|
|
9448
|
-
return this.getInnerMove(relative, true);
|
|
9449
|
-
}
|
|
9450
|
-
getLocalTotal(relative) {
|
|
9451
|
-
return this.getLocalMove(relative, true);
|
|
9452
|
-
}
|
|
9453
|
-
getPageBounds() {
|
|
9454
|
-
const total = this.getPageTotal(), start = this.getPagePoint(), bounds = {};
|
|
9455
|
-
BoundsHelper.set(bounds, start.x - total.x, start.y - total.y, total.x, total.y);
|
|
9456
|
-
BoundsHelper.unsign(bounds);
|
|
9457
|
-
return bounds;
|
|
9458
|
-
}
|
|
9459
|
-
assignMove(total) {
|
|
9460
|
-
tempMove.x = total ? this.totalX : this.moveX;
|
|
9461
|
-
tempMove.y = total ? this.totalY : this.moveY;
|
|
9462
|
-
}
|
|
9463
|
-
};
|
|
9464
|
-
DragEvent$1.BEFORE_DRAG = 'drag.before_drag';
|
|
9465
|
-
DragEvent$1.START = 'drag.start';
|
|
9466
|
-
DragEvent$1.DRAG = 'drag';
|
|
9467
|
-
DragEvent$1.END = 'drag.end';
|
|
9468
|
-
DragEvent$1.OVER = 'drag.over';
|
|
9469
|
-
DragEvent$1.OUT = 'drag.out';
|
|
9470
|
-
DragEvent$1.ENTER = 'drag.enter';
|
|
9471
|
-
DragEvent$1.LEAVE = 'drag.leave';
|
|
9472
|
-
DragEvent$1 = __decorate([
|
|
9473
|
-
registerUIEvent()
|
|
9474
|
-
], DragEvent$1);
|
|
9475
|
-
|
|
9476
|
-
let DropEvent = class DropEvent extends PointerEvent$1 {
|
|
9477
|
-
static setList(data) {
|
|
9478
|
-
DragEvent$1.setList(data);
|
|
9479
|
-
}
|
|
9480
|
-
static setData(data) {
|
|
9481
|
-
DragEvent$1.setData(data);
|
|
9482
|
-
}
|
|
9483
|
-
};
|
|
9484
|
-
DropEvent.DROP = 'drop';
|
|
9485
|
-
DropEvent = __decorate([
|
|
9486
|
-
registerUIEvent()
|
|
9487
|
-
], DropEvent);
|
|
9488
|
-
|
|
9489
|
-
let MoveEvent = class MoveEvent extends DragEvent$1 {
|
|
9490
|
-
};
|
|
9491
|
-
MoveEvent.BEFORE_MOVE = 'move.before_move';
|
|
9492
|
-
MoveEvent.START = 'move.start';
|
|
9493
|
-
MoveEvent.MOVE = 'move';
|
|
9494
|
-
MoveEvent.END = 'move.end';
|
|
9495
|
-
MoveEvent = __decorate([
|
|
9496
|
-
registerUIEvent()
|
|
9497
|
-
], MoveEvent);
|
|
9498
|
-
|
|
9499
|
-
let RotateEvent = class RotateEvent extends PointerEvent$1 {
|
|
9500
|
-
};
|
|
9501
|
-
RotateEvent.BEFORE_ROTATE = 'rotate.before_rotate';
|
|
9502
|
-
RotateEvent.START = 'rotate.start';
|
|
9503
|
-
RotateEvent.ROTATE = 'rotate';
|
|
9504
|
-
RotateEvent.END = 'rotate.end';
|
|
9505
|
-
RotateEvent = __decorate([
|
|
9506
|
-
registerUIEvent()
|
|
9507
|
-
], RotateEvent);
|
|
9508
|
-
|
|
9509
|
-
let SwipeEvent = class SwipeEvent extends DragEvent$1 {
|
|
9510
|
-
};
|
|
9511
|
-
SwipeEvent.SWIPE = 'swipe';
|
|
9512
|
-
SwipeEvent.LEFT = 'swipe.left';
|
|
9513
|
-
SwipeEvent.RIGHT = 'swipe.right';
|
|
9514
|
-
SwipeEvent.UP = 'swipe.up';
|
|
9515
|
-
SwipeEvent.DOWN = 'swipe.down';
|
|
9516
|
-
SwipeEvent = __decorate([
|
|
9517
|
-
registerUIEvent()
|
|
9518
|
-
], SwipeEvent);
|
|
9519
|
-
|
|
9520
|
-
let ZoomEvent = class ZoomEvent extends PointerEvent$1 {
|
|
9521
|
-
};
|
|
9522
|
-
ZoomEvent.BEFORE_ZOOM = 'zoom.before_zoom';
|
|
9523
|
-
ZoomEvent.START = 'zoom.start';
|
|
9524
|
-
ZoomEvent.ZOOM = 'zoom';
|
|
9525
|
-
ZoomEvent.END = 'zoom.end';
|
|
9526
|
-
ZoomEvent = __decorate([
|
|
9527
|
-
registerUIEvent()
|
|
9528
|
-
], ZoomEvent);
|
|
9529
|
-
|
|
9530
|
-
let KeyEvent = class KeyEvent extends UIEvent {
|
|
9531
|
-
};
|
|
9532
|
-
KeyEvent.DOWN = 'key.down';
|
|
9533
|
-
KeyEvent.HOLD = 'key.hold';
|
|
9534
|
-
KeyEvent.UP = 'key.up';
|
|
9535
|
-
KeyEvent = __decorate([
|
|
9536
|
-
registerUIEvent()
|
|
9537
|
-
], KeyEvent);
|
|
9538
|
-
|
|
9539
|
-
new LeafList();
|
|
9540
|
-
|
|
9541
|
-
Debug.get('emit');
|
|
9542
|
-
|
|
9543
|
-
const { toInnerRadiusPointOf, copy: copy$2, setRadius } = PointHelper;
|
|
9544
|
-
const inner = {};
|
|
9545
|
-
const leaf = exports.Leaf.prototype;
|
|
9546
|
-
leaf.__hitWorld = function (point) {
|
|
9547
|
-
const data = this.__;
|
|
9548
|
-
if (!data.hitSelf)
|
|
9549
|
-
return false;
|
|
9550
|
-
const world = this.__world, layout = this.__layout;
|
|
9551
|
-
const isSmall = world.width < 10 && world.height < 10;
|
|
9552
|
-
if (data.hitRadius) {
|
|
9553
|
-
copy$2(inner, point), point = inner;
|
|
9554
|
-
setRadius(point, data.hitRadius);
|
|
9555
|
-
}
|
|
9556
|
-
toInnerRadiusPointOf(point, world, inner);
|
|
9557
|
-
if (data.hitBox || isSmall) {
|
|
9558
|
-
if (BoundsHelper.hitRadiusPoint(layout.boxBounds, inner))
|
|
9559
|
-
return true;
|
|
9560
|
-
if (isSmall)
|
|
9561
|
-
return false;
|
|
9562
|
-
}
|
|
9563
|
-
if (layout.hitCanvasChanged || !this.__hitCanvas) {
|
|
9564
|
-
this.__updateHitCanvas();
|
|
9565
|
-
if (!layout.boundsChanged)
|
|
9566
|
-
layout.hitCanvasChanged = false;
|
|
9567
|
-
}
|
|
9568
|
-
return this.__hit(inner);
|
|
9569
|
-
};
|
|
9570
|
-
leaf.__hitFill = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitFill(inner, this.__.windingRule); };
|
|
9571
|
-
leaf.__hitStroke = function (inner, strokeWidth) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitStroke(inner, strokeWidth); };
|
|
9572
|
-
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); };
|
|
9573
|
-
leaf.__drawHitPath = function (canvas) { if (canvas)
|
|
9574
|
-
this.__drawRenderPath(canvas); };
|
|
9575
|
-
|
|
9576
|
-
const matrix = new Matrix();
|
|
9577
|
-
const ui$1 = exports.UI.prototype;
|
|
9578
|
-
ui$1.__updateHitCanvas = function () {
|
|
9579
|
-
if (this.__box)
|
|
9580
|
-
this.__box.__updateHitCanvas();
|
|
9581
|
-
const data = this.__, { hitCanvasManager } = this.leafer || this.parent.leafer;
|
|
9582
|
-
const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === 'pixel';
|
|
9583
|
-
const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === 'pixel';
|
|
9584
|
-
const isHitPixel = isHitPixelFill || isHitPixelStroke;
|
|
9585
|
-
if (!this.__hitCanvas)
|
|
9586
|
-
this.__hitCanvas = isHitPixel ? hitCanvasManager.getPixelType(this, { contextSettings: { willReadFrequently: true } }) : hitCanvasManager.getPathType(this);
|
|
9587
|
-
const h = this.__hitCanvas;
|
|
9588
|
-
if (isHitPixel) {
|
|
9589
|
-
const { renderBounds } = this.__layout;
|
|
9590
|
-
const size = Platform.image.hitCanvasSize;
|
|
9591
|
-
const scale = h.hitScale = tempBounds$1.set(0, 0, size, size).getFitMatrix(renderBounds).a;
|
|
9592
|
-
const { x, y, width, height } = tempBounds$1.set(renderBounds).scale(scale);
|
|
9593
|
-
h.resize({ width, height, pixelRatio: 1 });
|
|
9594
|
-
h.clear();
|
|
9595
|
-
ImageManager.patternLocked = true;
|
|
9596
|
-
this.__renderShape(h, { matrix: matrix.setWith(this.__world).scaleWith(1 / scale).invertWith().translate(-x, -y) }, !isHitPixelFill, !isHitPixelStroke);
|
|
9597
|
-
ImageManager.patternLocked = false;
|
|
9598
|
-
h.resetTransform();
|
|
9599
|
-
data.__isHitPixel = true;
|
|
9600
|
-
}
|
|
9601
|
-
else {
|
|
9602
|
-
data.__isHitPixel && (data.__isHitPixel = false);
|
|
9603
|
-
}
|
|
9604
|
-
this.__drawHitPath(h);
|
|
9605
|
-
h.setStrokeOptions(data);
|
|
9606
|
-
};
|
|
9607
|
-
ui$1.__hit = function (inner) {
|
|
9608
|
-
if (this.__box && this.__box.__hit(inner))
|
|
9609
|
-
return true;
|
|
9610
|
-
const data = this.__;
|
|
9611
|
-
if (data.__isHitPixel && this.__hitPixel(inner))
|
|
9612
|
-
return true;
|
|
9613
|
-
const { hitFill } = data;
|
|
9614
|
-
const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.__isAlphaPixelFill || data.__isCanvas)))) || hitFill === 'all';
|
|
9615
|
-
if (needHitFillPath && this.__hitFill(inner))
|
|
9616
|
-
return true;
|
|
9617
|
-
const { hitStroke, __strokeWidth } = data;
|
|
9618
|
-
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.__isAlphaPixelStroke))) || hitStroke === 'all';
|
|
9619
|
-
if (!needHitFillPath && !needHitStrokePath)
|
|
9620
|
-
return false;
|
|
9621
|
-
const radiusWidth = inner.radiusX * 2;
|
|
9622
|
-
let hitWidth = radiusWidth;
|
|
9623
|
-
if (needHitStrokePath) {
|
|
9624
|
-
switch (data.strokeAlign) {
|
|
9625
|
-
case 'inside':
|
|
9626
|
-
hitWidth += __strokeWidth * 2;
|
|
9627
|
-
if (!needHitFillPath && this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
|
|
9628
|
-
return true;
|
|
9629
|
-
hitWidth = radiusWidth;
|
|
9630
|
-
break;
|
|
9631
|
-
case 'center':
|
|
9632
|
-
hitWidth += __strokeWidth;
|
|
9633
|
-
break;
|
|
9634
|
-
case 'outside':
|
|
9635
|
-
hitWidth += __strokeWidth * 2;
|
|
9636
|
-
if (!needHitFillPath) {
|
|
9637
|
-
if (!this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
|
|
9638
|
-
return true;
|
|
9639
|
-
hitWidth = radiusWidth;
|
|
9640
|
-
}
|
|
9641
|
-
break;
|
|
9642
|
-
}
|
|
9643
|
-
}
|
|
9644
|
-
return hitWidth ? this.__hitStroke(inner, hitWidth) : false;
|
|
9645
|
-
};
|
|
9646
|
-
|
|
9647
|
-
const ui = exports.UI.prototype, rect = exports.Rect.prototype, box$1 = exports.Box.prototype;
|
|
9648
|
-
rect.__updateHitCanvas = box$1.__updateHitCanvas = function () {
|
|
9649
|
-
if (this.stroke || this.cornerRadius || ((this.fill || this.__.__isCanvas) && this.hitFill === 'pixel') || this.hitStroke === 'all')
|
|
9650
|
-
ui.__updateHitCanvas.call(this);
|
|
9651
|
-
else if (this.__hitCanvas)
|
|
9652
|
-
this.__hitCanvas = null;
|
|
9653
|
-
};
|
|
9654
|
-
rect.__hitFill = box$1.__hitFill = function (inner) {
|
|
9655
|
-
return this.__hitCanvas ? ui.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
|
|
9656
|
-
};
|
|
9657
|
-
|
|
9658
|
-
exports.Text.prototype.__drawHitPath = function (canvas) {
|
|
9659
|
-
const { __lineHeight, fontSize, __baseLine, __letterSpacing, __textDrawData: data } = this.__;
|
|
9660
|
-
canvas.beginPath();
|
|
9661
|
-
if (__letterSpacing < 0)
|
|
9662
|
-
this.__drawPathByBox(canvas);
|
|
9663
|
-
else
|
|
9664
|
-
data.rows.forEach(row => canvas.rect(row.x, row.y - __baseLine, row.width, __lineHeight < fontSize ? fontSize : __lineHeight));
|
|
9665
|
-
};
|
|
9666
|
-
|
|
9667
|
-
function getSelector(ui) {
|
|
9668
|
-
return ui.leafer ? ui.leafer.selector : (Platform.selector || (Platform.selector = Creator.selector()));
|
|
9669
|
-
}
|
|
9670
|
-
exports.Group.prototype.pick = function (hitPoint, options) {
|
|
9671
|
-
options || (options = emptyData);
|
|
9672
|
-
this.updateLayout();
|
|
9673
|
-
return getSelector(this).getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this }));
|
|
9674
|
-
};
|
|
9675
|
-
|
|
9676
|
-
const canvas = LeaferCanvasBase.prototype;
|
|
9677
|
-
canvas.hitFill = function (point, fillRule) {
|
|
9678
|
-
return fillRule ? this.context.isPointInPath(point.x, point.y, fillRule) : this.context.isPointInPath(point.x, point.y);
|
|
9679
|
-
};
|
|
9680
|
-
canvas.hitStroke = function (point, strokeWidth) {
|
|
9681
|
-
this.strokeWidth = strokeWidth;
|
|
9682
|
-
return this.context.isPointInStroke(point.x, point.y);
|
|
9683
|
-
};
|
|
9684
|
-
canvas.hitPixel = function (radiusPoint, offset, scale = 1) {
|
|
9685
|
-
let { x, y, radiusX, radiusY } = radiusPoint;
|
|
9686
|
-
if (offset)
|
|
9687
|
-
x -= offset.x, y -= offset.y;
|
|
9688
|
-
tempBounds$1.set(x - radiusX, y - radiusY, radiusX * 2, radiusY * 2).scale(scale).ceil();
|
|
9689
|
-
const { data } = this.context.getImageData(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width || 1, tempBounds$1.height || 1);
|
|
9690
|
-
for (let i = 0, len = data.length; i < len; i += 4) {
|
|
9691
|
-
if (data[i + 3] > 0)
|
|
9692
|
-
return true;
|
|
9693
|
-
}
|
|
9694
|
-
return data[3] > 0;
|
|
9695
|
-
};
|
|
9696
|
-
|
|
9697
9178
|
function strokeText(stroke, ui, canvas) {
|
|
9698
9179
|
switch (ui.__.strokeAlign) {
|
|
9699
9180
|
case 'center':
|
|
@@ -9719,11 +9200,14 @@ var LeaferUI = (function (exports) {
|
|
|
9719
9200
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
9720
9201
|
fillText(ui, out);
|
|
9721
9202
|
out.blendMode = 'normal';
|
|
9203
|
+
copyWorld(canvas, out, ui);
|
|
9204
|
+
out.recycle(ui.__nowWorld);
|
|
9205
|
+
}
|
|
9206
|
+
function copyWorld(canvas, out, ui) {
|
|
9722
9207
|
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
9723
9208
|
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9724
9209
|
else
|
|
9725
9210
|
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
9726
|
-
out.recycle(ui.__nowWorld);
|
|
9727
9211
|
}
|
|
9728
9212
|
function drawTextStroke(ui, canvas) {
|
|
9729
9213
|
let row, data = ui.__.__textDrawData;
|
|
@@ -9792,9 +9276,8 @@ var LeaferUI = (function (exports) {
|
|
|
9792
9276
|
Paint.strokeArrow(stroke, ui, canvas);
|
|
9793
9277
|
}
|
|
9794
9278
|
function drawInside(stroke, ui, canvas) {
|
|
9795
|
-
const data = ui.__;
|
|
9796
9279
|
canvas.save();
|
|
9797
|
-
|
|
9280
|
+
canvas.clipUI(ui);
|
|
9798
9281
|
drawCenter(stroke, 2, ui, canvas);
|
|
9799
9282
|
canvas.restore();
|
|
9800
9283
|
}
|
|
@@ -9808,12 +9291,9 @@ var LeaferUI = (function (exports) {
|
|
|
9808
9291
|
const out = canvas.getSameCanvas(true, true);
|
|
9809
9292
|
ui.__drawRenderPath(out);
|
|
9810
9293
|
drawCenter(stroke, 2, ui, out);
|
|
9811
|
-
|
|
9294
|
+
out.clipUI(data);
|
|
9812
9295
|
out.clearWorld(renderBounds);
|
|
9813
|
-
|
|
9814
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9815
|
-
else
|
|
9816
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, renderBounds);
|
|
9296
|
+
copyWorld(canvas, out, ui);
|
|
9817
9297
|
out.recycle(ui.__nowWorld);
|
|
9818
9298
|
}
|
|
9819
9299
|
}
|
|
@@ -9869,9 +9349,7 @@ var LeaferUI = (function (exports) {
|
|
|
9869
9349
|
paints = [paints];
|
|
9870
9350
|
recycleMap = PaintImage.recycleImage(attrName, data);
|
|
9871
9351
|
for (let i = 0, len = paints.length, item; i < len; i++) {
|
|
9872
|
-
item = getLeafPaint(attrName, paints[i], ui);
|
|
9873
|
-
if (item)
|
|
9874
|
-
leafPaints.push(item);
|
|
9352
|
+
(item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item);
|
|
9875
9353
|
}
|
|
9876
9354
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
9877
9355
|
if (leafPaints.length) {
|
|
@@ -9909,8 +9387,8 @@ var LeaferUI = (function (exports) {
|
|
|
9909
9387
|
data = PaintGradient.conicGradient(paint, boxBounds);
|
|
9910
9388
|
break;
|
|
9911
9389
|
case 'solid':
|
|
9912
|
-
const { type,
|
|
9913
|
-
data = { type,
|
|
9390
|
+
const { type, color, opacity } = paint;
|
|
9391
|
+
data = { type, style: ColorConvert.string(color, opacity) };
|
|
9914
9392
|
break;
|
|
9915
9393
|
default:
|
|
9916
9394
|
if (paint.r !== undefined)
|
|
@@ -10287,7 +9765,7 @@ var LeaferUI = (function (exports) {
|
|
|
10287
9765
|
}
|
|
10288
9766
|
function drawImage(ui, canvas, paint, data) {
|
|
10289
9767
|
canvas.save();
|
|
10290
|
-
|
|
9768
|
+
canvas.clipUI(ui);
|
|
10291
9769
|
if (paint.blendMode)
|
|
10292
9770
|
canvas.blendMode = paint.blendMode;
|
|
10293
9771
|
if (data.opacity)
|
|
@@ -10452,12 +9930,10 @@ var LeaferUI = (function (exports) {
|
|
|
10452
9930
|
}
|
|
10453
9931
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
|
|
10454
9932
|
}
|
|
10455
|
-
if (ui.__worldFlipped)
|
|
9933
|
+
if (ui.__worldFlipped)
|
|
10456
9934
|
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
10457
|
-
|
|
10458
|
-
else {
|
|
9935
|
+
else
|
|
10459
9936
|
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
10460
|
-
}
|
|
10461
9937
|
if (end && index < end)
|
|
10462
9938
|
other.clearWorld(copyBounds, true);
|
|
10463
9939
|
});
|
|
@@ -10516,12 +9992,10 @@ var LeaferUI = (function (exports) {
|
|
|
10516
9992
|
copyBounds = bounds;
|
|
10517
9993
|
}
|
|
10518
9994
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
|
|
10519
|
-
if (ui.__worldFlipped)
|
|
9995
|
+
if (ui.__worldFlipped)
|
|
10520
9996
|
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
10521
|
-
|
|
10522
|
-
else {
|
|
9997
|
+
else
|
|
10523
9998
|
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
10524
|
-
}
|
|
10525
9999
|
if (end && index < end)
|
|
10526
10000
|
other.clearWorld(copyBounds, true);
|
|
10527
10001
|
});
|