@leafer-ui/worker 1.7.0 → 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/dist/worker.cjs +77 -47
- package/dist/worker.esm.js +78 -48
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +242 -144
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +240 -144
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +11 -11
package/dist/worker.module.js
CHANGED
|
@@ -436,7 +436,7 @@ const MatrixHelper = {
|
|
|
436
436
|
const M$6 = MatrixHelper;
|
|
437
437
|
|
|
438
438
|
const { toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3 } = MatrixHelper;
|
|
439
|
-
const { sin: sin$4, cos: cos$4, abs: abs$
|
|
439
|
+
const { sin: sin$4, cos: cos$4, abs: abs$3, sqrt: sqrt$2, atan2: atan2$2, min: min$1, round: round$2 } = Math;
|
|
440
440
|
const PointHelper = {
|
|
441
441
|
defaultPoint: getPointData(),
|
|
442
442
|
tempPoint: {},
|
|
@@ -531,8 +531,8 @@ const PointHelper = {
|
|
|
531
531
|
return getDistanceFrom(t.x, t.y, point.x, point.y);
|
|
532
532
|
},
|
|
533
533
|
getDistanceFrom(x1, y1, x2, y2) {
|
|
534
|
-
const x = abs$
|
|
535
|
-
const y = abs$
|
|
534
|
+
const x = abs$3(x2 - x1);
|
|
535
|
+
const y = abs$3(y2 - y1);
|
|
536
536
|
return sqrt$2(x * x + y * y);
|
|
537
537
|
},
|
|
538
538
|
getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
|
|
@@ -763,7 +763,7 @@ class Matrix {
|
|
|
763
763
|
MatrixHelper.reset(this);
|
|
764
764
|
}
|
|
765
765
|
}
|
|
766
|
-
const tempMatrix = new Matrix();
|
|
766
|
+
const tempMatrix$1 = new Matrix();
|
|
767
767
|
|
|
768
768
|
const TwoPointBoundsHelper = {
|
|
769
769
|
tempPointBounds: {},
|
|
@@ -860,6 +860,12 @@ const AroundHelper = {
|
|
|
860
860
|
}
|
|
861
861
|
if (!onlyBoxSize)
|
|
862
862
|
to.x += box.x, to.y += box.y;
|
|
863
|
+
},
|
|
864
|
+
getPoint(around, box, to) {
|
|
865
|
+
if (!to)
|
|
866
|
+
to = {};
|
|
867
|
+
AroundHelper.toPoint(around, box, to, true);
|
|
868
|
+
return to;
|
|
863
869
|
}
|
|
864
870
|
};
|
|
865
871
|
function get$4(around) {
|
|
@@ -1788,10 +1794,13 @@ function contextAttr(realName) {
|
|
|
1788
1794
|
return (target, key) => {
|
|
1789
1795
|
if (!realName)
|
|
1790
1796
|
realName = key;
|
|
1791
|
-
|
|
1797
|
+
const property = {
|
|
1792
1798
|
get() { return this.context[realName]; },
|
|
1793
1799
|
set(value) { this.context[realName] = value; }
|
|
1794
|
-
}
|
|
1800
|
+
};
|
|
1801
|
+
if (key === 'strokeCap')
|
|
1802
|
+
property.set = function (value) { this.context[realName] = value === 'none' ? 'butt' : value; };
|
|
1803
|
+
Object.defineProperty(target, key, property);
|
|
1795
1804
|
};
|
|
1796
1805
|
}
|
|
1797
1806
|
const contextMethodNameList = [];
|
|
@@ -2067,15 +2076,15 @@ __decorate([
|
|
|
2067
2076
|
contextMethod()
|
|
2068
2077
|
], Canvas$1.prototype, "strokeText", null);
|
|
2069
2078
|
|
|
2070
|
-
const { copy: copy$9, multiplyParent: multiplyParent$
|
|
2079
|
+
const { copy: copy$9, multiplyParent: multiplyParent$4 } = MatrixHelper, { round: round$1 } = Math;
|
|
2071
2080
|
const minSize = { width: 1, height: 1, pixelRatio: 1 };
|
|
2072
2081
|
const canvasSizeAttrs = ['width', 'height', 'pixelRatio'];
|
|
2073
2082
|
class LeaferCanvasBase extends Canvas$1 {
|
|
2074
2083
|
get width() { return this.size.width; }
|
|
2075
2084
|
get height() { return this.size.height; }
|
|
2076
2085
|
get pixelRatio() { return this.size.pixelRatio; }
|
|
2077
|
-
get pixelWidth() { return this.width * this.pixelRatio; }
|
|
2078
|
-
get pixelHeight() { return this.height * this.pixelRatio; }
|
|
2086
|
+
get pixelWidth() { return this.width * this.pixelRatio || 0; }
|
|
2087
|
+
get pixelHeight() { return this.height * this.pixelRatio || 0; }
|
|
2079
2088
|
get pixelSnap() { return this.config.pixelSnap; }
|
|
2080
2089
|
set pixelSnap(value) { this.config.pixelSnap = value; }
|
|
2081
2090
|
get allowBackgroundColor() { return this.view && this.parentView; }
|
|
@@ -2140,7 +2149,7 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2140
2149
|
setWorld(matrix, parentMatrix) {
|
|
2141
2150
|
const { pixelRatio, pixelSnap } = this, w = this.worldTransform;
|
|
2142
2151
|
if (parentMatrix)
|
|
2143
|
-
multiplyParent$
|
|
2152
|
+
multiplyParent$4(matrix, parentMatrix, w);
|
|
2144
2153
|
w.a = matrix.a * pixelRatio;
|
|
2145
2154
|
w.b = matrix.b * pixelRatio;
|
|
2146
2155
|
w.c = matrix.c * pixelRatio;
|
|
@@ -2162,20 +2171,33 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2162
2171
|
if (w)
|
|
2163
2172
|
this.setTransform(w.a, w.b, w.c, w.d, w.e, w.f);
|
|
2164
2173
|
}
|
|
2165
|
-
setStroke(color, strokeWidth, options) {
|
|
2174
|
+
setStroke(color, strokeWidth, options, childOptions) {
|
|
2166
2175
|
if (strokeWidth)
|
|
2167
2176
|
this.strokeWidth = strokeWidth;
|
|
2168
2177
|
if (color)
|
|
2169
2178
|
this.strokeStyle = color;
|
|
2170
2179
|
if (options)
|
|
2171
|
-
this.setStrokeOptions(options);
|
|
2172
|
-
}
|
|
2173
|
-
setStrokeOptions(options) {
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2180
|
+
this.setStrokeOptions(options, childOptions);
|
|
2181
|
+
}
|
|
2182
|
+
setStrokeOptions(options, childOptions) {
|
|
2183
|
+
let { strokeCap, strokeJoin, dashPattern, dashOffset, miterLimit } = options;
|
|
2184
|
+
if (childOptions) {
|
|
2185
|
+
if (childOptions.strokeCap)
|
|
2186
|
+
strokeCap = childOptions.strokeCap;
|
|
2187
|
+
if (childOptions.strokeJoin)
|
|
2188
|
+
strokeJoin = childOptions.strokeJoin;
|
|
2189
|
+
if (childOptions.dashPattern !== undefined)
|
|
2190
|
+
dashPattern = childOptions.dashPattern;
|
|
2191
|
+
if (childOptions.dashOffset !== undefined)
|
|
2192
|
+
dashOffset = childOptions.dashOffset;
|
|
2193
|
+
if (childOptions.miterLimit)
|
|
2194
|
+
miterLimit = childOptions.miterLimit;
|
|
2195
|
+
}
|
|
2196
|
+
this.strokeCap = strokeCap;
|
|
2197
|
+
this.strokeJoin = strokeJoin;
|
|
2198
|
+
this.dashPattern = dashPattern;
|
|
2199
|
+
this.dashOffset = dashOffset;
|
|
2200
|
+
this.miterLimit = miterLimit;
|
|
2179
2201
|
}
|
|
2180
2202
|
saveBlendMode(blendMode) {
|
|
2181
2203
|
this.savedBlendMode = this.blendMode;
|
|
@@ -2409,7 +2431,7 @@ const RectHelper = {
|
|
|
2409
2431
|
}
|
|
2410
2432
|
};
|
|
2411
2433
|
|
|
2412
|
-
const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$
|
|
2434
|
+
const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$2, PI: PI$2, sqrt: sqrt$1, pow } = Math;
|
|
2413
2435
|
const { setPoint: setPoint$1, addPoint: addPoint$1 } = TwoPointBoundsHelper;
|
|
2414
2436
|
const { set, toNumberPoints } = PointHelper;
|
|
2415
2437
|
const { M: M$5, L: L$6, C: C$4, Q: Q$4, Z: Z$5 } = PathCommandMap;
|
|
@@ -2484,7 +2506,7 @@ const BezierHelper = {
|
|
|
2484
2506
|
let totalRadian = endRadian - startRadian;
|
|
2485
2507
|
if (totalRadian < 0)
|
|
2486
2508
|
totalRadian += PI2;
|
|
2487
|
-
if (totalRadian === PI$2 || (abs$
|
|
2509
|
+
if (totalRadian === PI$2 || (abs$2(BAx + BAy) < 1.e-12) || (abs$2(CBx + CBy) < 1.e-12)) {
|
|
2488
2510
|
if (data)
|
|
2489
2511
|
data.push(L$6, x1, y1);
|
|
2490
2512
|
if (setPointBounds) {
|
|
@@ -2526,7 +2548,7 @@ const BezierHelper = {
|
|
|
2526
2548
|
totalRadian -= PI2;
|
|
2527
2549
|
if (anticlockwise)
|
|
2528
2550
|
totalRadian -= PI2;
|
|
2529
|
-
const parts = ceil$1(abs$
|
|
2551
|
+
const parts = ceil$1(abs$2(totalRadian / PI_2));
|
|
2530
2552
|
const partRadian = totalRadian / parts;
|
|
2531
2553
|
const partRadian4Sin = sin$3(partRadian / 4);
|
|
2532
2554
|
const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$3(partRadian / 2);
|
|
@@ -2971,7 +2993,7 @@ const { current, pushData, copyData } = PathConvert;
|
|
|
2971
2993
|
|
|
2972
2994
|
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;
|
|
2973
2995
|
const { getMinDistanceFrom, getRadianFrom } = PointHelper;
|
|
2974
|
-
const { tan, min, abs: abs$
|
|
2996
|
+
const { tan, min, abs: abs$1 } = Math;
|
|
2975
2997
|
const startPoint = {};
|
|
2976
2998
|
const PathCommandDataHelper = {
|
|
2977
2999
|
beginPath(data) {
|
|
@@ -3034,7 +3056,7 @@ const PathCommandDataHelper = {
|
|
|
3034
3056
|
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
|
|
3035
3057
|
if (lastX !== undefined) {
|
|
3036
3058
|
const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
|
|
3037
|
-
radius = min(radius, min(d / 2, d / 2 * abs$
|
|
3059
|
+
radius = min(radius, min(d / 2, d / 2 * abs$1(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
|
|
3038
3060
|
}
|
|
3039
3061
|
data.push(U$2, x1, y1, x2, y2, radius);
|
|
3040
3062
|
},
|
|
@@ -3910,6 +3932,13 @@ function defineKey(target, key, descriptor, noConfigurable) {
|
|
|
3910
3932
|
function getDescriptor(object, name) {
|
|
3911
3933
|
return Object.getOwnPropertyDescriptor(object, name);
|
|
3912
3934
|
}
|
|
3935
|
+
function createDescriptor(key, defaultValue) {
|
|
3936
|
+
const privateKey = '_' + key;
|
|
3937
|
+
return {
|
|
3938
|
+
get() { const v = this[privateKey]; return v === undefined ? defaultValue : v; },
|
|
3939
|
+
set(value) { this[privateKey] = value; }
|
|
3940
|
+
};
|
|
3941
|
+
}
|
|
3913
3942
|
function getNames(object) {
|
|
3914
3943
|
return Object.getOwnPropertyNames(object);
|
|
3915
3944
|
}
|
|
@@ -4142,15 +4171,7 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
4142
4171
|
const data = target.__DataProcessor.prototype;
|
|
4143
4172
|
const computedKey = '_' + key;
|
|
4144
4173
|
const setMethodName = getSetMethodName(key);
|
|
4145
|
-
const property =
|
|
4146
|
-
get() {
|
|
4147
|
-
const v = this[computedKey];
|
|
4148
|
-
return v === undefined ? defaultValue : v;
|
|
4149
|
-
},
|
|
4150
|
-
set(value) {
|
|
4151
|
-
this[computedKey] = value;
|
|
4152
|
-
}
|
|
4153
|
-
};
|
|
4174
|
+
const property = createDescriptor(key, defaultValue);
|
|
4154
4175
|
if (defaultValue === undefined) {
|
|
4155
4176
|
property.get = function () { return this[computedKey]; };
|
|
4156
4177
|
}
|
|
@@ -4265,7 +4286,7 @@ function registerUIEvent() {
|
|
|
4265
4286
|
};
|
|
4266
4287
|
}
|
|
4267
4288
|
|
|
4268
|
-
const { copy: copy$7, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$
|
|
4289
|
+
const { copy: copy$7, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$3, divideParent, getLayout } = MatrixHelper;
|
|
4269
4290
|
const matrix$1 = {}, { round } = Math;
|
|
4270
4291
|
const LeafHelper = {
|
|
4271
4292
|
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
@@ -4337,6 +4358,14 @@ const LeafHelper = {
|
|
|
4337
4358
|
}
|
|
4338
4359
|
return true;
|
|
4339
4360
|
},
|
|
4361
|
+
copyCanvasByWorld(leaf, currentCanvas, fromCanvas, fromWorld, blendMode, onlyResetTransform) {
|
|
4362
|
+
if (!fromWorld)
|
|
4363
|
+
fromWorld = leaf.__nowWorld;
|
|
4364
|
+
if (leaf.__worldFlipped || Platform.fullImageShadow)
|
|
4365
|
+
currentCanvas.copyWorldByReset(fromCanvas, fromWorld, leaf.__nowWorld, blendMode, onlyResetTransform);
|
|
4366
|
+
else
|
|
4367
|
+
currentCanvas.copyWorldToInner(fromCanvas, fromWorld, leaf.__layout.renderBounds, blendMode);
|
|
4368
|
+
},
|
|
4340
4369
|
moveWorld(t, x, y = 0, isInnerPoint, transition) {
|
|
4341
4370
|
const local = typeof x === 'object' ? Object.assign({}, x) : { x, y };
|
|
4342
4371
|
isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : (t.parent && toInnerPoint$1(t.parent.worldTransform, local, local, true));
|
|
@@ -4396,14 +4425,14 @@ const LeafHelper = {
|
|
|
4396
4425
|
},
|
|
4397
4426
|
transformWorld(t, transform, resize, transition) {
|
|
4398
4427
|
copy$7(matrix$1, t.worldTransform);
|
|
4399
|
-
multiplyParent$
|
|
4428
|
+
multiplyParent$3(matrix$1, transform);
|
|
4400
4429
|
if (t.parent)
|
|
4401
4430
|
divideParent(matrix$1, t.parent.worldTransform);
|
|
4402
4431
|
L.setTransform(t, matrix$1, resize, transition);
|
|
4403
4432
|
},
|
|
4404
4433
|
transform(t, transform, resize, transition) {
|
|
4405
4434
|
copy$7(matrix$1, t.localTransform);
|
|
4406
|
-
multiplyParent$
|
|
4435
|
+
multiplyParent$3(matrix$1, transform);
|
|
4407
4436
|
L.setTransform(t, matrix$1, resize, transition);
|
|
4408
4437
|
},
|
|
4409
4438
|
setTransform(t, transform, resize, transition) {
|
|
@@ -5265,17 +5294,18 @@ const LeafDataProxy = {
|
|
|
5265
5294
|
}
|
|
5266
5295
|
};
|
|
5267
5296
|
|
|
5268
|
-
const { setLayout, multiplyParent: multiplyParent$
|
|
5297
|
+
const { setLayout, multiplyParent: multiplyParent$2, translateInner, defaultWorld } = MatrixHelper;
|
|
5269
5298
|
const { toPoint: toPoint$3, tempPoint } = AroundHelper;
|
|
5270
5299
|
const LeafMatrix = {
|
|
5271
5300
|
__updateWorldMatrix() {
|
|
5272
|
-
|
|
5301
|
+
const { parent, __layout } = this;
|
|
5302
|
+
multiplyParent$2(this.__local || __layout, parent ? parent.__world : defaultWorld, this.__world, !!__layout.affectScaleOrRotation, this.__, parent && (parent.scrollY || parent.scrollX) && parent.__);
|
|
5273
5303
|
},
|
|
5274
5304
|
__updateLocalMatrix() {
|
|
5275
5305
|
if (this.__local) {
|
|
5276
5306
|
const layout = this.__layout, local = this.__local, data = this.__;
|
|
5277
5307
|
if (layout.affectScaleOrRotation) {
|
|
5278
|
-
if ((layout.scaleChanged && (layout.resized = 'scale')) || layout.rotationChanged) {
|
|
5308
|
+
if ((layout.scaleChanged && (layout.resized || (layout.resized = 'scale'))) || layout.rotationChanged) {
|
|
5279
5309
|
setLayout(local, data, null, null, layout.affectRotation);
|
|
5280
5310
|
layout.scaleChanged = layout.rotationChanged = undefined;
|
|
5281
5311
|
}
|
|
@@ -5441,10 +5471,7 @@ const LeafRender = {
|
|
|
5441
5471
|
return this.__renderEraser(canvas, options);
|
|
5442
5472
|
const tempCanvas = canvas.getSameCanvas(true, true);
|
|
5443
5473
|
this.__draw(tempCanvas, options, canvas);
|
|
5444
|
-
|
|
5445
|
-
canvas.copyWorldByReset(tempCanvas, this.__nowWorld, null, data.__blendMode, true);
|
|
5446
|
-
else
|
|
5447
|
-
canvas.copyWorldToInner(tempCanvas, this.__nowWorld, this.__layout.renderBounds, data.__blendMode);
|
|
5474
|
+
LeafHelper.copyCanvasByWorld(this, canvas, tempCanvas, this.__nowWorld, data.__blendMode, true);
|
|
5448
5475
|
tempCanvas.recycle(this.__nowWorld);
|
|
5449
5476
|
}
|
|
5450
5477
|
else {
|
|
@@ -5492,7 +5519,7 @@ const BranchRender = {
|
|
|
5492
5519
|
options.dimOpacity = data.dim === true ? 0.2 : data.dim;
|
|
5493
5520
|
else if (data.dimskip)
|
|
5494
5521
|
options.dimOpacity && (options.dimOpacity = 0);
|
|
5495
|
-
if (data.__single) {
|
|
5522
|
+
if (data.__single && !this.isBranchLeaf) {
|
|
5496
5523
|
if (data.eraser === 'path')
|
|
5497
5524
|
return this.__renderEraser(canvas, options);
|
|
5498
5525
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
@@ -5514,9 +5541,7 @@ const BranchRender = {
|
|
|
5514
5541
|
else {
|
|
5515
5542
|
const { children } = this;
|
|
5516
5543
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
5517
|
-
|
|
5518
|
-
continue;
|
|
5519
|
-
children[i].__render(canvas, options);
|
|
5544
|
+
excludeRenderBounds$1(children[i], options) || children[i].__render(canvas, options);
|
|
5520
5545
|
}
|
|
5521
5546
|
}
|
|
5522
5547
|
},
|
|
@@ -5524,16 +5549,15 @@ const BranchRender = {
|
|
|
5524
5549
|
if (this.__worldOpacity) {
|
|
5525
5550
|
const { children } = this;
|
|
5526
5551
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
5527
|
-
|
|
5528
|
-
continue;
|
|
5529
|
-
children[i].__clip(canvas, options);
|
|
5552
|
+
excludeRenderBounds$1(children[i], options) || children[i].__clip(canvas, options);
|
|
5530
5553
|
}
|
|
5531
5554
|
}
|
|
5532
5555
|
}
|
|
5533
5556
|
};
|
|
5534
5557
|
|
|
5558
|
+
const tempScaleData$1 = {};
|
|
5535
5559
|
const { LEAF, create } = IncrementId;
|
|
5536
|
-
const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
|
|
5560
|
+
const { toInnerPoint, toOuterPoint, multiplyParent: multiplyParent$1 } = MatrixHelper;
|
|
5537
5561
|
const { toOuterOf } = BoundsHelper;
|
|
5538
5562
|
const { copy: copy$4, move } = PointHelper;
|
|
5539
5563
|
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
|
|
@@ -5715,7 +5739,7 @@ let Leaf = class Leaf {
|
|
|
5715
5739
|
if (!this.__cameraWorld)
|
|
5716
5740
|
this.__cameraWorld = {};
|
|
5717
5741
|
const cameraWorld = this.__cameraWorld, world = this.__world;
|
|
5718
|
-
multiplyParent(world, options.matrix, cameraWorld, undefined, world);
|
|
5742
|
+
multiplyParent$1(world, options.matrix, cameraWorld, undefined, world);
|
|
5719
5743
|
toOuterOf(this.__layout.renderBounds, cameraWorld, cameraWorld);
|
|
5720
5744
|
cameraWorld.half !== world.half && (cameraWorld.half = world.half);
|
|
5721
5745
|
return cameraWorld;
|
|
@@ -5724,6 +5748,22 @@ let Leaf = class Leaf {
|
|
|
5724
5748
|
return this.__world;
|
|
5725
5749
|
}
|
|
5726
5750
|
}
|
|
5751
|
+
getClampRenderScale() {
|
|
5752
|
+
let { scaleX } = this.__nowWorld || this.__world;
|
|
5753
|
+
if (scaleX < 0)
|
|
5754
|
+
scaleX = -scaleX;
|
|
5755
|
+
return scaleX > 1 ? scaleX : 1;
|
|
5756
|
+
}
|
|
5757
|
+
getRenderScaleData(abs, scaleFixed) {
|
|
5758
|
+
const { scaleX, scaleY } = ImageManager.patternLocked ? this.__world : this.__nowWorld;
|
|
5759
|
+
if (scaleFixed)
|
|
5760
|
+
tempScaleData$1.scaleX = tempScaleData$1.scaleY = 1;
|
|
5761
|
+
else if (abs)
|
|
5762
|
+
tempScaleData$1.scaleX = scaleX < 0 ? -scaleX : scaleX, tempScaleData$1.scaleY = scaleY < 0 ? -scaleY : scaleY;
|
|
5763
|
+
else
|
|
5764
|
+
tempScaleData$1.scaleX = scaleX, tempScaleData$1.scaleY = scaleY;
|
|
5765
|
+
return tempScaleData$1;
|
|
5766
|
+
}
|
|
5727
5767
|
getTransform(relative) {
|
|
5728
5768
|
return this.__layout.getTransform(relative || 'local');
|
|
5729
5769
|
}
|
|
@@ -6248,7 +6288,7 @@ class LeafLevelList {
|
|
|
6248
6288
|
}
|
|
6249
6289
|
}
|
|
6250
6290
|
|
|
6251
|
-
const version = "1.
|
|
6291
|
+
const version = "1.8.0";
|
|
6252
6292
|
|
|
6253
6293
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6254
6294
|
get allowBackgroundColor() { return true; }
|
|
@@ -7096,6 +7136,11 @@ function zoomLayerType() {
|
|
|
7096
7136
|
});
|
|
7097
7137
|
};
|
|
7098
7138
|
}
|
|
7139
|
+
function createAttr(defaultValue) {
|
|
7140
|
+
return (target, key) => {
|
|
7141
|
+
defineKey(target, key, createDescriptor(key, defaultValue));
|
|
7142
|
+
};
|
|
7143
|
+
}
|
|
7099
7144
|
|
|
7100
7145
|
function hasTransparent$3(color) {
|
|
7101
7146
|
if (!color || color.length === 7 || color.length === 4)
|
|
@@ -7153,22 +7198,9 @@ const emptyPaint = {};
|
|
|
7153
7198
|
const debug$2 = Debug.get('UIData');
|
|
7154
7199
|
class UIData extends LeafData {
|
|
7155
7200
|
get scale() { const { scaleX, scaleY } = this; return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX; }
|
|
7156
|
-
get __strokeWidth() {
|
|
7157
|
-
|
|
7158
|
-
|
|
7159
|
-
const ui = this.__leaf;
|
|
7160
|
-
let { scaleX } = ui.__nowWorld || ui.__world;
|
|
7161
|
-
if (scaleX < 0)
|
|
7162
|
-
scaleX = -scaleX;
|
|
7163
|
-
return scaleX > 1 ? strokeWidth / scaleX : strokeWidth;
|
|
7164
|
-
}
|
|
7165
|
-
else
|
|
7166
|
-
return strokeWidth;
|
|
7167
|
-
}
|
|
7168
|
-
get __hasMultiPaint() {
|
|
7169
|
-
const t = this;
|
|
7170
|
-
return (t.fill && this.__useStroke) || (t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect;
|
|
7171
|
-
}
|
|
7201
|
+
get __strokeWidth() { return this.__getRealStrokeWidth(); }
|
|
7202
|
+
get __maxStrokeWidth() { const t = this; return t.__hasMultiStrokeStyle ? Math.max(t.__hasMultiStrokeStyle, t.strokeWidth) : t.strokeWidth; }
|
|
7203
|
+
get __hasMultiPaint() { const t = this; return (t.fill && this.__useStroke) || (t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect; }
|
|
7172
7204
|
get __clipAfterFill() { const t = this; return (t.cornerRadius || t.innerShadow || t.__pathInputed); }
|
|
7173
7205
|
get __hasSurface() { const t = this; return (t.fill || t.stroke); }
|
|
7174
7206
|
get __autoWidth() { return !this._width; }
|
|
@@ -7250,6 +7282,21 @@ class UIData extends LeafData {
|
|
|
7250
7282
|
Paint.compute('stroke', this.__leaf);
|
|
7251
7283
|
this.__needComputePaint = undefined;
|
|
7252
7284
|
}
|
|
7285
|
+
__getRealStrokeWidth(childStyle) {
|
|
7286
|
+
let { strokeWidth, strokeWidthFixed } = this;
|
|
7287
|
+
if (childStyle) {
|
|
7288
|
+
if (childStyle.strokeWidth)
|
|
7289
|
+
strokeWidth = childStyle.strokeWidth;
|
|
7290
|
+
if (childStyle.strokeWidthFixed !== undefined)
|
|
7291
|
+
strokeWidthFixed = childStyle.strokeWidthFixed;
|
|
7292
|
+
}
|
|
7293
|
+
if (strokeWidthFixed) {
|
|
7294
|
+
const scale = this.__leaf.getClampRenderScale();
|
|
7295
|
+
return scale > 1 ? strokeWidth / scale : strokeWidth;
|
|
7296
|
+
}
|
|
7297
|
+
else
|
|
7298
|
+
return strokeWidth;
|
|
7299
|
+
}
|
|
7253
7300
|
__setPaint(attrName, value) {
|
|
7254
7301
|
this.__setInput(attrName, value);
|
|
7255
7302
|
const layout = this.__leaf.__layout;
|
|
@@ -7274,6 +7321,7 @@ class UIData extends LeafData {
|
|
|
7274
7321
|
}
|
|
7275
7322
|
else {
|
|
7276
7323
|
stintSet$2(this, '__isAlphaPixelStroke', undefined);
|
|
7324
|
+
stintSet$2(this, '__hasMultiStrokeStyle', undefined);
|
|
7277
7325
|
this._stroke = this.__isStrokes = undefined;
|
|
7278
7326
|
}
|
|
7279
7327
|
}
|
|
@@ -7295,8 +7343,8 @@ class GroupData extends UIData {
|
|
|
7295
7343
|
|
|
7296
7344
|
class BoxData extends GroupData {
|
|
7297
7345
|
get __boxStroke() { return !this.__pathInputed; }
|
|
7298
|
-
get __drawAfterFill() { const t = this; return
|
|
7299
|
-
get __clipAfterFill() { return
|
|
7346
|
+
get __drawAfterFill() { const t = this; return t.__single || t.__clipAfterFill; }
|
|
7347
|
+
get __clipAfterFill() { const t = this; return t.overflow === 'hide' && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill); }
|
|
7300
7348
|
}
|
|
7301
7349
|
|
|
7302
7350
|
class LeaferData extends GroupData {
|
|
@@ -7416,7 +7464,7 @@ class CanvasData extends RectData {
|
|
|
7416
7464
|
const UIBounds = {
|
|
7417
7465
|
__updateStrokeSpread() {
|
|
7418
7466
|
let width = 0, boxWidth = 0;
|
|
7419
|
-
const data = this.__, { strokeAlign, strokeWidth } = data, box = this.__box;
|
|
7467
|
+
const data = this.__, { strokeAlign, __maxStrokeWidth: strokeWidth } = data, box = this.__box;
|
|
7420
7468
|
if ((data.stroke || data.hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
|
|
7421
7469
|
boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth;
|
|
7422
7470
|
if (!data.__boxStroke) {
|
|
@@ -7436,13 +7484,15 @@ const UIBounds = {
|
|
|
7436
7484
|
},
|
|
7437
7485
|
__updateRenderSpread() {
|
|
7438
7486
|
let width = 0;
|
|
7439
|
-
const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
|
|
7487
|
+
const { shadow, innerShadow, blur, backgroundBlur, filter, renderSpread } = this.__;
|
|
7440
7488
|
if (shadow)
|
|
7441
7489
|
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));
|
|
7442
7490
|
if (blur)
|
|
7443
7491
|
width = Math.max(width, blur);
|
|
7444
7492
|
if (filter)
|
|
7445
7493
|
width += Filter.getSpread(filter);
|
|
7494
|
+
if (renderSpread)
|
|
7495
|
+
width += renderSpread;
|
|
7446
7496
|
let shapeWidth = width = Math.ceil(width);
|
|
7447
7497
|
if (innerShadow)
|
|
7448
7498
|
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));
|
|
@@ -7465,7 +7515,7 @@ const UIRender = {
|
|
|
7465
7515
|
}
|
|
7466
7516
|
if (data.__useEffect) {
|
|
7467
7517
|
const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
7468
|
-
stintSet$1(data, '__isFastShadow', shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread &&
|
|
7518
|
+
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')));
|
|
7469
7519
|
data.__useEffect = !!(shadow || otherEffect);
|
|
7470
7520
|
}
|
|
7471
7521
|
data.__checkSingle();
|
|
@@ -7572,17 +7622,17 @@ const RectRender = {
|
|
|
7572
7622
|
if (__drawAfterFill)
|
|
7573
7623
|
this.__drawAfterFill(canvas, options);
|
|
7574
7624
|
if (stroke) {
|
|
7575
|
-
const { strokeAlign, __strokeWidth } = this.__;
|
|
7576
|
-
if (!
|
|
7625
|
+
const { strokeAlign, __strokeWidth: strokeWidth } = this.__;
|
|
7626
|
+
if (!strokeWidth)
|
|
7577
7627
|
return;
|
|
7578
|
-
canvas.setStroke(stroke,
|
|
7579
|
-
const half =
|
|
7628
|
+
canvas.setStroke(stroke, strokeWidth, this.__);
|
|
7629
|
+
const half = strokeWidth / 2;
|
|
7580
7630
|
switch (strokeAlign) {
|
|
7581
7631
|
case 'center':
|
|
7582
7632
|
canvas.strokeRect(0, 0, width, height);
|
|
7583
7633
|
break;
|
|
7584
7634
|
case 'inside':
|
|
7585
|
-
width -=
|
|
7635
|
+
width -= strokeWidth, height -= strokeWidth;
|
|
7586
7636
|
if (width < 0 || height < 0) {
|
|
7587
7637
|
canvas.save();
|
|
7588
7638
|
this.__clip(canvas, options);
|
|
@@ -7593,7 +7643,7 @@ const RectRender = {
|
|
|
7593
7643
|
canvas.strokeRect(x + half, y + half, width, height);
|
|
7594
7644
|
break;
|
|
7595
7645
|
case 'outside':
|
|
7596
|
-
canvas.strokeRect(x - half, y - half, width +
|
|
7646
|
+
canvas.strokeRect(x - half, y - half, width + strokeWidth, height + strokeWidth);
|
|
7597
7647
|
break;
|
|
7598
7648
|
}
|
|
7599
7649
|
}
|
|
@@ -7606,6 +7656,8 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7606
7656
|
get isFrame() { return false; }
|
|
7607
7657
|
set scale(value) { MathHelper.assignScale(this, value); }
|
|
7608
7658
|
get scale() { return this.__.scale; }
|
|
7659
|
+
get isAutoWidth() { const t = this.__; return t.__autoWidth || t.autoWidth; }
|
|
7660
|
+
get isAutoHeight() { const t = this.__; return t.__autoHeight || t.autoHeight; }
|
|
7609
7661
|
get pen() {
|
|
7610
7662
|
const { path } = this.__;
|
|
7611
7663
|
pen.set(this.path = path || []);
|
|
@@ -7820,6 +7872,9 @@ __decorate([
|
|
|
7820
7872
|
__decorate([
|
|
7821
7873
|
naturalBoundsType(1)
|
|
7822
7874
|
], UI.prototype, "pixelRatio", void 0);
|
|
7875
|
+
__decorate([
|
|
7876
|
+
affectRenderBoundsType(0)
|
|
7877
|
+
], UI.prototype, "renderSpread", void 0);
|
|
7823
7878
|
__decorate([
|
|
7824
7879
|
pathInputType()
|
|
7825
7880
|
], UI.prototype, "path", void 0);
|
|
@@ -7976,7 +8031,8 @@ let Group = class Group extends UI {
|
|
|
7976
8031
|
}
|
|
7977
8032
|
toJSON(options) {
|
|
7978
8033
|
const data = super.toJSON(options);
|
|
7979
|
-
|
|
8034
|
+
if (!this.childlessJSON)
|
|
8035
|
+
data.children = this.children.map(child => child.toJSON(options));
|
|
7980
8036
|
return data;
|
|
7981
8037
|
}
|
|
7982
8038
|
pick(_hitPoint, _options) { return undefined; }
|
|
@@ -8423,8 +8479,8 @@ let Box = class Box extends Group {
|
|
|
8423
8479
|
__updateRenderSpread() { return this.__updateRectRenderSpread() || -1; }
|
|
8424
8480
|
__updateRectBoxBounds() { }
|
|
8425
8481
|
__updateBoxBounds(_secondLayout) {
|
|
8426
|
-
const data = this.__;
|
|
8427
8482
|
if (this.children.length && !this.pathInputed) {
|
|
8483
|
+
const data = this.__;
|
|
8428
8484
|
if (data.__autoSide) {
|
|
8429
8485
|
if (data.__hasSurface)
|
|
8430
8486
|
this.__extraUpdate();
|
|
@@ -8451,20 +8507,26 @@ let Box = class Box extends Group {
|
|
|
8451
8507
|
__updateStrokeBounds() { }
|
|
8452
8508
|
__updateRenderBounds() {
|
|
8453
8509
|
let isOverflow;
|
|
8454
|
-
const { renderBounds } = this.__layout;
|
|
8455
8510
|
if (this.children.length) {
|
|
8511
|
+
const data = this.__, { renderBounds, boxBounds } = this.__layout;
|
|
8456
8512
|
super.__updateRenderBounds();
|
|
8457
8513
|
copy$3(childrenRenderBounds, renderBounds);
|
|
8458
8514
|
this.__updateRectRenderBounds();
|
|
8459
|
-
|
|
8460
|
-
|
|
8515
|
+
if (data.scrollY || data.scrollX) {
|
|
8516
|
+
childrenRenderBounds.x += data.scrollX;
|
|
8517
|
+
childrenRenderBounds.y += data.scrollY;
|
|
8518
|
+
}
|
|
8519
|
+
isOverflow = !includes$1(boxBounds, childrenRenderBounds);
|
|
8520
|
+
if (isOverflow && data.overflow !== 'hide')
|
|
8461
8521
|
add(renderBounds, childrenRenderBounds);
|
|
8462
8522
|
}
|
|
8463
8523
|
else
|
|
8464
8524
|
this.__updateRectRenderBounds();
|
|
8465
8525
|
DataHelper.stintSet(this, 'isOverflow', isOverflow);
|
|
8526
|
+
this.__updateScrollBar();
|
|
8466
8527
|
}
|
|
8467
8528
|
__updateRectRenderBounds() { }
|
|
8529
|
+
__updateScrollBar() { }
|
|
8468
8530
|
__updateRectChange() { }
|
|
8469
8531
|
__updateChange() {
|
|
8470
8532
|
super.__updateChange();
|
|
@@ -8481,10 +8543,12 @@ let Box = class Box extends Group {
|
|
|
8481
8543
|
if (this.children.length)
|
|
8482
8544
|
this.__renderGroup(canvas, options);
|
|
8483
8545
|
}
|
|
8546
|
+
if (this.scrollBar)
|
|
8547
|
+
this.scrollBar.__render(canvas, options);
|
|
8484
8548
|
}
|
|
8485
8549
|
__drawContent(canvas, options) {
|
|
8486
8550
|
this.__renderGroup(canvas, options);
|
|
8487
|
-
if (this.__.__useStroke) {
|
|
8551
|
+
if (this.__.__useStroke || this.__.__useEffect) {
|
|
8488
8552
|
canvas.setWorld(this.__nowWorld);
|
|
8489
8553
|
this.__drawRenderPath(canvas);
|
|
8490
8554
|
}
|
|
@@ -10287,18 +10351,20 @@ leaf.__hitWorld = function (point) {
|
|
|
10287
10351
|
}
|
|
10288
10352
|
return this.__hit(inner);
|
|
10289
10353
|
};
|
|
10290
|
-
leaf.__hitFill = function (inner) {
|
|
10291
|
-
leaf.__hitStroke = function (inner, strokeWidth) {
|
|
10292
|
-
leaf.__hitPixel = function (inner) {
|
|
10293
|
-
leaf.__drawHitPath = function (canvas) {
|
|
10294
|
-
this.__drawRenderPath(canvas); };
|
|
10354
|
+
leaf.__hitFill = function (inner) { const h = this.__hitCanvas; return h && h.hitFill(inner, this.__.windingRule); };
|
|
10355
|
+
leaf.__hitStroke = function (inner, strokeWidth) { const h = this.__hitCanvas; return h && h.hitStroke(inner, strokeWidth); };
|
|
10356
|
+
leaf.__hitPixel = function (inner) { const h = this.__hitCanvas; return h && h.hitPixel(inner, this.__layout.renderBounds, h.hitScale); };
|
|
10357
|
+
leaf.__drawHitPath = function (canvas) { canvas && this.__drawRenderPath(canvas); };
|
|
10295
10358
|
|
|
10296
10359
|
const matrix = new Matrix();
|
|
10297
10360
|
const ui$1 = UI.prototype;
|
|
10298
10361
|
ui$1.__updateHitCanvas = function () {
|
|
10299
10362
|
if (this.__box)
|
|
10300
10363
|
this.__box.__updateHitCanvas();
|
|
10301
|
-
const
|
|
10364
|
+
const leafer = this.leafer || (this.parent && this.parent.leafer);
|
|
10365
|
+
if (!leafer)
|
|
10366
|
+
return;
|
|
10367
|
+
const data = this.__, { hitCanvasManager } = leafer;
|
|
10302
10368
|
const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === 'pixel';
|
|
10303
10369
|
const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === 'pixel';
|
|
10304
10370
|
const isHitPixel = isHitPixelFill || isHitPixelStroke;
|
|
@@ -10334,7 +10400,7 @@ ui$1.__hit = function (inner) {
|
|
|
10334
10400
|
const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.__isAlphaPixelFill || data.__isCanvas)))) || hitFill === 'all';
|
|
10335
10401
|
if (needHitFillPath && this.__hitFill(inner))
|
|
10336
10402
|
return true;
|
|
10337
|
-
const { hitStroke,
|
|
10403
|
+
const { hitStroke, __maxStrokeWidth: strokeWidth } = data;
|
|
10338
10404
|
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.__isAlphaPixelStroke))) || hitStroke === 'all';
|
|
10339
10405
|
if (!needHitFillPath && !needHitStrokePath)
|
|
10340
10406
|
return false;
|
|
@@ -10343,16 +10409,16 @@ ui$1.__hit = function (inner) {
|
|
|
10343
10409
|
if (needHitStrokePath) {
|
|
10344
10410
|
switch (data.strokeAlign) {
|
|
10345
10411
|
case 'inside':
|
|
10346
|
-
hitWidth +=
|
|
10412
|
+
hitWidth += strokeWidth * 2;
|
|
10347
10413
|
if (!needHitFillPath && this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
|
|
10348
10414
|
return true;
|
|
10349
10415
|
hitWidth = radiusWidth;
|
|
10350
10416
|
break;
|
|
10351
10417
|
case 'center':
|
|
10352
|
-
hitWidth +=
|
|
10418
|
+
hitWidth += strokeWidth;
|
|
10353
10419
|
break;
|
|
10354
10420
|
case 'outside':
|
|
10355
|
-
hitWidth +=
|
|
10421
|
+
hitWidth += strokeWidth * 2;
|
|
10356
10422
|
if (!needHitFillPath) {
|
|
10357
10423
|
if (!this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
|
|
10358
10424
|
return true;
|
|
@@ -10452,9 +10518,14 @@ function fills(fills, ui, canvas) {
|
|
|
10452
10518
|
}
|
|
10453
10519
|
}
|
|
10454
10520
|
canvas.fillStyle = item.style;
|
|
10455
|
-
if (item.transform) {
|
|
10521
|
+
if (item.transform || item.scaleFixed) {
|
|
10456
10522
|
canvas.save();
|
|
10457
|
-
|
|
10523
|
+
if (item.transform)
|
|
10524
|
+
canvas.transform(item.transform);
|
|
10525
|
+
if (item.scaleFixed) {
|
|
10526
|
+
const { scaleX, scaleY } = ui.getRenderScaleData(true);
|
|
10527
|
+
canvas.scale(1 / scaleX, 1 / scaleY);
|
|
10528
|
+
}
|
|
10458
10529
|
if (item.blendMode)
|
|
10459
10530
|
canvas.blendMode = item.blendMode;
|
|
10460
10531
|
fillPathOrText(ui, canvas);
|
|
@@ -10490,8 +10561,13 @@ function strokeText(stroke, ui, canvas) {
|
|
|
10490
10561
|
}
|
|
10491
10562
|
function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
|
|
10492
10563
|
const data = ui.__;
|
|
10493
|
-
|
|
10494
|
-
|
|
10564
|
+
if (typeof stroke === 'object') {
|
|
10565
|
+
drawStrokesStyle(stroke, strokeWidthScale, true, ui, canvas);
|
|
10566
|
+
}
|
|
10567
|
+
else {
|
|
10568
|
+
canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
10569
|
+
drawTextStroke(ui, canvas);
|
|
10570
|
+
}
|
|
10495
10571
|
}
|
|
10496
10572
|
function drawAlign(stroke, align, ui, canvas) {
|
|
10497
10573
|
const out = canvas.getSameCanvas(true, true);
|
|
@@ -10500,15 +10576,9 @@ function drawAlign(stroke, align, ui, canvas) {
|
|
|
10500
10576
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
10501
10577
|
fillText(ui, out);
|
|
10502
10578
|
out.blendMode = 'normal';
|
|
10503
|
-
|
|
10579
|
+
LeafHelper.copyCanvasByWorld(ui, canvas, out);
|
|
10504
10580
|
out.recycle(ui.__nowWorld);
|
|
10505
10581
|
}
|
|
10506
|
-
function copyWorld(canvas, out, ui) {
|
|
10507
|
-
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
10508
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10509
|
-
else
|
|
10510
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10511
|
-
}
|
|
10512
10582
|
function drawTextStroke(ui, canvas) {
|
|
10513
10583
|
let row, data = ui.__.__textDrawData;
|
|
10514
10584
|
const { rows, decorationY } = data;
|
|
@@ -10524,14 +10594,21 @@ function drawTextStroke(ui, canvas) {
|
|
|
10524
10594
|
rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
10525
10595
|
}
|
|
10526
10596
|
}
|
|
10527
|
-
function drawStrokesStyle(strokes, isText, ui, canvas) {
|
|
10597
|
+
function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas) {
|
|
10528
10598
|
let item;
|
|
10599
|
+
const data = ui.__, { __hasMultiStrokeStyle } = data;
|
|
10600
|
+
__hasMultiStrokeStyle || canvas.setStroke(undefined, data.__strokeWidth * strokeWidthScale, data);
|
|
10529
10601
|
for (let i = 0, len = strokes.length; i < len; i++) {
|
|
10530
10602
|
item = strokes[i];
|
|
10531
10603
|
if (item.image && PaintImage.checkImage(ui, canvas, item, false))
|
|
10532
10604
|
continue;
|
|
10533
10605
|
if (item.style) {
|
|
10534
|
-
|
|
10606
|
+
if (__hasMultiStrokeStyle) {
|
|
10607
|
+
const { strokeStyle } = item;
|
|
10608
|
+
strokeStyle ? canvas.setStroke(item.style, data.__getRealStrokeWidth(strokeStyle) * strokeWidthScale, data, strokeStyle) : canvas.setStroke(item.style, data.__strokeWidth * strokeWidthScale, data);
|
|
10609
|
+
}
|
|
10610
|
+
else
|
|
10611
|
+
canvas.strokeStyle = item.style;
|
|
10535
10612
|
if (item.blendMode) {
|
|
10536
10613
|
canvas.saveBlendMode(item.blendMode);
|
|
10537
10614
|
isText ? drawTextStroke(ui, canvas) : canvas.stroke();
|
|
@@ -10570,8 +10647,13 @@ function strokes(strokes, ui, canvas) {
|
|
|
10570
10647
|
}
|
|
10571
10648
|
function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
10572
10649
|
const data = ui.__;
|
|
10573
|
-
|
|
10574
|
-
|
|
10650
|
+
if (typeof stroke === 'object') {
|
|
10651
|
+
drawStrokesStyle(stroke, strokeWidthScale, false, ui, canvas);
|
|
10652
|
+
}
|
|
10653
|
+
else {
|
|
10654
|
+
canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
10655
|
+
canvas.stroke();
|
|
10656
|
+
}
|
|
10575
10657
|
if (data.__useArrow)
|
|
10576
10658
|
Paint.strokeArrow(stroke, ui, canvas);
|
|
10577
10659
|
}
|
|
@@ -10593,7 +10675,7 @@ function drawOutside(stroke, ui, canvas) {
|
|
|
10593
10675
|
drawCenter(stroke, 2, ui, out);
|
|
10594
10676
|
out.clipUI(data);
|
|
10595
10677
|
out.clearWorld(renderBounds);
|
|
10596
|
-
|
|
10678
|
+
LeafHelper.copyCanvasByWorld(ui, canvas, out);
|
|
10597
10679
|
out.recycle(ui.__nowWorld);
|
|
10598
10680
|
}
|
|
10599
10681
|
}
|
|
@@ -10648,8 +10730,16 @@ function compute(attrName, ui) {
|
|
|
10648
10730
|
if (!(paints instanceof Array))
|
|
10649
10731
|
paints = [paints];
|
|
10650
10732
|
recycleMap = PaintImage.recycleImage(attrName, data);
|
|
10733
|
+
let maxChildStrokeWidth;
|
|
10651
10734
|
for (let i = 0, len = paints.length, item; i < len; i++) {
|
|
10652
|
-
(item = getLeafPaint(attrName, paints[i], ui))
|
|
10735
|
+
if (item = getLeafPaint(attrName, paints[i], ui)) {
|
|
10736
|
+
leafPaints.push(item);
|
|
10737
|
+
if (item.strokeStyle) {
|
|
10738
|
+
maxChildStrokeWidth || (maxChildStrokeWidth = 1);
|
|
10739
|
+
if (item.strokeStyle.strokeWidth)
|
|
10740
|
+
maxChildStrokeWidth = Math.max(maxChildStrokeWidth, item.strokeStyle.strokeWidth);
|
|
10741
|
+
}
|
|
10742
|
+
}
|
|
10653
10743
|
}
|
|
10654
10744
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
10655
10745
|
if (leafPaints.length) {
|
|
@@ -10666,6 +10756,7 @@ function compute(attrName, ui) {
|
|
|
10666
10756
|
else {
|
|
10667
10757
|
stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
|
|
10668
10758
|
stintSet(data, '__isTransparentStroke', isTransparent);
|
|
10759
|
+
stintSet(data, '__hasMultiStrokeStyle', maxChildStrokeWidth);
|
|
10669
10760
|
}
|
|
10670
10761
|
}
|
|
10671
10762
|
function getLeafPaint(attrName, paint, ui) {
|
|
@@ -10697,6 +10788,11 @@ function getLeafPaint(attrName, paint, ui) {
|
|
|
10697
10788
|
if (data) {
|
|
10698
10789
|
if (typeof data.style === 'string' && hasTransparent$1(data.style))
|
|
10699
10790
|
data.isTransparent = true;
|
|
10791
|
+
if (paint.style) {
|
|
10792
|
+
if (paint.style.strokeWidth === 0)
|
|
10793
|
+
return undefined;
|
|
10794
|
+
data.strokeStyle = paint.style;
|
|
10795
|
+
}
|
|
10700
10796
|
if (paint.blendMode)
|
|
10701
10797
|
data.blendMode = paint.blendMode;
|
|
10702
10798
|
}
|
|
@@ -10716,8 +10812,8 @@ const PaintModule = {
|
|
|
10716
10812
|
shape
|
|
10717
10813
|
};
|
|
10718
10814
|
|
|
10719
|
-
let origin = {};
|
|
10720
|
-
const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, scale: scaleHelper, rotate, skew: skewHelper } = MatrixHelper;
|
|
10815
|
+
let origin = {}, tempMatrix = getMatrixData();
|
|
10816
|
+
const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent, scale: scaleHelper, rotate, skew: skewHelper } = MatrixHelper;
|
|
10721
10817
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
10722
10818
|
const transform = get$3();
|
|
10723
10819
|
translate$1(transform, box.x + x, box.y + y);
|
|
@@ -10726,7 +10822,7 @@ function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
|
10726
10822
|
rotateOfOuter$1(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
|
|
10727
10823
|
data.transform = transform;
|
|
10728
10824
|
}
|
|
10729
|
-
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew) {
|
|
10825
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipSize) {
|
|
10730
10826
|
const transform = get$3();
|
|
10731
10827
|
if (rotation)
|
|
10732
10828
|
rotate(transform, rotation);
|
|
@@ -10735,6 +10831,10 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew) {
|
|
|
10735
10831
|
if (scaleX)
|
|
10736
10832
|
scaleHelper(transform, scaleX, scaleY);
|
|
10737
10833
|
translate$1(transform, box.x + x, box.y + y);
|
|
10834
|
+
if (clipSize) {
|
|
10835
|
+
tempMatrix.a = box.width / clipSize.width, tempMatrix.d = box.height / clipSize.height;
|
|
10836
|
+
multiplyParent(transform, tempMatrix);
|
|
10837
|
+
}
|
|
10738
10838
|
data.transform = transform;
|
|
10739
10839
|
}
|
|
10740
10840
|
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
|
|
@@ -10771,13 +10871,15 @@ const tempBox = new Bounds();
|
|
|
10771
10871
|
const tempScaleData = {};
|
|
10772
10872
|
const tempImage = {};
|
|
10773
10873
|
function createData(leafPaint, image, paint, box) {
|
|
10774
|
-
const { changeful, sync, editing } = paint;
|
|
10874
|
+
const { changeful, sync, editing, scaleFixed } = paint;
|
|
10775
10875
|
if (changeful)
|
|
10776
10876
|
leafPaint.changeful = changeful;
|
|
10777
10877
|
if (sync)
|
|
10778
10878
|
leafPaint.sync = sync;
|
|
10779
10879
|
if (editing)
|
|
10780
10880
|
leafPaint.editing = editing;
|
|
10881
|
+
if (scaleFixed)
|
|
10882
|
+
leafPaint.scaleFixed = scaleFixed;
|
|
10781
10883
|
leafPaint.data = getPatternData(paint, box, image);
|
|
10782
10884
|
}
|
|
10783
10885
|
function getPatternData(paint, box, image) {
|
|
@@ -10786,7 +10888,7 @@ function getPatternData(paint, box, image) {
|
|
|
10786
10888
|
if (paint.mode === 'strench')
|
|
10787
10889
|
paint.mode = 'stretch';
|
|
10788
10890
|
let { width, height } = image;
|
|
10789
|
-
const { opacity, mode, align, offset, scale, size, rotation, skew, repeat, filters } = paint;
|
|
10891
|
+
const { opacity, mode, align, offset, scale, size, rotation, skew, clipSize, repeat, filters } = paint;
|
|
10790
10892
|
const sameBox = box.width === width && box.height === height;
|
|
10791
10893
|
const data = { mode };
|
|
10792
10894
|
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
@@ -10820,8 +10922,8 @@ function getPatternData(paint, box, image) {
|
|
|
10820
10922
|
break;
|
|
10821
10923
|
case 'normal':
|
|
10822
10924
|
case 'clip':
|
|
10823
|
-
if (tempImage.x || tempImage.y || scaleX || rotation || skew)
|
|
10824
|
-
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew);
|
|
10925
|
+
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
|
|
10926
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, paint.clipSize);
|
|
10825
10927
|
break;
|
|
10826
10928
|
case 'repeat':
|
|
10827
10929
|
if (!sameBox || scaleX || rotation)
|
|
@@ -10958,18 +11060,16 @@ function ignoreRender(ui, value) {
|
|
|
10958
11060
|
}
|
|
10959
11061
|
|
|
10960
11062
|
const { get: get$1, scale, copy: copy$1 } = MatrixHelper;
|
|
10961
|
-
const { ceil, abs
|
|
11063
|
+
const { ceil, abs } = Math;
|
|
10962
11064
|
function createPattern(ui, paint, pixelRatio) {
|
|
10963
|
-
let { scaleX, scaleY } =
|
|
11065
|
+
let { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
10964
11066
|
const id = scaleX + '-' + scaleY + '-' + pixelRatio;
|
|
10965
11067
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
10966
|
-
scaleX = abs$1(scaleX);
|
|
10967
|
-
scaleY = abs$1(scaleY);
|
|
10968
11068
|
const { image, data } = paint;
|
|
10969
11069
|
let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
|
|
10970
11070
|
if (sx) {
|
|
10971
|
-
sx = abs
|
|
10972
|
-
sy = abs
|
|
11071
|
+
sx = abs(sx);
|
|
11072
|
+
sy = abs(sy);
|
|
10973
11073
|
imageMatrix = get$1();
|
|
10974
11074
|
copy$1(imageMatrix, transform);
|
|
10975
11075
|
scale(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -11022,9 +11122,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
11022
11122
|
}
|
|
11023
11123
|
}
|
|
11024
11124
|
|
|
11025
|
-
const { abs } = Math;
|
|
11026
11125
|
function checkImage(ui, canvas, paint, allowDraw) {
|
|
11027
|
-
const { scaleX, scaleY } =
|
|
11126
|
+
const { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
11028
11127
|
const { pixelRatio } = canvas, { data } = paint;
|
|
11029
11128
|
if (!data || (paint.patternId === scaleX + '-' + scaleY + '-' + pixelRatio && !Export.running)) {
|
|
11030
11129
|
return false;
|
|
@@ -11037,8 +11136,8 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
11037
11136
|
else {
|
|
11038
11137
|
if (!(paint.changeful || ResizeEvent.isResizing(ui) || Export.running)) {
|
|
11039
11138
|
let { width, height } = data;
|
|
11040
|
-
width *=
|
|
11041
|
-
height *=
|
|
11139
|
+
width *= scaleX * pixelRatio;
|
|
11140
|
+
height *= scaleY * pixelRatio;
|
|
11042
11141
|
if (data.scaleX) {
|
|
11043
11142
|
width *= data.scaleX;
|
|
11044
11143
|
height *= data.scaleY;
|
|
@@ -11048,6 +11147,10 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
11048
11147
|
}
|
|
11049
11148
|
}
|
|
11050
11149
|
if (allowDraw) {
|
|
11150
|
+
if (ui.__.__isFastShadow) {
|
|
11151
|
+
canvas.fillStyle = paint.style || '#000';
|
|
11152
|
+
canvas.fill();
|
|
11153
|
+
}
|
|
11051
11154
|
drawImage(ui, canvas, paint, data);
|
|
11052
11155
|
return true;
|
|
11053
11156
|
}
|
|
@@ -11236,10 +11339,7 @@ function shadow(ui, current, shape) {
|
|
|
11236
11339
|
}
|
|
11237
11340
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
|
|
11238
11341
|
}
|
|
11239
|
-
|
|
11240
|
-
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
11241
|
-
else
|
|
11242
|
-
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
11342
|
+
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
11243
11343
|
if (end && index < end)
|
|
11244
11344
|
other.clearWorld(copyBounds, true);
|
|
11245
11345
|
});
|
|
@@ -11298,10 +11398,7 @@ function innerShadow(ui, current, shape) {
|
|
|
11298
11398
|
copyBounds = bounds;
|
|
11299
11399
|
}
|
|
11300
11400
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
|
|
11301
|
-
|
|
11302
|
-
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
11303
|
-
else
|
|
11304
|
-
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
11401
|
+
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
11305
11402
|
if (end && index < end)
|
|
11306
11403
|
other.clearWorld(copyBounds, true);
|
|
11307
11404
|
});
|
|
@@ -11357,12 +11454,11 @@ Group.prototype.__renderMask = function (canvas, options) {
|
|
|
11357
11454
|
contentCanvas = getCanvas(canvas);
|
|
11358
11455
|
child.__render(maskCanvas, options);
|
|
11359
11456
|
}
|
|
11360
|
-
if (
|
|
11361
|
-
|
|
11362
|
-
}
|
|
11363
|
-
if (excludeRenderBounds(child, options))
|
|
11457
|
+
if (mask === 'clipping' || mask === 'clipping-path')
|
|
11458
|
+
excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
11364
11459
|
continue;
|
|
11365
|
-
|
|
11460
|
+
}
|
|
11461
|
+
excludeRenderBounds(child, options) || child.__render(contentCanvas || canvas, options);
|
|
11366
11462
|
}
|
|
11367
11463
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
|
|
11368
11464
|
};
|
|
@@ -11949,4 +12045,4 @@ Object.assign(Creator, {
|
|
|
11949
12045
|
});
|
|
11950
12046
|
useCanvas();
|
|
11951
12047
|
|
|
11952
|
-
export { AlignHelper, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isEmptyData, isNull, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$2 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };
|
|
12048
|
+
export { AlignHelper, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isEmptyData, isNull, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$2 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };
|