leafer-ui 1.6.7 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -4
- package/dist/web.cjs +100 -61
- package/dist/web.esm.js +101 -62
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +329 -203
- 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 +327 -203
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +11 -11
package/dist/web.js
CHANGED
|
@@ -46,7 +46,7 @@ var LeaferUI = (function (exports) {
|
|
|
46
46
|
};
|
|
47
47
|
const I$2 = IncrementId;
|
|
48
48
|
|
|
49
|
-
const { round: round$3, pow: pow$1, PI: PI$
|
|
49
|
+
const { round: round$3, pow: pow$1, PI: PI$3 } = Math;
|
|
50
50
|
const MathHelper = {
|
|
51
51
|
within(value, min, max) {
|
|
52
52
|
if (typeof min === 'object')
|
|
@@ -142,9 +142,9 @@ var LeaferUI = (function (exports) {
|
|
|
142
142
|
function randInt(num) {
|
|
143
143
|
return Math.round(Math.random() * num);
|
|
144
144
|
}
|
|
145
|
-
const OneRadian = PI$
|
|
146
|
-
const PI2 = PI$
|
|
147
|
-
const PI_2 = PI$
|
|
145
|
+
const OneRadian = PI$3 / 180;
|
|
146
|
+
const PI2 = PI$3 * 2;
|
|
147
|
+
const PI_2 = PI$3 / 2;
|
|
148
148
|
function getPointData() { return { x: 0, y: 0 }; }
|
|
149
149
|
function getBoundsData() { return { x: 0, y: 0, width: 0, height: 0 }; }
|
|
150
150
|
function getMatrixData() { return { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 }; }
|
|
@@ -439,7 +439,7 @@ var LeaferUI = (function (exports) {
|
|
|
439
439
|
const M$6 = MatrixHelper;
|
|
440
440
|
|
|
441
441
|
const { toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3 } = MatrixHelper;
|
|
442
|
-
const { sin: sin$4, cos: cos$4, abs: abs$
|
|
442
|
+
const { sin: sin$4, cos: cos$4, abs: abs$3, sqrt: sqrt$2, atan2: atan2$2, min: min$1, round: round$2 } = Math;
|
|
443
443
|
const PointHelper = {
|
|
444
444
|
defaultPoint: getPointData(),
|
|
445
445
|
tempPoint: {},
|
|
@@ -534,8 +534,8 @@ var LeaferUI = (function (exports) {
|
|
|
534
534
|
return getDistanceFrom(t.x, t.y, point.x, point.y);
|
|
535
535
|
},
|
|
536
536
|
getDistanceFrom(x1, y1, x2, y2) {
|
|
537
|
-
const x = abs$
|
|
538
|
-
const y = abs$
|
|
537
|
+
const x = abs$3(x2 - x1);
|
|
538
|
+
const y = abs$3(y2 - y1);
|
|
539
539
|
return sqrt$2(x * x + y * y);
|
|
540
540
|
},
|
|
541
541
|
getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
|
|
@@ -552,10 +552,11 @@ var LeaferUI = (function (exports) {
|
|
|
552
552
|
getRadianFrom(fromX, fromY, originX, originY, toX, toY, toOriginX, toOriginY) {
|
|
553
553
|
if (toOriginX === undefined)
|
|
554
554
|
toOriginX = originX, toOriginY = originY;
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
const
|
|
558
|
-
|
|
555
|
+
const a = fromX - originX;
|
|
556
|
+
const b = fromY - originY;
|
|
557
|
+
const c = toX - toOriginX;
|
|
558
|
+
const d = toY - toOriginY;
|
|
559
|
+
return Math.atan2(a * d - b * c, a * c + b * d);
|
|
559
560
|
},
|
|
560
561
|
getAtan2(t, to) {
|
|
561
562
|
return atan2$2(to.y - t.y, to.x - t.x);
|
|
@@ -765,7 +766,7 @@ var LeaferUI = (function (exports) {
|
|
|
765
766
|
MatrixHelper.reset(this);
|
|
766
767
|
}
|
|
767
768
|
}
|
|
768
|
-
const tempMatrix = new Matrix();
|
|
769
|
+
const tempMatrix$1 = new Matrix();
|
|
769
770
|
|
|
770
771
|
const TwoPointBoundsHelper = {
|
|
771
772
|
tempPointBounds: {},
|
|
@@ -862,6 +863,12 @@ var LeaferUI = (function (exports) {
|
|
|
862
863
|
}
|
|
863
864
|
if (!onlyBoxSize)
|
|
864
865
|
to.x += box.x, to.y += box.y;
|
|
866
|
+
},
|
|
867
|
+
getPoint(around, box, to) {
|
|
868
|
+
if (!to)
|
|
869
|
+
to = {};
|
|
870
|
+
AroundHelper.toPoint(around, box, to, true);
|
|
871
|
+
return to;
|
|
865
872
|
}
|
|
866
873
|
};
|
|
867
874
|
function get$4(around) {
|
|
@@ -1790,10 +1797,13 @@ var LeaferUI = (function (exports) {
|
|
|
1790
1797
|
return (target, key) => {
|
|
1791
1798
|
if (!realName)
|
|
1792
1799
|
realName = key;
|
|
1793
|
-
|
|
1800
|
+
const property = {
|
|
1794
1801
|
get() { return this.context[realName]; },
|
|
1795
1802
|
set(value) { this.context[realName] = value; }
|
|
1796
|
-
}
|
|
1803
|
+
};
|
|
1804
|
+
if (key === 'strokeCap')
|
|
1805
|
+
property.set = function (value) { this.context[realName] = value === 'none' ? 'butt' : value; };
|
|
1806
|
+
Object.defineProperty(target, key, property);
|
|
1797
1807
|
};
|
|
1798
1808
|
}
|
|
1799
1809
|
const contextMethodNameList = [];
|
|
@@ -2069,15 +2079,15 @@ var LeaferUI = (function (exports) {
|
|
|
2069
2079
|
contextMethod()
|
|
2070
2080
|
], Canvas.prototype, "strokeText", null);
|
|
2071
2081
|
|
|
2072
|
-
const { copy: copy$9, multiplyParent: multiplyParent$
|
|
2082
|
+
const { copy: copy$9, multiplyParent: multiplyParent$4 } = MatrixHelper, { round: round$1 } = Math;
|
|
2073
2083
|
const minSize = { width: 1, height: 1, pixelRatio: 1 };
|
|
2074
2084
|
const canvasSizeAttrs = ['width', 'height', 'pixelRatio'];
|
|
2075
2085
|
class LeaferCanvasBase extends Canvas {
|
|
2076
2086
|
get width() { return this.size.width; }
|
|
2077
2087
|
get height() { return this.size.height; }
|
|
2078
2088
|
get pixelRatio() { return this.size.pixelRatio; }
|
|
2079
|
-
get pixelWidth() { return this.width * this.pixelRatio; }
|
|
2080
|
-
get pixelHeight() { return this.height * this.pixelRatio; }
|
|
2089
|
+
get pixelWidth() { return this.width * this.pixelRatio || 0; }
|
|
2090
|
+
get pixelHeight() { return this.height * this.pixelRatio || 0; }
|
|
2081
2091
|
get pixelSnap() { return this.config.pixelSnap; }
|
|
2082
2092
|
set pixelSnap(value) { this.config.pixelSnap = value; }
|
|
2083
2093
|
get allowBackgroundColor() { return this.view && this.parentView; }
|
|
@@ -2142,7 +2152,7 @@ var LeaferUI = (function (exports) {
|
|
|
2142
2152
|
setWorld(matrix, parentMatrix) {
|
|
2143
2153
|
const { pixelRatio, pixelSnap } = this, w = this.worldTransform;
|
|
2144
2154
|
if (parentMatrix)
|
|
2145
|
-
multiplyParent$
|
|
2155
|
+
multiplyParent$4(matrix, parentMatrix, w);
|
|
2146
2156
|
w.a = matrix.a * pixelRatio;
|
|
2147
2157
|
w.b = matrix.b * pixelRatio;
|
|
2148
2158
|
w.c = matrix.c * pixelRatio;
|
|
@@ -2164,20 +2174,33 @@ var LeaferUI = (function (exports) {
|
|
|
2164
2174
|
if (w)
|
|
2165
2175
|
this.setTransform(w.a, w.b, w.c, w.d, w.e, w.f);
|
|
2166
2176
|
}
|
|
2167
|
-
setStroke(color, strokeWidth, options) {
|
|
2177
|
+
setStroke(color, strokeWidth, options, childOptions) {
|
|
2168
2178
|
if (strokeWidth)
|
|
2169
2179
|
this.strokeWidth = strokeWidth;
|
|
2170
2180
|
if (color)
|
|
2171
2181
|
this.strokeStyle = color;
|
|
2172
2182
|
if (options)
|
|
2173
|
-
this.setStrokeOptions(options);
|
|
2174
|
-
}
|
|
2175
|
-
setStrokeOptions(options) {
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2183
|
+
this.setStrokeOptions(options, childOptions);
|
|
2184
|
+
}
|
|
2185
|
+
setStrokeOptions(options, childOptions) {
|
|
2186
|
+
let { strokeCap, strokeJoin, dashPattern, dashOffset, miterLimit } = options;
|
|
2187
|
+
if (childOptions) {
|
|
2188
|
+
if (childOptions.strokeCap)
|
|
2189
|
+
strokeCap = childOptions.strokeCap;
|
|
2190
|
+
if (childOptions.strokeJoin)
|
|
2191
|
+
strokeJoin = childOptions.strokeJoin;
|
|
2192
|
+
if (childOptions.dashPattern !== undefined)
|
|
2193
|
+
dashPattern = childOptions.dashPattern;
|
|
2194
|
+
if (childOptions.dashOffset !== undefined)
|
|
2195
|
+
dashOffset = childOptions.dashOffset;
|
|
2196
|
+
if (childOptions.miterLimit)
|
|
2197
|
+
miterLimit = childOptions.miterLimit;
|
|
2198
|
+
}
|
|
2199
|
+
this.strokeCap = strokeCap;
|
|
2200
|
+
this.strokeJoin = strokeJoin;
|
|
2201
|
+
this.dashPattern = dashPattern;
|
|
2202
|
+
this.dashOffset = dashOffset;
|
|
2203
|
+
this.miterLimit = miterLimit;
|
|
2181
2204
|
}
|
|
2182
2205
|
saveBlendMode(blendMode) {
|
|
2183
2206
|
this.savedBlendMode = this.blendMode;
|
|
@@ -2411,7 +2434,7 @@ var LeaferUI = (function (exports) {
|
|
|
2411
2434
|
}
|
|
2412
2435
|
};
|
|
2413
2436
|
|
|
2414
|
-
const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$
|
|
2437
|
+
const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$2, PI: PI$2, sqrt: sqrt$1, pow } = Math;
|
|
2415
2438
|
const { setPoint: setPoint$1, addPoint: addPoint$1 } = TwoPointBoundsHelper;
|
|
2416
2439
|
const { set, toNumberPoints } = PointHelper;
|
|
2417
2440
|
const { M: M$5, L: L$6, C: C$4, Q: Q$4, Z: Z$5 } = PathCommandMap;
|
|
@@ -2486,7 +2509,7 @@ var LeaferUI = (function (exports) {
|
|
|
2486
2509
|
let totalRadian = endRadian - startRadian;
|
|
2487
2510
|
if (totalRadian < 0)
|
|
2488
2511
|
totalRadian += PI2;
|
|
2489
|
-
if (totalRadian === PI$2 || (abs$
|
|
2512
|
+
if (totalRadian === PI$2 || (abs$2(BAx + BAy) < 1.e-12) || (abs$2(CBx + CBy) < 1.e-12)) {
|
|
2490
2513
|
if (data)
|
|
2491
2514
|
data.push(L$6, x1, y1);
|
|
2492
2515
|
if (setPointBounds) {
|
|
@@ -2528,7 +2551,7 @@ var LeaferUI = (function (exports) {
|
|
|
2528
2551
|
totalRadian -= PI2;
|
|
2529
2552
|
if (anticlockwise)
|
|
2530
2553
|
totalRadian -= PI2;
|
|
2531
|
-
const parts = ceil$1(abs$
|
|
2554
|
+
const parts = ceil$1(abs$2(totalRadian / PI_2));
|
|
2532
2555
|
const partRadian = totalRadian / parts;
|
|
2533
2556
|
const partRadian4Sin = sin$3(partRadian / 4);
|
|
2534
2557
|
const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$3(partRadian / 2);
|
|
@@ -2973,7 +2996,7 @@ var LeaferUI = (function (exports) {
|
|
|
2973
2996
|
|
|
2974
2997
|
const { M: M$3, L: L$4, C: C$2, Q: Q$2, Z: Z$3, N: N$2, D: D$2, X: X$2, G: G$2, F: F$3, O: O$2, P: P$2, U: U$2 } = PathCommandMap;
|
|
2975
2998
|
const { getMinDistanceFrom, getRadianFrom } = PointHelper;
|
|
2976
|
-
const { tan, min, abs: abs$
|
|
2999
|
+
const { tan, min, abs: abs$1 } = Math;
|
|
2977
3000
|
const startPoint = {};
|
|
2978
3001
|
const PathCommandDataHelper = {
|
|
2979
3002
|
beginPath(data) {
|
|
@@ -3036,7 +3059,7 @@ var LeaferUI = (function (exports) {
|
|
|
3036
3059
|
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
|
|
3037
3060
|
if (lastX !== undefined) {
|
|
3038
3061
|
const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
|
|
3039
|
-
radius = min(radius, min(d / 2, d / 2 * abs$
|
|
3062
|
+
radius = min(radius, min(d / 2, d / 2 * abs$1(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
|
|
3040
3063
|
}
|
|
3041
3064
|
data.push(U$2, x1, y1, x2, y2, radius);
|
|
3042
3065
|
},
|
|
@@ -3342,7 +3365,7 @@ var LeaferUI = (function (exports) {
|
|
|
3342
3365
|
const { arcTo } = PathCommandDataHelper;
|
|
3343
3366
|
const PathCorner = {
|
|
3344
3367
|
smooth(data, cornerRadius, _cornerSmoothing) {
|
|
3345
|
-
let command, commandLen;
|
|
3368
|
+
let command, lastCommand, commandLen;
|
|
3346
3369
|
let i = 0, x = 0, y = 0, startX = 0, startY = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0;
|
|
3347
3370
|
const len = data.length;
|
|
3348
3371
|
const smooth = [];
|
|
@@ -3380,8 +3403,10 @@ var LeaferUI = (function (exports) {
|
|
|
3380
3403
|
lastY = y;
|
|
3381
3404
|
break;
|
|
3382
3405
|
case Z:
|
|
3383
|
-
|
|
3384
|
-
|
|
3406
|
+
if (lastCommand !== Z) {
|
|
3407
|
+
arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY);
|
|
3408
|
+
smooth.push(Z);
|
|
3409
|
+
}
|
|
3385
3410
|
i += 1;
|
|
3386
3411
|
break;
|
|
3387
3412
|
default:
|
|
@@ -3390,6 +3415,7 @@ var LeaferUI = (function (exports) {
|
|
|
3390
3415
|
smooth.push(data[i + j]);
|
|
3391
3416
|
i += commandLen;
|
|
3392
3417
|
}
|
|
3418
|
+
lastCommand = command;
|
|
3393
3419
|
}
|
|
3394
3420
|
if (command !== Z) {
|
|
3395
3421
|
smooth[1] = startX;
|
|
@@ -3886,12 +3912,12 @@ var LeaferUI = (function (exports) {
|
|
|
3886
3912
|
try {
|
|
3887
3913
|
if (transform && pattern.setTransform) {
|
|
3888
3914
|
pattern.setTransform(transform);
|
|
3889
|
-
transform =
|
|
3915
|
+
transform = undefined;
|
|
3890
3916
|
}
|
|
3891
3917
|
}
|
|
3892
3918
|
catch (_a) { }
|
|
3893
3919
|
if (paint)
|
|
3894
|
-
paint
|
|
3920
|
+
DataHelper.stintSet(paint, 'transform', transform);
|
|
3895
3921
|
return pattern;
|
|
3896
3922
|
}
|
|
3897
3923
|
destroy() {
|
|
@@ -3909,6 +3935,13 @@ var LeaferUI = (function (exports) {
|
|
|
3909
3935
|
function getDescriptor(object, name) {
|
|
3910
3936
|
return Object.getOwnPropertyDescriptor(object, name);
|
|
3911
3937
|
}
|
|
3938
|
+
function createDescriptor(key, defaultValue) {
|
|
3939
|
+
const privateKey = '_' + key;
|
|
3940
|
+
return {
|
|
3941
|
+
get() { const v = this[privateKey]; return v === undefined ? defaultValue : v; },
|
|
3942
|
+
set(value) { this[privateKey] = value; }
|
|
3943
|
+
};
|
|
3944
|
+
}
|
|
3912
3945
|
function getNames(object) {
|
|
3913
3946
|
return Object.getOwnPropertyNames(object);
|
|
3914
3947
|
}
|
|
@@ -3996,10 +4029,14 @@ var LeaferUI = (function (exports) {
|
|
|
3996
4029
|
}));
|
|
3997
4030
|
}
|
|
3998
4031
|
const pathType = boundsType;
|
|
3999
|
-
function affectStrokeBoundsType(defaultValue) {
|
|
4032
|
+
function affectStrokeBoundsType(defaultValue, useStroke) {
|
|
4000
4033
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
4001
4034
|
set(value) {
|
|
4002
|
-
this.__setAttr(key, value)
|
|
4035
|
+
if (this.__setAttr(key, value)) {
|
|
4036
|
+
doStrokeType(this);
|
|
4037
|
+
if (useStroke)
|
|
4038
|
+
this.__.__useStroke = true;
|
|
4039
|
+
}
|
|
4003
4040
|
}
|
|
4004
4041
|
}));
|
|
4005
4042
|
}
|
|
@@ -4137,15 +4174,7 @@ var LeaferUI = (function (exports) {
|
|
|
4137
4174
|
const data = target.__DataProcessor.prototype;
|
|
4138
4175
|
const computedKey = '_' + key;
|
|
4139
4176
|
const setMethodName = getSetMethodName(key);
|
|
4140
|
-
const property =
|
|
4141
|
-
get() {
|
|
4142
|
-
const v = this[computedKey];
|
|
4143
|
-
return v === undefined ? defaultValue : v;
|
|
4144
|
-
},
|
|
4145
|
-
set(value) {
|
|
4146
|
-
this[computedKey] = value;
|
|
4147
|
-
}
|
|
4148
|
-
};
|
|
4177
|
+
const property = createDescriptor(key, defaultValue);
|
|
4149
4178
|
if (defaultValue === undefined) {
|
|
4150
4179
|
property.get = function () { return this[computedKey]; };
|
|
4151
4180
|
}
|
|
@@ -4260,7 +4289,7 @@ var LeaferUI = (function (exports) {
|
|
|
4260
4289
|
};
|
|
4261
4290
|
}
|
|
4262
4291
|
|
|
4263
|
-
const { copy: copy$7, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$
|
|
4292
|
+
const { copy: copy$7, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$3, divideParent, getLayout } = MatrixHelper;
|
|
4264
4293
|
const matrix$1 = {}, { round } = Math;
|
|
4265
4294
|
const LeafHelper = {
|
|
4266
4295
|
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
@@ -4332,6 +4361,14 @@ var LeaferUI = (function (exports) {
|
|
|
4332
4361
|
}
|
|
4333
4362
|
return true;
|
|
4334
4363
|
},
|
|
4364
|
+
copyCanvasByWorld(leaf, currentCanvas, fromCanvas, fromWorld, blendMode, onlyResetTransform) {
|
|
4365
|
+
if (!fromWorld)
|
|
4366
|
+
fromWorld = leaf.__nowWorld;
|
|
4367
|
+
if (leaf.__worldFlipped || Platform.fullImageShadow)
|
|
4368
|
+
currentCanvas.copyWorldByReset(fromCanvas, fromWorld, leaf.__nowWorld, blendMode, onlyResetTransform);
|
|
4369
|
+
else
|
|
4370
|
+
currentCanvas.copyWorldToInner(fromCanvas, fromWorld, leaf.__layout.renderBounds, blendMode);
|
|
4371
|
+
},
|
|
4335
4372
|
moveWorld(t, x, y = 0, isInnerPoint, transition) {
|
|
4336
4373
|
const local = typeof x === 'object' ? Object.assign({}, x) : { x, y };
|
|
4337
4374
|
isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : (t.parent && toInnerPoint$1(t.parent.worldTransform, local, local, true));
|
|
@@ -4391,14 +4428,14 @@ var LeaferUI = (function (exports) {
|
|
|
4391
4428
|
},
|
|
4392
4429
|
transformWorld(t, transform, resize, transition) {
|
|
4393
4430
|
copy$7(matrix$1, t.worldTransform);
|
|
4394
|
-
multiplyParent$
|
|
4431
|
+
multiplyParent$3(matrix$1, transform);
|
|
4395
4432
|
if (t.parent)
|
|
4396
4433
|
divideParent(matrix$1, t.parent.worldTransform);
|
|
4397
4434
|
L.setTransform(t, matrix$1, resize, transition);
|
|
4398
4435
|
},
|
|
4399
4436
|
transform(t, transform, resize, transition) {
|
|
4400
4437
|
copy$7(matrix$1, t.localTransform);
|
|
4401
|
-
multiplyParent$
|
|
4438
|
+
multiplyParent$3(matrix$1, transform);
|
|
4402
4439
|
L.setTransform(t, matrix$1, resize, transition);
|
|
4403
4440
|
},
|
|
4404
4441
|
setTransform(t, transform, resize, transition) {
|
|
@@ -5260,17 +5297,18 @@ var LeaferUI = (function (exports) {
|
|
|
5260
5297
|
}
|
|
5261
5298
|
};
|
|
5262
5299
|
|
|
5263
|
-
const { setLayout, multiplyParent: multiplyParent$
|
|
5300
|
+
const { setLayout, multiplyParent: multiplyParent$2, translateInner, defaultWorld } = MatrixHelper;
|
|
5264
5301
|
const { toPoint: toPoint$3, tempPoint } = AroundHelper;
|
|
5265
5302
|
const LeafMatrix = {
|
|
5266
5303
|
__updateWorldMatrix() {
|
|
5267
|
-
|
|
5304
|
+
const { parent, __layout } = this;
|
|
5305
|
+
multiplyParent$2(this.__local || __layout, parent ? parent.__world : defaultWorld, this.__world, !!__layout.affectScaleOrRotation, this.__, parent && (parent.scrollY || parent.scrollX) && parent.__);
|
|
5268
5306
|
},
|
|
5269
5307
|
__updateLocalMatrix() {
|
|
5270
5308
|
if (this.__local) {
|
|
5271
5309
|
const layout = this.__layout, local = this.__local, data = this.__;
|
|
5272
5310
|
if (layout.affectScaleOrRotation) {
|
|
5273
|
-
if ((layout.scaleChanged && (layout.resized = 'scale')) || layout.rotationChanged) {
|
|
5311
|
+
if ((layout.scaleChanged && (layout.resized || (layout.resized = 'scale'))) || layout.rotationChanged) {
|
|
5274
5312
|
setLayout(local, data, null, null, layout.affectRotation);
|
|
5275
5313
|
layout.scaleChanged = layout.rotationChanged = undefined;
|
|
5276
5314
|
}
|
|
@@ -5425,6 +5463,8 @@ var LeaferUI = (function (exports) {
|
|
|
5425
5463
|
|
|
5426
5464
|
const LeafRender = {
|
|
5427
5465
|
__render(canvas, options) {
|
|
5466
|
+
if (options.shape)
|
|
5467
|
+
return this.__renderShape(canvas, options);
|
|
5428
5468
|
if (this.__worldOpacity) {
|
|
5429
5469
|
const data = this.__;
|
|
5430
5470
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
@@ -5434,12 +5474,7 @@ var LeaferUI = (function (exports) {
|
|
|
5434
5474
|
return this.__renderEraser(canvas, options);
|
|
5435
5475
|
const tempCanvas = canvas.getSameCanvas(true, true);
|
|
5436
5476
|
this.__draw(tempCanvas, options, canvas);
|
|
5437
|
-
|
|
5438
|
-
canvas.copyWorldByReset(tempCanvas, this.__nowWorld, null, data.__blendMode, true);
|
|
5439
|
-
}
|
|
5440
|
-
else {
|
|
5441
|
-
canvas.copyWorldToInner(tempCanvas, this.__nowWorld, this.__layout.renderBounds, data.__blendMode);
|
|
5442
|
-
}
|
|
5477
|
+
LeafHelper.copyCanvasByWorld(this, canvas, tempCanvas, this.__nowWorld, data.__blendMode, true);
|
|
5443
5478
|
tempCanvas.recycle(this.__nowWorld);
|
|
5444
5479
|
}
|
|
5445
5480
|
else {
|
|
@@ -5449,6 +5484,12 @@ var LeaferUI = (function (exports) {
|
|
|
5449
5484
|
Debug.drawBounds(this, canvas, options);
|
|
5450
5485
|
}
|
|
5451
5486
|
},
|
|
5487
|
+
__renderShape(canvas, options) {
|
|
5488
|
+
if (this.__worldOpacity) {
|
|
5489
|
+
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
5490
|
+
this.__drawShape(canvas, options);
|
|
5491
|
+
}
|
|
5492
|
+
},
|
|
5452
5493
|
__clip(canvas, options) {
|
|
5453
5494
|
if (this.__worldOpacity) {
|
|
5454
5495
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
@@ -5481,7 +5522,7 @@ var LeaferUI = (function (exports) {
|
|
|
5481
5522
|
options.dimOpacity = data.dim === true ? 0.2 : data.dim;
|
|
5482
5523
|
else if (data.dimskip)
|
|
5483
5524
|
options.dimOpacity && (options.dimOpacity = 0);
|
|
5484
|
-
if (data.__single) {
|
|
5525
|
+
if (data.__single && !this.isBranchLeaf) {
|
|
5485
5526
|
if (data.eraser === 'path')
|
|
5486
5527
|
return this.__renderEraser(canvas, options);
|
|
5487
5528
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
@@ -5503,9 +5544,7 @@ var LeaferUI = (function (exports) {
|
|
|
5503
5544
|
else {
|
|
5504
5545
|
const { children } = this;
|
|
5505
5546
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
5506
|
-
|
|
5507
|
-
continue;
|
|
5508
|
-
children[i].__render(canvas, options);
|
|
5547
|
+
excludeRenderBounds$1(children[i], options) || children[i].__render(canvas, options);
|
|
5509
5548
|
}
|
|
5510
5549
|
}
|
|
5511
5550
|
},
|
|
@@ -5513,16 +5552,15 @@ var LeaferUI = (function (exports) {
|
|
|
5513
5552
|
if (this.__worldOpacity) {
|
|
5514
5553
|
const { children } = this;
|
|
5515
5554
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
5516
|
-
|
|
5517
|
-
continue;
|
|
5518
|
-
children[i].__clip(canvas, options);
|
|
5555
|
+
excludeRenderBounds$1(children[i], options) || children[i].__clip(canvas, options);
|
|
5519
5556
|
}
|
|
5520
5557
|
}
|
|
5521
5558
|
}
|
|
5522
5559
|
};
|
|
5523
5560
|
|
|
5561
|
+
const tempScaleData$1 = {};
|
|
5524
5562
|
const { LEAF, create } = IncrementId;
|
|
5525
|
-
const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
|
|
5563
|
+
const { toInnerPoint, toOuterPoint, multiplyParent: multiplyParent$1 } = MatrixHelper;
|
|
5526
5564
|
const { toOuterOf } = BoundsHelper;
|
|
5527
5565
|
const { copy: copy$4, move } = PointHelper;
|
|
5528
5566
|
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
|
|
@@ -5704,7 +5742,7 @@ var LeaferUI = (function (exports) {
|
|
|
5704
5742
|
if (!this.__cameraWorld)
|
|
5705
5743
|
this.__cameraWorld = {};
|
|
5706
5744
|
const cameraWorld = this.__cameraWorld, world = this.__world;
|
|
5707
|
-
multiplyParent(world, options.matrix, cameraWorld, undefined, world);
|
|
5745
|
+
multiplyParent$1(world, options.matrix, cameraWorld, undefined, world);
|
|
5708
5746
|
toOuterOf(this.__layout.renderBounds, cameraWorld, cameraWorld);
|
|
5709
5747
|
cameraWorld.half !== world.half && (cameraWorld.half = world.half);
|
|
5710
5748
|
return cameraWorld;
|
|
@@ -5713,6 +5751,22 @@ var LeaferUI = (function (exports) {
|
|
|
5713
5751
|
return this.__world;
|
|
5714
5752
|
}
|
|
5715
5753
|
}
|
|
5754
|
+
getClampRenderScale() {
|
|
5755
|
+
let { scaleX } = this.__nowWorld || this.__world;
|
|
5756
|
+
if (scaleX < 0)
|
|
5757
|
+
scaleX = -scaleX;
|
|
5758
|
+
return scaleX > 1 ? scaleX : 1;
|
|
5759
|
+
}
|
|
5760
|
+
getRenderScaleData(abs, scaleFixed) {
|
|
5761
|
+
const { scaleX, scaleY } = ImageManager.patternLocked ? this.__world : this.__nowWorld;
|
|
5762
|
+
if (scaleFixed)
|
|
5763
|
+
tempScaleData$1.scaleX = tempScaleData$1.scaleY = 1;
|
|
5764
|
+
else if (abs)
|
|
5765
|
+
tempScaleData$1.scaleX = scaleX < 0 ? -scaleX : scaleX, tempScaleData$1.scaleY = scaleY < 0 ? -scaleY : scaleY;
|
|
5766
|
+
else
|
|
5767
|
+
tempScaleData$1.scaleX = scaleX, tempScaleData$1.scaleY = scaleY;
|
|
5768
|
+
return tempScaleData$1;
|
|
5769
|
+
}
|
|
5716
5770
|
getTransform(relative) {
|
|
5717
5771
|
return this.__layout.getTransform(relative || 'local');
|
|
5718
5772
|
}
|
|
@@ -5868,7 +5922,8 @@ var LeaferUI = (function (exports) {
|
|
|
5868
5922
|
__drawFast(_canvas, _options) { }
|
|
5869
5923
|
__draw(_canvas, _options, _originCanvas) { }
|
|
5870
5924
|
__clip(_canvas, _options) { }
|
|
5871
|
-
__renderShape(_canvas, _options
|
|
5925
|
+
__renderShape(_canvas, _options) { }
|
|
5926
|
+
__drawShape(_canvas, _options) { }
|
|
5872
5927
|
__updateWorldOpacity() { }
|
|
5873
5928
|
__updateChange() { }
|
|
5874
5929
|
__drawPath(_canvas) { }
|
|
@@ -6236,7 +6291,7 @@ var LeaferUI = (function (exports) {
|
|
|
6236
6291
|
}
|
|
6237
6292
|
}
|
|
6238
6293
|
|
|
6239
|
-
const version = "1.
|
|
6294
|
+
const version = "1.8.0";
|
|
6240
6295
|
|
|
6241
6296
|
const debug$5 = Debug.get('LeaferCanvas');
|
|
6242
6297
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
@@ -7265,6 +7320,11 @@ var LeaferUI = (function (exports) {
|
|
|
7265
7320
|
});
|
|
7266
7321
|
};
|
|
7267
7322
|
}
|
|
7323
|
+
function createAttr(defaultValue) {
|
|
7324
|
+
return (target, key) => {
|
|
7325
|
+
defineKey(target, key, createDescriptor(key, defaultValue));
|
|
7326
|
+
};
|
|
7327
|
+
}
|
|
7268
7328
|
|
|
7269
7329
|
function hasTransparent$3(color) {
|
|
7270
7330
|
if (!color || color.length === 7 || color.length === 4)
|
|
@@ -7322,26 +7382,9 @@ var LeaferUI = (function (exports) {
|
|
|
7322
7382
|
const debug$2 = Debug.get('UIData');
|
|
7323
7383
|
class UIData extends LeafData {
|
|
7324
7384
|
get scale() { const { scaleX, scaleY } = this; return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX; }
|
|
7325
|
-
get __strokeWidth() {
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
const ui = this.__leaf;
|
|
7329
|
-
let { scaleX } = ui.__nowWorld || ui.__world;
|
|
7330
|
-
if (scaleX < 0)
|
|
7331
|
-
scaleX = -scaleX;
|
|
7332
|
-
return scaleX > 1 ? strokeWidth / scaleX : strokeWidth;
|
|
7333
|
-
}
|
|
7334
|
-
else
|
|
7335
|
-
return strokeWidth;
|
|
7336
|
-
}
|
|
7337
|
-
get __hasStroke() { return this.stroke && this.strokeWidth; }
|
|
7338
|
-
get __hasHalf() { const t = this; return (t.stroke && t.strokeAlign === 'center' && t.strokeWidth % 2) || undefined; }
|
|
7339
|
-
get __hasMultiPaint() {
|
|
7340
|
-
const t = this;
|
|
7341
|
-
if ((t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect)
|
|
7342
|
-
return true;
|
|
7343
|
-
return t.fill && this.__hasStroke;
|
|
7344
|
-
}
|
|
7385
|
+
get __strokeWidth() { return this.__getRealStrokeWidth(); }
|
|
7386
|
+
get __maxStrokeWidth() { const t = this; return t.__hasMultiStrokeStyle ? Math.max(t.__hasMultiStrokeStyle, t.strokeWidth) : t.strokeWidth; }
|
|
7387
|
+
get __hasMultiPaint() { const t = this; return (t.fill && this.__useStroke) || (t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect; }
|
|
7345
7388
|
get __clipAfterFill() { const t = this; return (t.cornerRadius || t.innerShadow || t.__pathInputed); }
|
|
7346
7389
|
get __hasSurface() { const t = this; return (t.fill || t.stroke); }
|
|
7347
7390
|
get __autoWidth() { return !this._width; }
|
|
@@ -7423,6 +7466,21 @@ var LeaferUI = (function (exports) {
|
|
|
7423
7466
|
Paint.compute('stroke', this.__leaf);
|
|
7424
7467
|
this.__needComputePaint = undefined;
|
|
7425
7468
|
}
|
|
7469
|
+
__getRealStrokeWidth(childStyle) {
|
|
7470
|
+
let { strokeWidth, strokeWidthFixed } = this;
|
|
7471
|
+
if (childStyle) {
|
|
7472
|
+
if (childStyle.strokeWidth)
|
|
7473
|
+
strokeWidth = childStyle.strokeWidth;
|
|
7474
|
+
if (childStyle.strokeWidthFixed !== undefined)
|
|
7475
|
+
strokeWidthFixed = childStyle.strokeWidthFixed;
|
|
7476
|
+
}
|
|
7477
|
+
if (strokeWidthFixed) {
|
|
7478
|
+
const scale = this.__leaf.getClampRenderScale();
|
|
7479
|
+
return scale > 1 ? strokeWidth / scale : strokeWidth;
|
|
7480
|
+
}
|
|
7481
|
+
else
|
|
7482
|
+
return strokeWidth;
|
|
7483
|
+
}
|
|
7426
7484
|
__setPaint(attrName, value) {
|
|
7427
7485
|
this.__setInput(attrName, value);
|
|
7428
7486
|
const layout = this.__leaf.__layout;
|
|
@@ -7447,6 +7505,7 @@ var LeaferUI = (function (exports) {
|
|
|
7447
7505
|
}
|
|
7448
7506
|
else {
|
|
7449
7507
|
stintSet$2(this, '__isAlphaPixelStroke', undefined);
|
|
7508
|
+
stintSet$2(this, '__hasMultiStrokeStyle', undefined);
|
|
7450
7509
|
this._stroke = this.__isStrokes = undefined;
|
|
7451
7510
|
}
|
|
7452
7511
|
}
|
|
@@ -7468,8 +7527,8 @@ var LeaferUI = (function (exports) {
|
|
|
7468
7527
|
|
|
7469
7528
|
class BoxData extends GroupData {
|
|
7470
7529
|
get __boxStroke() { return !this.__pathInputed; }
|
|
7471
|
-
get __drawAfterFill() { const t = this; return
|
|
7472
|
-
get __clipAfterFill() { return
|
|
7530
|
+
get __drawAfterFill() { const t = this; return t.__single || t.__clipAfterFill; }
|
|
7531
|
+
get __clipAfterFill() { const t = this; return t.overflow === 'hide' && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill); }
|
|
7473
7532
|
}
|
|
7474
7533
|
|
|
7475
7534
|
class LeaferData extends GroupData {
|
|
@@ -7589,7 +7648,7 @@ var LeaferUI = (function (exports) {
|
|
|
7589
7648
|
const UIBounds = {
|
|
7590
7649
|
__updateStrokeSpread() {
|
|
7591
7650
|
let width = 0, boxWidth = 0;
|
|
7592
|
-
const data = this.__, { strokeAlign, strokeWidth } = data, box = this.__box;
|
|
7651
|
+
const data = this.__, { strokeAlign, __maxStrokeWidth: strokeWidth } = data, box = this.__box;
|
|
7593
7652
|
if ((data.stroke || data.hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
|
|
7594
7653
|
boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth;
|
|
7595
7654
|
if (!data.__boxStroke) {
|
|
@@ -7609,13 +7668,15 @@ var LeaferUI = (function (exports) {
|
|
|
7609
7668
|
},
|
|
7610
7669
|
__updateRenderSpread() {
|
|
7611
7670
|
let width = 0;
|
|
7612
|
-
const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
|
|
7671
|
+
const { shadow, innerShadow, blur, backgroundBlur, filter, renderSpread } = this.__;
|
|
7613
7672
|
if (shadow)
|
|
7614
7673
|
shadow.forEach(item => width = Math.max(width, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread > 0 ? item.spread : 0) + item.blur * 1.5));
|
|
7615
7674
|
if (blur)
|
|
7616
7675
|
width = Math.max(width, blur);
|
|
7617
7676
|
if (filter)
|
|
7618
7677
|
width += Filter.getSpread(filter);
|
|
7678
|
+
if (renderSpread)
|
|
7679
|
+
width += renderSpread;
|
|
7619
7680
|
let shapeWidth = width = Math.ceil(width);
|
|
7620
7681
|
if (innerShadow)
|
|
7621
7682
|
innerShadow.forEach(item => shapeWidth = Math.max(shapeWidth, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread < 0 ? -item.spread : 0) + item.blur * 1.5));
|
|
@@ -7631,15 +7692,18 @@ var LeaferUI = (function (exports) {
|
|
|
7631
7692
|
const UIRender = {
|
|
7632
7693
|
__updateChange() {
|
|
7633
7694
|
const data = this.__;
|
|
7695
|
+
if (data.__useStroke) {
|
|
7696
|
+
const useStroke = data.__useStroke = !!(data.stroke && data.strokeWidth);
|
|
7697
|
+
stintSet$1(this.__world, 'half', useStroke && data.strokeAlign === 'center' && data.strokeWidth % 2);
|
|
7698
|
+
stintSet$1(data, '__fillAfterStroke', useStroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
|
|
7699
|
+
}
|
|
7634
7700
|
if (data.__useEffect) {
|
|
7635
7701
|
const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
7636
|
-
stintSet$1(data, '__isFastShadow', shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread &&
|
|
7702
|
+
stintSet$1(data, '__isFastShadow', shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && fill && !data.__isTransparentFill && !(fill instanceof Array && fill.length > 1) && (this.useFastShadow || !stroke || (stroke && data.strokeAlign === 'inside')));
|
|
7637
7703
|
data.__useEffect = !!(shadow || otherEffect);
|
|
7638
7704
|
}
|
|
7639
|
-
stintSet$1(this.__world, 'half', data.__hasHalf);
|
|
7640
|
-
stintSet$1(data, '__fillAfterStroke', data.stroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
|
|
7641
7705
|
data.__checkSingle();
|
|
7642
|
-
stintSet$1(data, '__complex', data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
|
|
7706
|
+
stintSet$1(data, '__complex', (data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect));
|
|
7643
7707
|
},
|
|
7644
7708
|
__drawFast(canvas, options) {
|
|
7645
7709
|
drawFast(this, canvas, options);
|
|
@@ -7697,18 +7761,15 @@ var LeaferUI = (function (exports) {
|
|
|
7697
7761
|
this.__drawFast(canvas, options);
|
|
7698
7762
|
}
|
|
7699
7763
|
},
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
7704
|
-
this.
|
|
7705
|
-
|
|
7706
|
-
|
|
7707
|
-
|
|
7708
|
-
|
|
7709
|
-
if (stroke && !ignoreStroke)
|
|
7710
|
-
this.__.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
7711
|
-
}
|
|
7764
|
+
__drawShape(canvas, options) {
|
|
7765
|
+
this.__drawRenderPath(canvas);
|
|
7766
|
+
const data = this.__, { fill, stroke } = data;
|
|
7767
|
+
if (fill && !options.ignoreFill)
|
|
7768
|
+
data.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
|
|
7769
|
+
if (data.__isCanvas)
|
|
7770
|
+
this.__drawAfterFill(canvas, options);
|
|
7771
|
+
if (stroke && !options.ignoreStroke)
|
|
7772
|
+
data.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
7712
7773
|
},
|
|
7713
7774
|
__drawAfterFill(canvas, options) {
|
|
7714
7775
|
if (this.__.__clipAfterFill) {
|
|
@@ -7745,17 +7806,17 @@ var LeaferUI = (function (exports) {
|
|
|
7745
7806
|
if (__drawAfterFill)
|
|
7746
7807
|
this.__drawAfterFill(canvas, options);
|
|
7747
7808
|
if (stroke) {
|
|
7748
|
-
const { strokeAlign, __strokeWidth } = this.__;
|
|
7749
|
-
if (!
|
|
7809
|
+
const { strokeAlign, __strokeWidth: strokeWidth } = this.__;
|
|
7810
|
+
if (!strokeWidth)
|
|
7750
7811
|
return;
|
|
7751
|
-
canvas.setStroke(stroke,
|
|
7752
|
-
const half =
|
|
7812
|
+
canvas.setStroke(stroke, strokeWidth, this.__);
|
|
7813
|
+
const half = strokeWidth / 2;
|
|
7753
7814
|
switch (strokeAlign) {
|
|
7754
7815
|
case 'center':
|
|
7755
7816
|
canvas.strokeRect(0, 0, width, height);
|
|
7756
7817
|
break;
|
|
7757
7818
|
case 'inside':
|
|
7758
|
-
width -=
|
|
7819
|
+
width -= strokeWidth, height -= strokeWidth;
|
|
7759
7820
|
if (width < 0 || height < 0) {
|
|
7760
7821
|
canvas.save();
|
|
7761
7822
|
this.__clip(canvas, options);
|
|
@@ -7766,7 +7827,7 @@ var LeaferUI = (function (exports) {
|
|
|
7766
7827
|
canvas.strokeRect(x + half, y + half, width, height);
|
|
7767
7828
|
break;
|
|
7768
7829
|
case 'outside':
|
|
7769
|
-
canvas.strokeRect(x - half, y - half, width +
|
|
7830
|
+
canvas.strokeRect(x - half, y - half, width + strokeWidth, height + strokeWidth);
|
|
7770
7831
|
break;
|
|
7771
7832
|
}
|
|
7772
7833
|
}
|
|
@@ -7779,6 +7840,8 @@ var LeaferUI = (function (exports) {
|
|
|
7779
7840
|
get isFrame() { return false; }
|
|
7780
7841
|
set scale(value) { MathHelper.assignScale(this, value); }
|
|
7781
7842
|
get scale() { return this.__.scale; }
|
|
7843
|
+
get isAutoWidth() { const t = this.__; return t.__autoWidth || t.autoWidth; }
|
|
7844
|
+
get isAutoHeight() { const t = this.__; return t.__autoHeight || t.autoHeight; }
|
|
7782
7845
|
get pen() {
|
|
7783
7846
|
const { path } = this.__;
|
|
7784
7847
|
pen.set(this.path = path || []);
|
|
@@ -7833,12 +7896,14 @@ var LeaferUI = (function (exports) {
|
|
|
7833
7896
|
}
|
|
7834
7897
|
}
|
|
7835
7898
|
__updateRenderPath() {
|
|
7836
|
-
|
|
7837
|
-
|
|
7899
|
+
const data = this.__;
|
|
7900
|
+
if (data.path) {
|
|
7838
7901
|
data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
7839
7902
|
if (data.__useArrow)
|
|
7840
7903
|
PathArrow.addArrows(this, !data.cornerRadius);
|
|
7841
7904
|
}
|
|
7905
|
+
else
|
|
7906
|
+
data.__pathForRender && (data.__pathForRender = undefined);
|
|
7842
7907
|
}
|
|
7843
7908
|
__drawRenderPath(canvas) {
|
|
7844
7909
|
canvas.beginPath();
|
|
@@ -7991,6 +8056,9 @@ var LeaferUI = (function (exports) {
|
|
|
7991
8056
|
__decorate([
|
|
7992
8057
|
naturalBoundsType(1)
|
|
7993
8058
|
], exports.UI.prototype, "pixelRatio", void 0);
|
|
8059
|
+
__decorate([
|
|
8060
|
+
affectRenderBoundsType(0)
|
|
8061
|
+
], exports.UI.prototype, "renderSpread", void 0);
|
|
7994
8062
|
__decorate([
|
|
7995
8063
|
pathInputType()
|
|
7996
8064
|
], exports.UI.prototype, "path", void 0);
|
|
@@ -8049,13 +8117,13 @@ var LeaferUI = (function (exports) {
|
|
|
8049
8117
|
surfaceType()
|
|
8050
8118
|
], exports.UI.prototype, "fill", void 0);
|
|
8051
8119
|
__decorate([
|
|
8052
|
-
strokeType()
|
|
8120
|
+
strokeType(undefined, true)
|
|
8053
8121
|
], exports.UI.prototype, "stroke", void 0);
|
|
8054
8122
|
__decorate([
|
|
8055
8123
|
strokeType('inside')
|
|
8056
8124
|
], exports.UI.prototype, "strokeAlign", void 0);
|
|
8057
8125
|
__decorate([
|
|
8058
|
-
strokeType(1)
|
|
8126
|
+
strokeType(1, true)
|
|
8059
8127
|
], exports.UI.prototype, "strokeWidth", void 0);
|
|
8060
8128
|
__decorate([
|
|
8061
8129
|
strokeType(false)
|
|
@@ -8147,7 +8215,8 @@ var LeaferUI = (function (exports) {
|
|
|
8147
8215
|
}
|
|
8148
8216
|
toJSON(options) {
|
|
8149
8217
|
const data = super.toJSON(options);
|
|
8150
|
-
|
|
8218
|
+
if (!this.childlessJSON)
|
|
8219
|
+
data.children = this.children.map(child => child.toJSON(options));
|
|
8151
8220
|
return data;
|
|
8152
8221
|
}
|
|
8153
8222
|
pick(_hitPoint, _options) { return undefined; }
|
|
@@ -8482,7 +8551,7 @@ var LeaferUI = (function (exports) {
|
|
|
8482
8551
|
list.push(item);
|
|
8483
8552
|
this.requestRender();
|
|
8484
8553
|
}
|
|
8485
|
-
zoom(_zoomType,
|
|
8554
|
+
zoom(_zoomType, _optionsOrPadding, _scroll, _transition) {
|
|
8486
8555
|
return Plugin.need('view');
|
|
8487
8556
|
}
|
|
8488
8557
|
getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
|
|
@@ -8527,7 +8596,7 @@ var LeaferUI = (function (exports) {
|
|
|
8527
8596
|
Leafer_1.list.remove(this);
|
|
8528
8597
|
try {
|
|
8529
8598
|
this.stop();
|
|
8530
|
-
this.
|
|
8599
|
+
this.emitLeafer(LeaferEvent.END);
|
|
8531
8600
|
this.__removeListenEvents();
|
|
8532
8601
|
this.__controllers.forEach(item => !(this.parent && item === this.interaction) && item.destroy());
|
|
8533
8602
|
this.__controllers.length = 0;
|
|
@@ -8594,8 +8663,8 @@ var LeaferUI = (function (exports) {
|
|
|
8594
8663
|
__updateRenderSpread() { return this.__updateRectRenderSpread() || -1; }
|
|
8595
8664
|
__updateRectBoxBounds() { }
|
|
8596
8665
|
__updateBoxBounds(_secondLayout) {
|
|
8597
|
-
const data = this.__;
|
|
8598
8666
|
if (this.children.length && !this.pathInputed) {
|
|
8667
|
+
const data = this.__;
|
|
8599
8668
|
if (data.__autoSide) {
|
|
8600
8669
|
if (data.__hasSurface)
|
|
8601
8670
|
this.__extraUpdate();
|
|
@@ -8622,20 +8691,26 @@ var LeaferUI = (function (exports) {
|
|
|
8622
8691
|
__updateStrokeBounds() { }
|
|
8623
8692
|
__updateRenderBounds() {
|
|
8624
8693
|
let isOverflow;
|
|
8625
|
-
const { renderBounds } = this.__layout;
|
|
8626
8694
|
if (this.children.length) {
|
|
8695
|
+
const data = this.__, { renderBounds, boxBounds } = this.__layout;
|
|
8627
8696
|
super.__updateRenderBounds();
|
|
8628
8697
|
copy$3(childrenRenderBounds, renderBounds);
|
|
8629
8698
|
this.__updateRectRenderBounds();
|
|
8630
|
-
|
|
8631
|
-
|
|
8699
|
+
if (data.scrollY || data.scrollX) {
|
|
8700
|
+
childrenRenderBounds.x += data.scrollX;
|
|
8701
|
+
childrenRenderBounds.y += data.scrollY;
|
|
8702
|
+
}
|
|
8703
|
+
isOverflow = !includes$1(boxBounds, childrenRenderBounds);
|
|
8704
|
+
if (isOverflow && data.overflow !== 'hide')
|
|
8632
8705
|
add(renderBounds, childrenRenderBounds);
|
|
8633
8706
|
}
|
|
8634
8707
|
else
|
|
8635
8708
|
this.__updateRectRenderBounds();
|
|
8636
8709
|
DataHelper.stintSet(this, 'isOverflow', isOverflow);
|
|
8710
|
+
this.__updateScrollBar();
|
|
8637
8711
|
}
|
|
8638
8712
|
__updateRectRenderBounds() { }
|
|
8713
|
+
__updateScrollBar() { }
|
|
8639
8714
|
__updateRectChange() { }
|
|
8640
8715
|
__updateChange() {
|
|
8641
8716
|
super.__updateChange();
|
|
@@ -8652,10 +8727,12 @@ var LeaferUI = (function (exports) {
|
|
|
8652
8727
|
if (this.children.length)
|
|
8653
8728
|
this.__renderGroup(canvas, options);
|
|
8654
8729
|
}
|
|
8730
|
+
if (this.scrollBar)
|
|
8731
|
+
this.scrollBar.__render(canvas, options);
|
|
8655
8732
|
}
|
|
8656
8733
|
__drawContent(canvas, options) {
|
|
8657
8734
|
this.__renderGroup(canvas, options);
|
|
8658
|
-
if (this.__.
|
|
8735
|
+
if (this.__.__useStroke || this.__.__useEffect) {
|
|
8659
8736
|
canvas.setWorld(this.__nowWorld);
|
|
8660
8737
|
this.__drawRenderPath(canvas);
|
|
8661
8738
|
}
|
|
@@ -8875,8 +8952,8 @@ var LeaferUI = (function (exports) {
|
|
|
8875
8952
|
for (let i = 1; i < sides; i++) {
|
|
8876
8953
|
lineTo$1(path, rx + rx * sin$1((i * 2 * PI$1) / sides), ry - ry * cos$1((i * 2 * PI$1) / sides));
|
|
8877
8954
|
}
|
|
8955
|
+
closePath$1(path);
|
|
8878
8956
|
}
|
|
8879
|
-
closePath$1(path);
|
|
8880
8957
|
}
|
|
8881
8958
|
__updateRenderPath() { }
|
|
8882
8959
|
__updateBoxBounds() { }
|
|
@@ -9114,6 +9191,11 @@ var LeaferUI = (function (exports) {
|
|
|
9114
9191
|
return;
|
|
9115
9192
|
super.__draw(canvas, options, originCanvas);
|
|
9116
9193
|
}
|
|
9194
|
+
__drawShape(canvas, options) {
|
|
9195
|
+
if (options.shape)
|
|
9196
|
+
this.__box && this.__box.__drawShape(canvas, options);
|
|
9197
|
+
super.__drawShape(canvas, options);
|
|
9198
|
+
}
|
|
9117
9199
|
destroy() {
|
|
9118
9200
|
if (this.boxStyle)
|
|
9119
9201
|
this.boxStyle = null;
|
|
@@ -9935,6 +10017,7 @@ var LeaferUI = (function (exports) {
|
|
|
9935
10017
|
delta: { x: 80 / 4, y: 8.0 },
|
|
9936
10018
|
},
|
|
9937
10019
|
pointer: {
|
|
10020
|
+
type: 'pointer',
|
|
9938
10021
|
snap: true,
|
|
9939
10022
|
hitRadius: 5,
|
|
9940
10023
|
tapTime: 120,
|
|
@@ -10452,18 +10535,20 @@ var LeaferUI = (function (exports) {
|
|
|
10452
10535
|
}
|
|
10453
10536
|
return this.__hit(inner);
|
|
10454
10537
|
};
|
|
10455
|
-
leaf.__hitFill = function (inner) {
|
|
10456
|
-
leaf.__hitStroke = function (inner, strokeWidth) {
|
|
10457
|
-
leaf.__hitPixel = function (inner) {
|
|
10458
|
-
leaf.__drawHitPath = function (canvas) {
|
|
10459
|
-
this.__drawRenderPath(canvas); };
|
|
10538
|
+
leaf.__hitFill = function (inner) { const h = this.__hitCanvas; return h && h.hitFill(inner, this.__.windingRule); };
|
|
10539
|
+
leaf.__hitStroke = function (inner, strokeWidth) { const h = this.__hitCanvas; return h && h.hitStroke(inner, strokeWidth); };
|
|
10540
|
+
leaf.__hitPixel = function (inner) { const h = this.__hitCanvas; return h && h.hitPixel(inner, this.__layout.renderBounds, h.hitScale); };
|
|
10541
|
+
leaf.__drawHitPath = function (canvas) { canvas && this.__drawRenderPath(canvas); };
|
|
10460
10542
|
|
|
10461
10543
|
const matrix = new Matrix();
|
|
10462
10544
|
const ui$1 = exports.UI.prototype;
|
|
10463
10545
|
ui$1.__updateHitCanvas = function () {
|
|
10464
10546
|
if (this.__box)
|
|
10465
10547
|
this.__box.__updateHitCanvas();
|
|
10466
|
-
const
|
|
10548
|
+
const leafer = this.leafer || (this.parent && this.parent.leafer);
|
|
10549
|
+
if (!leafer)
|
|
10550
|
+
return;
|
|
10551
|
+
const data = this.__, { hitCanvasManager } = leafer;
|
|
10467
10552
|
const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === 'pixel';
|
|
10468
10553
|
const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === 'pixel';
|
|
10469
10554
|
const isHitPixel = isHitPixelFill || isHitPixelStroke;
|
|
@@ -10478,7 +10563,7 @@ var LeaferUI = (function (exports) {
|
|
|
10478
10563
|
h.resize({ width, height, pixelRatio: 1 });
|
|
10479
10564
|
h.clear();
|
|
10480
10565
|
ImageManager.patternLocked = true;
|
|
10481
|
-
this.__renderShape(h, { matrix: matrix.setWith(this.__world).scaleWith(1 / scale).invertWith().translate(-x, -y)
|
|
10566
|
+
this.__renderShape(h, { matrix: matrix.setWith(this.__world).scaleWith(1 / scale).invertWith().translate(-x, -y), ignoreFill: !isHitPixelFill, ignoreStroke: !isHitPixelStroke });
|
|
10482
10567
|
ImageManager.patternLocked = false;
|
|
10483
10568
|
h.resetTransform();
|
|
10484
10569
|
data.__isHitPixel = true;
|
|
@@ -10499,7 +10584,7 @@ var LeaferUI = (function (exports) {
|
|
|
10499
10584
|
const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.__isAlphaPixelFill || data.__isCanvas)))) || hitFill === 'all';
|
|
10500
10585
|
if (needHitFillPath && this.__hitFill(inner))
|
|
10501
10586
|
return true;
|
|
10502
|
-
const { hitStroke,
|
|
10587
|
+
const { hitStroke, __maxStrokeWidth: strokeWidth } = data;
|
|
10503
10588
|
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.__isAlphaPixelStroke))) || hitStroke === 'all';
|
|
10504
10589
|
if (!needHitFillPath && !needHitStrokePath)
|
|
10505
10590
|
return false;
|
|
@@ -10508,16 +10593,16 @@ var LeaferUI = (function (exports) {
|
|
|
10508
10593
|
if (needHitStrokePath) {
|
|
10509
10594
|
switch (data.strokeAlign) {
|
|
10510
10595
|
case 'inside':
|
|
10511
|
-
hitWidth +=
|
|
10596
|
+
hitWidth += strokeWidth * 2;
|
|
10512
10597
|
if (!needHitFillPath && this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
|
|
10513
10598
|
return true;
|
|
10514
10599
|
hitWidth = radiusWidth;
|
|
10515
10600
|
break;
|
|
10516
10601
|
case 'center':
|
|
10517
|
-
hitWidth +=
|
|
10602
|
+
hitWidth += strokeWidth;
|
|
10518
10603
|
break;
|
|
10519
10604
|
case 'outside':
|
|
10520
|
-
hitWidth +=
|
|
10605
|
+
hitWidth += strokeWidth * 2;
|
|
10521
10606
|
if (!needHitFillPath) {
|
|
10522
10607
|
if (!this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
|
|
10523
10608
|
return true;
|
|
@@ -10615,6 +10700,9 @@ var LeaferUI = (function (exports) {
|
|
|
10615
10700
|
|
|
10616
10701
|
const { pathCanDrag } = InteractionHelper;
|
|
10617
10702
|
class Interaction extends InteractionBase {
|
|
10703
|
+
get notPointer() { const { p } = this; return p.type !== 'pointer' || p.touch || this.useMultiTouch; }
|
|
10704
|
+
get notTouch() { const { p } = this; return p.type === 'mouse' || this.usePointer; }
|
|
10705
|
+
get notMouse() { return this.usePointer || this.useTouch; }
|
|
10618
10706
|
__listenEvents() {
|
|
10619
10707
|
super.__listenEvents();
|
|
10620
10708
|
const view = this.view = this.canvas.view;
|
|
@@ -10700,13 +10788,13 @@ var LeaferUI = (function (exports) {
|
|
|
10700
10788
|
}
|
|
10701
10789
|
onPointerDown(e) {
|
|
10702
10790
|
this.preventDefaultPointer(e);
|
|
10703
|
-
if (this.
|
|
10791
|
+
if (this.notPointer)
|
|
10704
10792
|
return;
|
|
10705
10793
|
this.usePointer || (this.usePointer = true);
|
|
10706
10794
|
this.pointerDown(PointerEventHelper.convert(e, this.getLocal(e)));
|
|
10707
10795
|
}
|
|
10708
10796
|
onPointerMove(e, isLeave) {
|
|
10709
|
-
if (this.
|
|
10797
|
+
if (this.notPointer || this.preventWindowPointer(e))
|
|
10710
10798
|
return;
|
|
10711
10799
|
this.usePointer || (this.usePointer = true);
|
|
10712
10800
|
const data = PointerEventHelper.convert(e, this.getLocal(e, true));
|
|
@@ -10718,7 +10806,7 @@ var LeaferUI = (function (exports) {
|
|
|
10718
10806
|
onPointerUp(e) {
|
|
10719
10807
|
if (this.downData)
|
|
10720
10808
|
this.preventDefaultPointer(e);
|
|
10721
|
-
if (this.
|
|
10809
|
+
if (this.notPointer || this.preventWindowPointer(e))
|
|
10722
10810
|
return;
|
|
10723
10811
|
this.pointerUp(PointerEventHelper.convert(e, this.getLocal(e)));
|
|
10724
10812
|
}
|
|
@@ -10729,24 +10817,24 @@ var LeaferUI = (function (exports) {
|
|
|
10729
10817
|
}
|
|
10730
10818
|
onMouseDown(e) {
|
|
10731
10819
|
this.preventDefaultPointer(e);
|
|
10732
|
-
if (this.
|
|
10820
|
+
if (this.notMouse)
|
|
10733
10821
|
return;
|
|
10734
10822
|
this.pointerDown(PointerEventHelper.convertMouse(e, this.getLocal(e)));
|
|
10735
10823
|
}
|
|
10736
10824
|
onMouseMove(e) {
|
|
10737
|
-
if (this.
|
|
10825
|
+
if (this.notMouse || this.preventWindowPointer(e))
|
|
10738
10826
|
return;
|
|
10739
10827
|
this.pointerMove(PointerEventHelper.convertMouse(e, this.getLocal(e, true)));
|
|
10740
10828
|
}
|
|
10741
10829
|
onMouseUp(e) {
|
|
10742
10830
|
if (this.downData)
|
|
10743
10831
|
this.preventDefaultPointer(e);
|
|
10744
|
-
if (this.
|
|
10832
|
+
if (this.notMouse || this.preventWindowPointer(e))
|
|
10745
10833
|
return;
|
|
10746
10834
|
this.pointerUp(PointerEventHelper.convertMouse(e, this.getLocal(e)));
|
|
10747
10835
|
}
|
|
10748
10836
|
onMouseCancel() {
|
|
10749
|
-
if (this.
|
|
10837
|
+
if (this.notMouse)
|
|
10750
10838
|
return;
|
|
10751
10839
|
this.pointerCancel();
|
|
10752
10840
|
}
|
|
@@ -10757,7 +10845,7 @@ var LeaferUI = (function (exports) {
|
|
|
10757
10845
|
if (preventDefault === true || (preventDefault === 'auto' && pathCanDrag(this.findPath(local))))
|
|
10758
10846
|
e.preventDefault();
|
|
10759
10847
|
this.multiTouchStart(e);
|
|
10760
|
-
if (this.
|
|
10848
|
+
if (this.notTouch)
|
|
10761
10849
|
return;
|
|
10762
10850
|
if (this.touchTimer) {
|
|
10763
10851
|
window.clearTimeout(this.touchTimer);
|
|
@@ -10768,14 +10856,14 @@ var LeaferUI = (function (exports) {
|
|
|
10768
10856
|
}
|
|
10769
10857
|
onTouchMove(e) {
|
|
10770
10858
|
this.multiTouchMove(e);
|
|
10771
|
-
if (this.
|
|
10859
|
+
if (this.notTouch || this.preventWindowPointer(e))
|
|
10772
10860
|
return;
|
|
10773
10861
|
const touch = PointerEventHelper.getTouch(e);
|
|
10774
10862
|
this.pointerMove(PointerEventHelper.convertTouch(e, this.getLocal(touch)));
|
|
10775
10863
|
}
|
|
10776
10864
|
onTouchEnd(e) {
|
|
10777
10865
|
this.multiTouchEnd();
|
|
10778
|
-
if (this.
|
|
10866
|
+
if (this.notTouch || this.preventWindowPointer(e))
|
|
10779
10867
|
return;
|
|
10780
10868
|
if (this.touchTimer)
|
|
10781
10869
|
clearTimeout(this.touchTimer);
|
|
@@ -10786,7 +10874,7 @@ var LeaferUI = (function (exports) {
|
|
|
10786
10874
|
this.pointerUp(PointerEventHelper.convertTouch(e, this.getLocal(touch)));
|
|
10787
10875
|
}
|
|
10788
10876
|
onTouchCancel() {
|
|
10789
|
-
if (this.
|
|
10877
|
+
if (this.notTouch)
|
|
10790
10878
|
return;
|
|
10791
10879
|
this.pointerCancel();
|
|
10792
10880
|
}
|
|
@@ -10926,9 +11014,14 @@ var LeaferUI = (function (exports) {
|
|
|
10926
11014
|
}
|
|
10927
11015
|
}
|
|
10928
11016
|
canvas.fillStyle = item.style;
|
|
10929
|
-
if (item.transform) {
|
|
11017
|
+
if (item.transform || item.scaleFixed) {
|
|
10930
11018
|
canvas.save();
|
|
10931
|
-
|
|
11019
|
+
if (item.transform)
|
|
11020
|
+
canvas.transform(item.transform);
|
|
11021
|
+
if (item.scaleFixed) {
|
|
11022
|
+
const { scaleX, scaleY } = ui.getRenderScaleData(true);
|
|
11023
|
+
canvas.scale(1 / scaleX, 1 / scaleY);
|
|
11024
|
+
}
|
|
10932
11025
|
if (item.blendMode)
|
|
10933
11026
|
canvas.blendMode = item.blendMode;
|
|
10934
11027
|
fillPathOrText(ui, canvas);
|
|
@@ -10964,8 +11057,13 @@ var LeaferUI = (function (exports) {
|
|
|
10964
11057
|
}
|
|
10965
11058
|
function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
|
|
10966
11059
|
const data = ui.__;
|
|
10967
|
-
|
|
10968
|
-
|
|
11060
|
+
if (typeof stroke === 'object') {
|
|
11061
|
+
drawStrokesStyle(stroke, strokeWidthScale, true, ui, canvas);
|
|
11062
|
+
}
|
|
11063
|
+
else {
|
|
11064
|
+
canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
11065
|
+
drawTextStroke(ui, canvas);
|
|
11066
|
+
}
|
|
10969
11067
|
}
|
|
10970
11068
|
function drawAlign(stroke, align, ui, canvas) {
|
|
10971
11069
|
const out = canvas.getSameCanvas(true, true);
|
|
@@ -10974,15 +11072,9 @@ var LeaferUI = (function (exports) {
|
|
|
10974
11072
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
10975
11073
|
fillText(ui, out);
|
|
10976
11074
|
out.blendMode = 'normal';
|
|
10977
|
-
|
|
11075
|
+
LeafHelper.copyCanvasByWorld(ui, canvas, out);
|
|
10978
11076
|
out.recycle(ui.__nowWorld);
|
|
10979
11077
|
}
|
|
10980
|
-
function copyWorld(canvas, out, ui) {
|
|
10981
|
-
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
10982
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10983
|
-
else
|
|
10984
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10985
|
-
}
|
|
10986
11078
|
function drawTextStroke(ui, canvas) {
|
|
10987
11079
|
let row, data = ui.__.__textDrawData;
|
|
10988
11080
|
const { rows, decorationY } = data;
|
|
@@ -10998,14 +11090,21 @@ var LeaferUI = (function (exports) {
|
|
|
10998
11090
|
rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
10999
11091
|
}
|
|
11000
11092
|
}
|
|
11001
|
-
function drawStrokesStyle(strokes, isText, ui, canvas) {
|
|
11093
|
+
function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas) {
|
|
11002
11094
|
let item;
|
|
11095
|
+
const data = ui.__, { __hasMultiStrokeStyle } = data;
|
|
11096
|
+
__hasMultiStrokeStyle || canvas.setStroke(undefined, data.__strokeWidth * strokeWidthScale, data);
|
|
11003
11097
|
for (let i = 0, len = strokes.length; i < len; i++) {
|
|
11004
11098
|
item = strokes[i];
|
|
11005
11099
|
if (item.image && PaintImage.checkImage(ui, canvas, item, false))
|
|
11006
11100
|
continue;
|
|
11007
11101
|
if (item.style) {
|
|
11008
|
-
|
|
11102
|
+
if (__hasMultiStrokeStyle) {
|
|
11103
|
+
const { strokeStyle } = item;
|
|
11104
|
+
strokeStyle ? canvas.setStroke(item.style, data.__getRealStrokeWidth(strokeStyle) * strokeWidthScale, data, strokeStyle) : canvas.setStroke(item.style, data.__strokeWidth * strokeWidthScale, data);
|
|
11105
|
+
}
|
|
11106
|
+
else
|
|
11107
|
+
canvas.strokeStyle = item.style;
|
|
11009
11108
|
if (item.blendMode) {
|
|
11010
11109
|
canvas.saveBlendMode(item.blendMode);
|
|
11011
11110
|
isText ? drawTextStroke(ui, canvas) : canvas.stroke();
|
|
@@ -11044,8 +11143,13 @@ var LeaferUI = (function (exports) {
|
|
|
11044
11143
|
}
|
|
11045
11144
|
function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
11046
11145
|
const data = ui.__;
|
|
11047
|
-
|
|
11048
|
-
|
|
11146
|
+
if (typeof stroke === 'object') {
|
|
11147
|
+
drawStrokesStyle(stroke, strokeWidthScale, false, ui, canvas);
|
|
11148
|
+
}
|
|
11149
|
+
else {
|
|
11150
|
+
canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
11151
|
+
canvas.stroke();
|
|
11152
|
+
}
|
|
11049
11153
|
if (data.__useArrow)
|
|
11050
11154
|
Paint.strokeArrow(stroke, ui, canvas);
|
|
11051
11155
|
}
|
|
@@ -11067,7 +11171,7 @@ var LeaferUI = (function (exports) {
|
|
|
11067
11171
|
drawCenter(stroke, 2, ui, out);
|
|
11068
11172
|
out.clipUI(data);
|
|
11069
11173
|
out.clearWorld(renderBounds);
|
|
11070
|
-
|
|
11174
|
+
LeafHelper.copyCanvasByWorld(ui, canvas, out);
|
|
11071
11175
|
out.recycle(ui.__nowWorld);
|
|
11072
11176
|
}
|
|
11073
11177
|
}
|
|
@@ -11122,8 +11226,16 @@ var LeaferUI = (function (exports) {
|
|
|
11122
11226
|
if (!(paints instanceof Array))
|
|
11123
11227
|
paints = [paints];
|
|
11124
11228
|
recycleMap = PaintImage.recycleImage(attrName, data);
|
|
11229
|
+
let maxChildStrokeWidth;
|
|
11125
11230
|
for (let i = 0, len = paints.length, item; i < len; i++) {
|
|
11126
|
-
(item = getLeafPaint(attrName, paints[i], ui))
|
|
11231
|
+
if (item = getLeafPaint(attrName, paints[i], ui)) {
|
|
11232
|
+
leafPaints.push(item);
|
|
11233
|
+
if (item.strokeStyle) {
|
|
11234
|
+
maxChildStrokeWidth || (maxChildStrokeWidth = 1);
|
|
11235
|
+
if (item.strokeStyle.strokeWidth)
|
|
11236
|
+
maxChildStrokeWidth = Math.max(maxChildStrokeWidth, item.strokeStyle.strokeWidth);
|
|
11237
|
+
}
|
|
11238
|
+
}
|
|
11127
11239
|
}
|
|
11128
11240
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
11129
11241
|
if (leafPaints.length) {
|
|
@@ -11140,6 +11252,7 @@ var LeaferUI = (function (exports) {
|
|
|
11140
11252
|
else {
|
|
11141
11253
|
stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
|
|
11142
11254
|
stintSet(data, '__isTransparentStroke', isTransparent);
|
|
11255
|
+
stintSet(data, '__hasMultiStrokeStyle', maxChildStrokeWidth);
|
|
11143
11256
|
}
|
|
11144
11257
|
}
|
|
11145
11258
|
function getLeafPaint(attrName, paint, ui) {
|
|
@@ -11171,6 +11284,11 @@ var LeaferUI = (function (exports) {
|
|
|
11171
11284
|
if (data) {
|
|
11172
11285
|
if (typeof data.style === 'string' && hasTransparent$1(data.style))
|
|
11173
11286
|
data.isTransparent = true;
|
|
11287
|
+
if (paint.style) {
|
|
11288
|
+
if (paint.style.strokeWidth === 0)
|
|
11289
|
+
return undefined;
|
|
11290
|
+
data.strokeStyle = paint.style;
|
|
11291
|
+
}
|
|
11174
11292
|
if (paint.blendMode)
|
|
11175
11293
|
data.blendMode = paint.blendMode;
|
|
11176
11294
|
}
|
|
@@ -11190,8 +11308,8 @@ var LeaferUI = (function (exports) {
|
|
|
11190
11308
|
shape
|
|
11191
11309
|
};
|
|
11192
11310
|
|
|
11193
|
-
let origin = {};
|
|
11194
|
-
const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, scale: scaleHelper, rotate } = MatrixHelper;
|
|
11311
|
+
let origin = {}, tempMatrix = getMatrixData();
|
|
11312
|
+
const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent, scale: scaleHelper, rotate, skew: skewHelper } = MatrixHelper;
|
|
11195
11313
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
11196
11314
|
const transform = get$3();
|
|
11197
11315
|
translate$1(transform, box.x + x, box.y + y);
|
|
@@ -11200,13 +11318,19 @@ var LeaferUI = (function (exports) {
|
|
|
11200
11318
|
rotateOfOuter$1(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
|
|
11201
11319
|
data.transform = transform;
|
|
11202
11320
|
}
|
|
11203
|
-
function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
11321
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipSize) {
|
|
11204
11322
|
const transform = get$3();
|
|
11205
|
-
translate$1(transform, box.x + x, box.y + y);
|
|
11206
|
-
if (scaleX)
|
|
11207
|
-
scaleHelper(transform, scaleX, scaleY);
|
|
11208
11323
|
if (rotation)
|
|
11209
11324
|
rotate(transform, rotation);
|
|
11325
|
+
if (skew)
|
|
11326
|
+
skewHelper(transform, skew.x, skew.y);
|
|
11327
|
+
if (scaleX)
|
|
11328
|
+
scaleHelper(transform, scaleX, scaleY);
|
|
11329
|
+
translate$1(transform, box.x + x, box.y + y);
|
|
11330
|
+
if (clipSize) {
|
|
11331
|
+
tempMatrix.a = box.width / clipSize.width, tempMatrix.d = box.height / clipSize.height;
|
|
11332
|
+
multiplyParent(transform, tempMatrix);
|
|
11333
|
+
}
|
|
11210
11334
|
data.transform = transform;
|
|
11211
11335
|
}
|
|
11212
11336
|
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
|
|
@@ -11243,11 +11367,15 @@ var LeaferUI = (function (exports) {
|
|
|
11243
11367
|
const tempScaleData = {};
|
|
11244
11368
|
const tempImage = {};
|
|
11245
11369
|
function createData(leafPaint, image, paint, box) {
|
|
11246
|
-
const { changeful, sync } = paint;
|
|
11370
|
+
const { changeful, sync, editing, scaleFixed } = paint;
|
|
11247
11371
|
if (changeful)
|
|
11248
11372
|
leafPaint.changeful = changeful;
|
|
11249
11373
|
if (sync)
|
|
11250
11374
|
leafPaint.sync = sync;
|
|
11375
|
+
if (editing)
|
|
11376
|
+
leafPaint.editing = editing;
|
|
11377
|
+
if (scaleFixed)
|
|
11378
|
+
leafPaint.scaleFixed = scaleFixed;
|
|
11251
11379
|
leafPaint.data = getPatternData(paint, box, image);
|
|
11252
11380
|
}
|
|
11253
11381
|
function getPatternData(paint, box, image) {
|
|
@@ -11256,7 +11384,7 @@ var LeaferUI = (function (exports) {
|
|
|
11256
11384
|
if (paint.mode === 'strench')
|
|
11257
11385
|
paint.mode = 'stretch';
|
|
11258
11386
|
let { width, height } = image;
|
|
11259
|
-
const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
|
|
11387
|
+
const { opacity, mode, align, offset, scale, size, rotation, skew, clipSize, repeat, filters } = paint;
|
|
11260
11388
|
const sameBox = box.width === width && box.height === height;
|
|
11261
11389
|
const data = { mode };
|
|
11262
11390
|
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
@@ -11290,8 +11418,8 @@ var LeaferUI = (function (exports) {
|
|
|
11290
11418
|
break;
|
|
11291
11419
|
case 'normal':
|
|
11292
11420
|
case 'clip':
|
|
11293
|
-
if (tempImage.x || tempImage.y || scaleX || rotation)
|
|
11294
|
-
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
11421
|
+
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
|
|
11422
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, paint.clipSize);
|
|
11295
11423
|
break;
|
|
11296
11424
|
case 'repeat':
|
|
11297
11425
|
if (!sameBox || scaleX || rotation)
|
|
@@ -11368,11 +11496,11 @@ var LeaferUI = (function (exports) {
|
|
|
11368
11496
|
}
|
|
11369
11497
|
onLoadSuccess(ui, event);
|
|
11370
11498
|
}
|
|
11371
|
-
leafPaint.loadId =
|
|
11499
|
+
leafPaint.loadId = undefined;
|
|
11372
11500
|
}, (error) => {
|
|
11373
11501
|
ignoreRender(ui, false);
|
|
11374
11502
|
onLoadError(ui, event, error);
|
|
11375
|
-
leafPaint.loadId =
|
|
11503
|
+
leafPaint.loadId = undefined;
|
|
11376
11504
|
});
|
|
11377
11505
|
if (ui.placeholderColor) {
|
|
11378
11506
|
if (!ui.placeholderDelay)
|
|
@@ -11428,16 +11556,16 @@ var LeaferUI = (function (exports) {
|
|
|
11428
11556
|
}
|
|
11429
11557
|
|
|
11430
11558
|
const { get: get$1, scale, copy: copy$1 } = MatrixHelper;
|
|
11431
|
-
const { ceil, abs
|
|
11559
|
+
const { ceil, abs } = Math;
|
|
11432
11560
|
function createPattern(ui, paint, pixelRatio) {
|
|
11433
|
-
let { scaleX, scaleY } =
|
|
11561
|
+
let { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
11434
11562
|
const id = scaleX + '-' + scaleY + '-' + pixelRatio;
|
|
11435
11563
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
11436
|
-
scaleX = abs$1(scaleX);
|
|
11437
|
-
scaleY = abs$1(scaleY);
|
|
11438
11564
|
const { image, data } = paint;
|
|
11439
11565
|
let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
|
|
11440
11566
|
if (sx) {
|
|
11567
|
+
sx = abs(sx);
|
|
11568
|
+
sy = abs(sy);
|
|
11441
11569
|
imageMatrix = get$1();
|
|
11442
11570
|
copy$1(imageMatrix, transform);
|
|
11443
11571
|
scale(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -11490,9 +11618,8 @@ var LeaferUI = (function (exports) {
|
|
|
11490
11618
|
}
|
|
11491
11619
|
}
|
|
11492
11620
|
|
|
11493
|
-
const { abs } = Math;
|
|
11494
11621
|
function checkImage(ui, canvas, paint, allowDraw) {
|
|
11495
|
-
const { scaleX, scaleY } =
|
|
11622
|
+
const { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
11496
11623
|
const { pixelRatio } = canvas, { data } = paint;
|
|
11497
11624
|
if (!data || (paint.patternId === scaleX + '-' + scaleY + '-' + pixelRatio && !Export.running)) {
|
|
11498
11625
|
return false;
|
|
@@ -11505,8 +11632,8 @@ var LeaferUI = (function (exports) {
|
|
|
11505
11632
|
else {
|
|
11506
11633
|
if (!(paint.changeful || ResizeEvent.isResizing(ui) || Export.running)) {
|
|
11507
11634
|
let { width, height } = data;
|
|
11508
|
-
width *=
|
|
11509
|
-
height *=
|
|
11635
|
+
width *= scaleX * pixelRatio;
|
|
11636
|
+
height *= scaleY * pixelRatio;
|
|
11510
11637
|
if (data.scaleX) {
|
|
11511
11638
|
width *= data.scaleX;
|
|
11512
11639
|
height *= data.scaleY;
|
|
@@ -11516,6 +11643,10 @@ var LeaferUI = (function (exports) {
|
|
|
11516
11643
|
}
|
|
11517
11644
|
}
|
|
11518
11645
|
if (allowDraw) {
|
|
11646
|
+
if (ui.__.__isFastShadow) {
|
|
11647
|
+
canvas.fillStyle = paint.style || '#000';
|
|
11648
|
+
canvas.fill();
|
|
11649
|
+
}
|
|
11519
11650
|
drawImage(ui, canvas, paint, data);
|
|
11520
11651
|
return true;
|
|
11521
11652
|
}
|
|
@@ -11704,10 +11835,7 @@ var LeaferUI = (function (exports) {
|
|
|
11704
11835
|
}
|
|
11705
11836
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
|
|
11706
11837
|
}
|
|
11707
|
-
|
|
11708
|
-
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
11709
|
-
else
|
|
11710
|
-
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
11838
|
+
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
11711
11839
|
if (end && index < end)
|
|
11712
11840
|
other.clearWorld(copyBounds, true);
|
|
11713
11841
|
});
|
|
@@ -11766,10 +11894,7 @@ var LeaferUI = (function (exports) {
|
|
|
11766
11894
|
copyBounds = bounds;
|
|
11767
11895
|
}
|
|
11768
11896
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
|
|
11769
|
-
|
|
11770
|
-
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
11771
|
-
else
|
|
11772
|
-
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
11897
|
+
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
11773
11898
|
if (end && index < end)
|
|
11774
11899
|
other.clearWorld(copyBounds, true);
|
|
11775
11900
|
});
|
|
@@ -11825,12 +11950,11 @@ var LeaferUI = (function (exports) {
|
|
|
11825
11950
|
contentCanvas = getCanvas(canvas);
|
|
11826
11951
|
child.__render(maskCanvas, options);
|
|
11827
11952
|
}
|
|
11828
|
-
if (
|
|
11829
|
-
|
|
11830
|
-
}
|
|
11831
|
-
if (excludeRenderBounds(child, options))
|
|
11953
|
+
if (mask === 'clipping' || mask === 'clipping-path')
|
|
11954
|
+
excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
11832
11955
|
continue;
|
|
11833
|
-
|
|
11956
|
+
}
|
|
11957
|
+
excludeRenderBounds(child, options) || child.__render(contentCanvas || canvas, options);
|
|
11834
11958
|
}
|
|
11835
11959
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
|
|
11836
11960
|
};
|
|
@@ -12543,6 +12667,8 @@ var LeaferUI = (function (exports) {
|
|
|
12543
12667
|
exports.boundsType = boundsType;
|
|
12544
12668
|
exports.canvasPatch = canvasPatch;
|
|
12545
12669
|
exports.canvasSizeAttrs = canvasSizeAttrs;
|
|
12670
|
+
exports.createAttr = createAttr;
|
|
12671
|
+
exports.createDescriptor = createDescriptor;
|
|
12546
12672
|
exports.cursorType = cursorType;
|
|
12547
12673
|
exports.dataProcessor = dataProcessor;
|
|
12548
12674
|
exports.dataType = dataType;
|
|
@@ -12581,7 +12707,7 @@ var LeaferUI = (function (exports) {
|
|
|
12581
12707
|
exports.strokeType = strokeType;
|
|
12582
12708
|
exports.surfaceType = surfaceType;
|
|
12583
12709
|
exports.tempBounds = tempBounds$1;
|
|
12584
|
-
exports.tempMatrix = tempMatrix;
|
|
12710
|
+
exports.tempMatrix = tempMatrix$1;
|
|
12585
12711
|
exports.tempPoint = tempPoint$2;
|
|
12586
12712
|
exports.useCanvas = useCanvas;
|
|
12587
12713
|
exports.useModule = useModule;
|