@leafer-draw/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 +230 -134
- 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 +228 -134
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +9 -9
package/dist/worker.module.js
CHANGED
|
@@ -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$8, multiplyParent: multiplyParent$
|
|
2079
|
+
const { copy: copy$8, 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$6, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$
|
|
4289
|
+
const { copy: copy$6, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$3, divideParent, getLayout } = MatrixHelper;
|
|
4269
4290
|
const matrix = {}, { 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$6(matrix, t.worldTransform);
|
|
4399
|
-
multiplyParent$
|
|
4428
|
+
multiplyParent$3(matrix, transform);
|
|
4400
4429
|
if (t.parent)
|
|
4401
4430
|
divideParent(matrix, t.parent.worldTransform);
|
|
4402
4431
|
L.setTransform(t, matrix, resize, transition);
|
|
4403
4432
|
},
|
|
4404
4433
|
transform(t, transform, resize, transition) {
|
|
4405
4434
|
copy$6(matrix, t.localTransform);
|
|
4406
|
-
multiplyParent$
|
|
4435
|
+
multiplyParent$3(matrix, transform);
|
|
4407
4436
|
L.setTransform(t, matrix, 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$3, 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; }
|
|
@@ -6939,6 +6979,11 @@ function zoomLayerType() {
|
|
|
6939
6979
|
});
|
|
6940
6980
|
};
|
|
6941
6981
|
}
|
|
6982
|
+
function createAttr(defaultValue) {
|
|
6983
|
+
return (target, key) => {
|
|
6984
|
+
defineKey(target, key, createDescriptor(key, defaultValue));
|
|
6985
|
+
};
|
|
6986
|
+
}
|
|
6942
6987
|
|
|
6943
6988
|
function hasTransparent$3(color) {
|
|
6944
6989
|
if (!color || color.length === 7 || color.length === 4)
|
|
@@ -6996,22 +7041,9 @@ const emptyPaint = {};
|
|
|
6996
7041
|
const debug$1 = Debug.get('UIData');
|
|
6997
7042
|
class UIData extends LeafData {
|
|
6998
7043
|
get scale() { const { scaleX, scaleY } = this; return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX; }
|
|
6999
|
-
get __strokeWidth() {
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
const ui = this.__leaf;
|
|
7003
|
-
let { scaleX } = ui.__nowWorld || ui.__world;
|
|
7004
|
-
if (scaleX < 0)
|
|
7005
|
-
scaleX = -scaleX;
|
|
7006
|
-
return scaleX > 1 ? strokeWidth / scaleX : strokeWidth;
|
|
7007
|
-
}
|
|
7008
|
-
else
|
|
7009
|
-
return strokeWidth;
|
|
7010
|
-
}
|
|
7011
|
-
get __hasMultiPaint() {
|
|
7012
|
-
const t = this;
|
|
7013
|
-
return (t.fill && this.__useStroke) || (t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect;
|
|
7014
|
-
}
|
|
7044
|
+
get __strokeWidth() { return this.__getRealStrokeWidth(); }
|
|
7045
|
+
get __maxStrokeWidth() { const t = this; return t.__hasMultiStrokeStyle ? Math.max(t.__hasMultiStrokeStyle, t.strokeWidth) : t.strokeWidth; }
|
|
7046
|
+
get __hasMultiPaint() { const t = this; return (t.fill && this.__useStroke) || (t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect; }
|
|
7015
7047
|
get __clipAfterFill() { const t = this; return (t.cornerRadius || t.innerShadow || t.__pathInputed); }
|
|
7016
7048
|
get __hasSurface() { const t = this; return (t.fill || t.stroke); }
|
|
7017
7049
|
get __autoWidth() { return !this._width; }
|
|
@@ -7093,6 +7125,21 @@ class UIData extends LeafData {
|
|
|
7093
7125
|
Paint.compute('stroke', this.__leaf);
|
|
7094
7126
|
this.__needComputePaint = undefined;
|
|
7095
7127
|
}
|
|
7128
|
+
__getRealStrokeWidth(childStyle) {
|
|
7129
|
+
let { strokeWidth, strokeWidthFixed } = this;
|
|
7130
|
+
if (childStyle) {
|
|
7131
|
+
if (childStyle.strokeWidth)
|
|
7132
|
+
strokeWidth = childStyle.strokeWidth;
|
|
7133
|
+
if (childStyle.strokeWidthFixed !== undefined)
|
|
7134
|
+
strokeWidthFixed = childStyle.strokeWidthFixed;
|
|
7135
|
+
}
|
|
7136
|
+
if (strokeWidthFixed) {
|
|
7137
|
+
const scale = this.__leaf.getClampRenderScale();
|
|
7138
|
+
return scale > 1 ? strokeWidth / scale : strokeWidth;
|
|
7139
|
+
}
|
|
7140
|
+
else
|
|
7141
|
+
return strokeWidth;
|
|
7142
|
+
}
|
|
7096
7143
|
__setPaint(attrName, value) {
|
|
7097
7144
|
this.__setInput(attrName, value);
|
|
7098
7145
|
const layout = this.__leaf.__layout;
|
|
@@ -7117,6 +7164,7 @@ class UIData extends LeafData {
|
|
|
7117
7164
|
}
|
|
7118
7165
|
else {
|
|
7119
7166
|
stintSet$2(this, '__isAlphaPixelStroke', undefined);
|
|
7167
|
+
stintSet$2(this, '__hasMultiStrokeStyle', undefined);
|
|
7120
7168
|
this._stroke = this.__isStrokes = undefined;
|
|
7121
7169
|
}
|
|
7122
7170
|
}
|
|
@@ -7138,8 +7186,8 @@ class GroupData extends UIData {
|
|
|
7138
7186
|
|
|
7139
7187
|
class BoxData extends GroupData {
|
|
7140
7188
|
get __boxStroke() { return !this.__pathInputed; }
|
|
7141
|
-
get __drawAfterFill() { const t = this; return
|
|
7142
|
-
get __clipAfterFill() { return
|
|
7189
|
+
get __drawAfterFill() { const t = this; return t.__single || t.__clipAfterFill; }
|
|
7190
|
+
get __clipAfterFill() { const t = this; return t.overflow === 'hide' && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill); }
|
|
7143
7191
|
}
|
|
7144
7192
|
|
|
7145
7193
|
class LeaferData extends GroupData {
|
|
@@ -7259,7 +7307,7 @@ class CanvasData extends RectData {
|
|
|
7259
7307
|
const UIBounds = {
|
|
7260
7308
|
__updateStrokeSpread() {
|
|
7261
7309
|
let width = 0, boxWidth = 0;
|
|
7262
|
-
const data = this.__, { strokeAlign, strokeWidth } = data, box = this.__box;
|
|
7310
|
+
const data = this.__, { strokeAlign, __maxStrokeWidth: strokeWidth } = data, box = this.__box;
|
|
7263
7311
|
if ((data.stroke || data.hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
|
|
7264
7312
|
boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth;
|
|
7265
7313
|
if (!data.__boxStroke) {
|
|
@@ -7279,13 +7327,15 @@ const UIBounds = {
|
|
|
7279
7327
|
},
|
|
7280
7328
|
__updateRenderSpread() {
|
|
7281
7329
|
let width = 0;
|
|
7282
|
-
const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
|
|
7330
|
+
const { shadow, innerShadow, blur, backgroundBlur, filter, renderSpread } = this.__;
|
|
7283
7331
|
if (shadow)
|
|
7284
7332
|
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));
|
|
7285
7333
|
if (blur)
|
|
7286
7334
|
width = Math.max(width, blur);
|
|
7287
7335
|
if (filter)
|
|
7288
7336
|
width += Filter.getSpread(filter);
|
|
7337
|
+
if (renderSpread)
|
|
7338
|
+
width += renderSpread;
|
|
7289
7339
|
let shapeWidth = width = Math.ceil(width);
|
|
7290
7340
|
if (innerShadow)
|
|
7291
7341
|
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));
|
|
@@ -7308,7 +7358,7 @@ const UIRender = {
|
|
|
7308
7358
|
}
|
|
7309
7359
|
if (data.__useEffect) {
|
|
7310
7360
|
const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
7311
|
-
stintSet$1(data, '__isFastShadow', shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread &&
|
|
7361
|
+
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')));
|
|
7312
7362
|
data.__useEffect = !!(shadow || otherEffect);
|
|
7313
7363
|
}
|
|
7314
7364
|
data.__checkSingle();
|
|
@@ -7415,17 +7465,17 @@ const RectRender = {
|
|
|
7415
7465
|
if (__drawAfterFill)
|
|
7416
7466
|
this.__drawAfterFill(canvas, options);
|
|
7417
7467
|
if (stroke) {
|
|
7418
|
-
const { strokeAlign, __strokeWidth } = this.__;
|
|
7419
|
-
if (!
|
|
7468
|
+
const { strokeAlign, __strokeWidth: strokeWidth } = this.__;
|
|
7469
|
+
if (!strokeWidth)
|
|
7420
7470
|
return;
|
|
7421
|
-
canvas.setStroke(stroke,
|
|
7422
|
-
const half =
|
|
7471
|
+
canvas.setStroke(stroke, strokeWidth, this.__);
|
|
7472
|
+
const half = strokeWidth / 2;
|
|
7423
7473
|
switch (strokeAlign) {
|
|
7424
7474
|
case 'center':
|
|
7425
7475
|
canvas.strokeRect(0, 0, width, height);
|
|
7426
7476
|
break;
|
|
7427
7477
|
case 'inside':
|
|
7428
|
-
width -=
|
|
7478
|
+
width -= strokeWidth, height -= strokeWidth;
|
|
7429
7479
|
if (width < 0 || height < 0) {
|
|
7430
7480
|
canvas.save();
|
|
7431
7481
|
this.__clip(canvas, options);
|
|
@@ -7436,7 +7486,7 @@ const RectRender = {
|
|
|
7436
7486
|
canvas.strokeRect(x + half, y + half, width, height);
|
|
7437
7487
|
break;
|
|
7438
7488
|
case 'outside':
|
|
7439
|
-
canvas.strokeRect(x - half, y - half, width +
|
|
7489
|
+
canvas.strokeRect(x - half, y - half, width + strokeWidth, height + strokeWidth);
|
|
7440
7490
|
break;
|
|
7441
7491
|
}
|
|
7442
7492
|
}
|
|
@@ -7449,6 +7499,8 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7449
7499
|
get isFrame() { return false; }
|
|
7450
7500
|
set scale(value) { MathHelper.assignScale(this, value); }
|
|
7451
7501
|
get scale() { return this.__.scale; }
|
|
7502
|
+
get isAutoWidth() { const t = this.__; return t.__autoWidth || t.autoWidth; }
|
|
7503
|
+
get isAutoHeight() { const t = this.__; return t.__autoHeight || t.autoHeight; }
|
|
7452
7504
|
get pen() {
|
|
7453
7505
|
const { path } = this.__;
|
|
7454
7506
|
pen.set(this.path = path || []);
|
|
@@ -7663,6 +7715,9 @@ __decorate([
|
|
|
7663
7715
|
__decorate([
|
|
7664
7716
|
naturalBoundsType(1)
|
|
7665
7717
|
], UI.prototype, "pixelRatio", void 0);
|
|
7718
|
+
__decorate([
|
|
7719
|
+
affectRenderBoundsType(0)
|
|
7720
|
+
], UI.prototype, "renderSpread", void 0);
|
|
7666
7721
|
__decorate([
|
|
7667
7722
|
pathInputType()
|
|
7668
7723
|
], UI.prototype, "path", void 0);
|
|
@@ -7819,7 +7874,8 @@ let Group = class Group extends UI {
|
|
|
7819
7874
|
}
|
|
7820
7875
|
toJSON(options) {
|
|
7821
7876
|
const data = super.toJSON(options);
|
|
7822
|
-
|
|
7877
|
+
if (!this.childlessJSON)
|
|
7878
|
+
data.children = this.children.map(child => child.toJSON(options));
|
|
7823
7879
|
return data;
|
|
7824
7880
|
}
|
|
7825
7881
|
pick(_hitPoint, _options) { return undefined; }
|
|
@@ -8266,8 +8322,8 @@ let Box = class Box extends Group {
|
|
|
8266
8322
|
__updateRenderSpread() { return this.__updateRectRenderSpread() || -1; }
|
|
8267
8323
|
__updateRectBoxBounds() { }
|
|
8268
8324
|
__updateBoxBounds(_secondLayout) {
|
|
8269
|
-
const data = this.__;
|
|
8270
8325
|
if (this.children.length && !this.pathInputed) {
|
|
8326
|
+
const data = this.__;
|
|
8271
8327
|
if (data.__autoSide) {
|
|
8272
8328
|
if (data.__hasSurface)
|
|
8273
8329
|
this.__extraUpdate();
|
|
@@ -8294,20 +8350,26 @@ let Box = class Box extends Group {
|
|
|
8294
8350
|
__updateStrokeBounds() { }
|
|
8295
8351
|
__updateRenderBounds() {
|
|
8296
8352
|
let isOverflow;
|
|
8297
|
-
const { renderBounds } = this.__layout;
|
|
8298
8353
|
if (this.children.length) {
|
|
8354
|
+
const data = this.__, { renderBounds, boxBounds } = this.__layout;
|
|
8299
8355
|
super.__updateRenderBounds();
|
|
8300
8356
|
copy$2(childrenRenderBounds, renderBounds);
|
|
8301
8357
|
this.__updateRectRenderBounds();
|
|
8302
|
-
|
|
8303
|
-
|
|
8358
|
+
if (data.scrollY || data.scrollX) {
|
|
8359
|
+
childrenRenderBounds.x += data.scrollX;
|
|
8360
|
+
childrenRenderBounds.y += data.scrollY;
|
|
8361
|
+
}
|
|
8362
|
+
isOverflow = !includes$1(boxBounds, childrenRenderBounds);
|
|
8363
|
+
if (isOverflow && data.overflow !== 'hide')
|
|
8304
8364
|
add(renderBounds, childrenRenderBounds);
|
|
8305
8365
|
}
|
|
8306
8366
|
else
|
|
8307
8367
|
this.__updateRectRenderBounds();
|
|
8308
8368
|
DataHelper.stintSet(this, 'isOverflow', isOverflow);
|
|
8369
|
+
this.__updateScrollBar();
|
|
8309
8370
|
}
|
|
8310
8371
|
__updateRectRenderBounds() { }
|
|
8372
|
+
__updateScrollBar() { }
|
|
8311
8373
|
__updateRectChange() { }
|
|
8312
8374
|
__updateChange() {
|
|
8313
8375
|
super.__updateChange();
|
|
@@ -8324,10 +8386,12 @@ let Box = class Box extends Group {
|
|
|
8324
8386
|
if (this.children.length)
|
|
8325
8387
|
this.__renderGroup(canvas, options);
|
|
8326
8388
|
}
|
|
8389
|
+
if (this.scrollBar)
|
|
8390
|
+
this.scrollBar.__render(canvas, options);
|
|
8327
8391
|
}
|
|
8328
8392
|
__drawContent(canvas, options) {
|
|
8329
8393
|
this.__renderGroup(canvas, options);
|
|
8330
|
-
if (this.__.__useStroke) {
|
|
8394
|
+
if (this.__.__useStroke || this.__.__useEffect) {
|
|
8331
8395
|
canvas.setWorld(this.__nowWorld);
|
|
8332
8396
|
this.__drawRenderPath(canvas);
|
|
8333
8397
|
}
|
|
@@ -8986,9 +9050,14 @@ function fills(fills, ui, canvas) {
|
|
|
8986
9050
|
}
|
|
8987
9051
|
}
|
|
8988
9052
|
canvas.fillStyle = item.style;
|
|
8989
|
-
if (item.transform) {
|
|
9053
|
+
if (item.transform || item.scaleFixed) {
|
|
8990
9054
|
canvas.save();
|
|
8991
|
-
|
|
9055
|
+
if (item.transform)
|
|
9056
|
+
canvas.transform(item.transform);
|
|
9057
|
+
if (item.scaleFixed) {
|
|
9058
|
+
const { scaleX, scaleY } = ui.getRenderScaleData(true);
|
|
9059
|
+
canvas.scale(1 / scaleX, 1 / scaleY);
|
|
9060
|
+
}
|
|
8992
9061
|
if (item.blendMode)
|
|
8993
9062
|
canvas.blendMode = item.blendMode;
|
|
8994
9063
|
fillPathOrText(ui, canvas);
|
|
@@ -9024,8 +9093,13 @@ function strokeText(stroke, ui, canvas) {
|
|
|
9024
9093
|
}
|
|
9025
9094
|
function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
|
|
9026
9095
|
const data = ui.__;
|
|
9027
|
-
|
|
9028
|
-
|
|
9096
|
+
if (typeof stroke === 'object') {
|
|
9097
|
+
drawStrokesStyle(stroke, strokeWidthScale, true, ui, canvas);
|
|
9098
|
+
}
|
|
9099
|
+
else {
|
|
9100
|
+
canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
9101
|
+
drawTextStroke(ui, canvas);
|
|
9102
|
+
}
|
|
9029
9103
|
}
|
|
9030
9104
|
function drawAlign(stroke, align, ui, canvas) {
|
|
9031
9105
|
const out = canvas.getSameCanvas(true, true);
|
|
@@ -9034,15 +9108,9 @@ function drawAlign(stroke, align, ui, canvas) {
|
|
|
9034
9108
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
9035
9109
|
fillText(ui, out);
|
|
9036
9110
|
out.blendMode = 'normal';
|
|
9037
|
-
|
|
9111
|
+
LeafHelper.copyCanvasByWorld(ui, canvas, out);
|
|
9038
9112
|
out.recycle(ui.__nowWorld);
|
|
9039
9113
|
}
|
|
9040
|
-
function copyWorld(canvas, out, ui) {
|
|
9041
|
-
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
9042
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9043
|
-
else
|
|
9044
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
9045
|
-
}
|
|
9046
9114
|
function drawTextStroke(ui, canvas) {
|
|
9047
9115
|
let row, data = ui.__.__textDrawData;
|
|
9048
9116
|
const { rows, decorationY } = data;
|
|
@@ -9058,14 +9126,21 @@ function drawTextStroke(ui, canvas) {
|
|
|
9058
9126
|
rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
9059
9127
|
}
|
|
9060
9128
|
}
|
|
9061
|
-
function drawStrokesStyle(strokes, isText, ui, canvas) {
|
|
9129
|
+
function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas) {
|
|
9062
9130
|
let item;
|
|
9131
|
+
const data = ui.__, { __hasMultiStrokeStyle } = data;
|
|
9132
|
+
__hasMultiStrokeStyle || canvas.setStroke(undefined, data.__strokeWidth * strokeWidthScale, data);
|
|
9063
9133
|
for (let i = 0, len = strokes.length; i < len; i++) {
|
|
9064
9134
|
item = strokes[i];
|
|
9065
9135
|
if (item.image && PaintImage.checkImage(ui, canvas, item, false))
|
|
9066
9136
|
continue;
|
|
9067
9137
|
if (item.style) {
|
|
9068
|
-
|
|
9138
|
+
if (__hasMultiStrokeStyle) {
|
|
9139
|
+
const { strokeStyle } = item;
|
|
9140
|
+
strokeStyle ? canvas.setStroke(item.style, data.__getRealStrokeWidth(strokeStyle) * strokeWidthScale, data, strokeStyle) : canvas.setStroke(item.style, data.__strokeWidth * strokeWidthScale, data);
|
|
9141
|
+
}
|
|
9142
|
+
else
|
|
9143
|
+
canvas.strokeStyle = item.style;
|
|
9069
9144
|
if (item.blendMode) {
|
|
9070
9145
|
canvas.saveBlendMode(item.blendMode);
|
|
9071
9146
|
isText ? drawTextStroke(ui, canvas) : canvas.stroke();
|
|
@@ -9104,8 +9179,13 @@ function strokes(strokes, ui, canvas) {
|
|
|
9104
9179
|
}
|
|
9105
9180
|
function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
9106
9181
|
const data = ui.__;
|
|
9107
|
-
|
|
9108
|
-
|
|
9182
|
+
if (typeof stroke === 'object') {
|
|
9183
|
+
drawStrokesStyle(stroke, strokeWidthScale, false, ui, canvas);
|
|
9184
|
+
}
|
|
9185
|
+
else {
|
|
9186
|
+
canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
9187
|
+
canvas.stroke();
|
|
9188
|
+
}
|
|
9109
9189
|
if (data.__useArrow)
|
|
9110
9190
|
Paint.strokeArrow(stroke, ui, canvas);
|
|
9111
9191
|
}
|
|
@@ -9127,7 +9207,7 @@ function drawOutside(stroke, ui, canvas) {
|
|
|
9127
9207
|
drawCenter(stroke, 2, ui, out);
|
|
9128
9208
|
out.clipUI(data);
|
|
9129
9209
|
out.clearWorld(renderBounds);
|
|
9130
|
-
|
|
9210
|
+
LeafHelper.copyCanvasByWorld(ui, canvas, out);
|
|
9131
9211
|
out.recycle(ui.__nowWorld);
|
|
9132
9212
|
}
|
|
9133
9213
|
}
|
|
@@ -9182,8 +9262,16 @@ function compute(attrName, ui) {
|
|
|
9182
9262
|
if (!(paints instanceof Array))
|
|
9183
9263
|
paints = [paints];
|
|
9184
9264
|
recycleMap = PaintImage.recycleImage(attrName, data);
|
|
9265
|
+
let maxChildStrokeWidth;
|
|
9185
9266
|
for (let i = 0, len = paints.length, item; i < len; i++) {
|
|
9186
|
-
(item = getLeafPaint(attrName, paints[i], ui))
|
|
9267
|
+
if (item = getLeafPaint(attrName, paints[i], ui)) {
|
|
9268
|
+
leafPaints.push(item);
|
|
9269
|
+
if (item.strokeStyle) {
|
|
9270
|
+
maxChildStrokeWidth || (maxChildStrokeWidth = 1);
|
|
9271
|
+
if (item.strokeStyle.strokeWidth)
|
|
9272
|
+
maxChildStrokeWidth = Math.max(maxChildStrokeWidth, item.strokeStyle.strokeWidth);
|
|
9273
|
+
}
|
|
9274
|
+
}
|
|
9187
9275
|
}
|
|
9188
9276
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
9189
9277
|
if (leafPaints.length) {
|
|
@@ -9200,6 +9288,7 @@ function compute(attrName, ui) {
|
|
|
9200
9288
|
else {
|
|
9201
9289
|
stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
|
|
9202
9290
|
stintSet(data, '__isTransparentStroke', isTransparent);
|
|
9291
|
+
stintSet(data, '__hasMultiStrokeStyle', maxChildStrokeWidth);
|
|
9203
9292
|
}
|
|
9204
9293
|
}
|
|
9205
9294
|
function getLeafPaint(attrName, paint, ui) {
|
|
@@ -9231,6 +9320,11 @@ function getLeafPaint(attrName, paint, ui) {
|
|
|
9231
9320
|
if (data) {
|
|
9232
9321
|
if (typeof data.style === 'string' && hasTransparent$1(data.style))
|
|
9233
9322
|
data.isTransparent = true;
|
|
9323
|
+
if (paint.style) {
|
|
9324
|
+
if (paint.style.strokeWidth === 0)
|
|
9325
|
+
return undefined;
|
|
9326
|
+
data.strokeStyle = paint.style;
|
|
9327
|
+
}
|
|
9234
9328
|
if (paint.blendMode)
|
|
9235
9329
|
data.blendMode = paint.blendMode;
|
|
9236
9330
|
}
|
|
@@ -9250,8 +9344,8 @@ const PaintModule = {
|
|
|
9250
9344
|
shape
|
|
9251
9345
|
};
|
|
9252
9346
|
|
|
9253
|
-
let origin = {};
|
|
9254
|
-
const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, scale: scaleHelper, rotate, skew: skewHelper } = MatrixHelper;
|
|
9347
|
+
let origin = {}, tempMatrix = getMatrixData();
|
|
9348
|
+
const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent, scale: scaleHelper, rotate, skew: skewHelper } = MatrixHelper;
|
|
9255
9349
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
9256
9350
|
const transform = get$3();
|
|
9257
9351
|
translate$1(transform, box.x + x, box.y + y);
|
|
@@ -9260,7 +9354,7 @@ function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
|
9260
9354
|
rotateOfOuter$1(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
|
|
9261
9355
|
data.transform = transform;
|
|
9262
9356
|
}
|
|
9263
|
-
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew) {
|
|
9357
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipSize) {
|
|
9264
9358
|
const transform = get$3();
|
|
9265
9359
|
if (rotation)
|
|
9266
9360
|
rotate(transform, rotation);
|
|
@@ -9269,6 +9363,10 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew) {
|
|
|
9269
9363
|
if (scaleX)
|
|
9270
9364
|
scaleHelper(transform, scaleX, scaleY);
|
|
9271
9365
|
translate$1(transform, box.x + x, box.y + y);
|
|
9366
|
+
if (clipSize) {
|
|
9367
|
+
tempMatrix.a = box.width / clipSize.width, tempMatrix.d = box.height / clipSize.height;
|
|
9368
|
+
multiplyParent(transform, tempMatrix);
|
|
9369
|
+
}
|
|
9272
9370
|
data.transform = transform;
|
|
9273
9371
|
}
|
|
9274
9372
|
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
|
|
@@ -9305,13 +9403,15 @@ const tempBox = new Bounds();
|
|
|
9305
9403
|
const tempScaleData = {};
|
|
9306
9404
|
const tempImage = {};
|
|
9307
9405
|
function createData(leafPaint, image, paint, box) {
|
|
9308
|
-
const { changeful, sync, editing } = paint;
|
|
9406
|
+
const { changeful, sync, editing, scaleFixed } = paint;
|
|
9309
9407
|
if (changeful)
|
|
9310
9408
|
leafPaint.changeful = changeful;
|
|
9311
9409
|
if (sync)
|
|
9312
9410
|
leafPaint.sync = sync;
|
|
9313
9411
|
if (editing)
|
|
9314
9412
|
leafPaint.editing = editing;
|
|
9413
|
+
if (scaleFixed)
|
|
9414
|
+
leafPaint.scaleFixed = scaleFixed;
|
|
9315
9415
|
leafPaint.data = getPatternData(paint, box, image);
|
|
9316
9416
|
}
|
|
9317
9417
|
function getPatternData(paint, box, image) {
|
|
@@ -9320,7 +9420,7 @@ function getPatternData(paint, box, image) {
|
|
|
9320
9420
|
if (paint.mode === 'strench')
|
|
9321
9421
|
paint.mode = 'stretch';
|
|
9322
9422
|
let { width, height } = image;
|
|
9323
|
-
const { opacity, mode, align, offset, scale, size, rotation, skew, repeat, filters } = paint;
|
|
9423
|
+
const { opacity, mode, align, offset, scale, size, rotation, skew, clipSize, repeat, filters } = paint;
|
|
9324
9424
|
const sameBox = box.width === width && box.height === height;
|
|
9325
9425
|
const data = { mode };
|
|
9326
9426
|
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
@@ -9354,8 +9454,8 @@ function getPatternData(paint, box, image) {
|
|
|
9354
9454
|
break;
|
|
9355
9455
|
case 'normal':
|
|
9356
9456
|
case 'clip':
|
|
9357
|
-
if (tempImage.x || tempImage.y || scaleX || rotation || skew)
|
|
9358
|
-
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew);
|
|
9457
|
+
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
|
|
9458
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, paint.clipSize);
|
|
9359
9459
|
break;
|
|
9360
9460
|
case 'repeat':
|
|
9361
9461
|
if (!sameBox || scaleX || rotation)
|
|
@@ -9492,18 +9592,16 @@ function ignoreRender(ui, value) {
|
|
|
9492
9592
|
}
|
|
9493
9593
|
|
|
9494
9594
|
const { get: get$1, scale, copy: copy$1 } = MatrixHelper;
|
|
9495
|
-
const { ceil, abs
|
|
9595
|
+
const { ceil, abs } = Math;
|
|
9496
9596
|
function createPattern(ui, paint, pixelRatio) {
|
|
9497
|
-
let { scaleX, scaleY } =
|
|
9597
|
+
let { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
9498
9598
|
const id = scaleX + '-' + scaleY + '-' + pixelRatio;
|
|
9499
9599
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
9500
|
-
scaleX = abs$1(scaleX);
|
|
9501
|
-
scaleY = abs$1(scaleY);
|
|
9502
9600
|
const { image, data } = paint;
|
|
9503
9601
|
let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
|
|
9504
9602
|
if (sx) {
|
|
9505
|
-
sx = abs
|
|
9506
|
-
sy = abs
|
|
9603
|
+
sx = abs(sx);
|
|
9604
|
+
sy = abs(sy);
|
|
9507
9605
|
imageMatrix = get$1();
|
|
9508
9606
|
copy$1(imageMatrix, transform);
|
|
9509
9607
|
scale(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -9556,9 +9654,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
9556
9654
|
}
|
|
9557
9655
|
}
|
|
9558
9656
|
|
|
9559
|
-
const { abs } = Math;
|
|
9560
9657
|
function checkImage(ui, canvas, paint, allowDraw) {
|
|
9561
|
-
const { scaleX, scaleY } =
|
|
9658
|
+
const { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
9562
9659
|
const { pixelRatio } = canvas, { data } = paint;
|
|
9563
9660
|
if (!data || (paint.patternId === scaleX + '-' + scaleY + '-' + pixelRatio && !Export.running)) {
|
|
9564
9661
|
return false;
|
|
@@ -9571,8 +9668,8 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
9571
9668
|
else {
|
|
9572
9669
|
if (!(paint.changeful || ResizeEvent.isResizing(ui) || Export.running)) {
|
|
9573
9670
|
let { width, height } = data;
|
|
9574
|
-
width *=
|
|
9575
|
-
height *=
|
|
9671
|
+
width *= scaleX * pixelRatio;
|
|
9672
|
+
height *= scaleY * pixelRatio;
|
|
9576
9673
|
if (data.scaleX) {
|
|
9577
9674
|
width *= data.scaleX;
|
|
9578
9675
|
height *= data.scaleY;
|
|
@@ -9582,6 +9679,10 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
9582
9679
|
}
|
|
9583
9680
|
}
|
|
9584
9681
|
if (allowDraw) {
|
|
9682
|
+
if (ui.__.__isFastShadow) {
|
|
9683
|
+
canvas.fillStyle = paint.style || '#000';
|
|
9684
|
+
canvas.fill();
|
|
9685
|
+
}
|
|
9585
9686
|
drawImage(ui, canvas, paint, data);
|
|
9586
9687
|
return true;
|
|
9587
9688
|
}
|
|
@@ -9770,10 +9871,7 @@ function shadow(ui, current, shape) {
|
|
|
9770
9871
|
}
|
|
9771
9872
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
|
|
9772
9873
|
}
|
|
9773
|
-
|
|
9774
|
-
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
9775
|
-
else
|
|
9776
|
-
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
9874
|
+
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
9777
9875
|
if (end && index < end)
|
|
9778
9876
|
other.clearWorld(copyBounds, true);
|
|
9779
9877
|
});
|
|
@@ -9832,10 +9930,7 @@ function innerShadow(ui, current, shape) {
|
|
|
9832
9930
|
copyBounds = bounds;
|
|
9833
9931
|
}
|
|
9834
9932
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
|
|
9835
|
-
|
|
9836
|
-
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
9837
|
-
else
|
|
9838
|
-
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
9933
|
+
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
9839
9934
|
if (end && index < end)
|
|
9840
9935
|
other.clearWorld(copyBounds, true);
|
|
9841
9936
|
});
|
|
@@ -9891,12 +9986,11 @@ Group.prototype.__renderMask = function (canvas, options) {
|
|
|
9891
9986
|
contentCanvas = getCanvas(canvas);
|
|
9892
9987
|
child.__render(maskCanvas, options);
|
|
9893
9988
|
}
|
|
9894
|
-
if (
|
|
9895
|
-
|
|
9896
|
-
}
|
|
9897
|
-
if (excludeRenderBounds(child, options))
|
|
9989
|
+
if (mask === 'clipping' || mask === 'clipping-path')
|
|
9990
|
+
excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
9898
9991
|
continue;
|
|
9899
|
-
|
|
9992
|
+
}
|
|
9993
|
+
excludeRenderBounds(child, options) || child.__render(contentCanvas || canvas, options);
|
|
9900
9994
|
}
|
|
9901
9995
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
|
|
9902
9996
|
};
|
|
@@ -10478,4 +10572,4 @@ Object.assign(Effect, EffectModule);
|
|
|
10478
10572
|
|
|
10479
10573
|
useCanvas();
|
|
10480
10574
|
|
|
10481
|
-
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, 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, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, 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 };
|
|
10575
|
+
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, 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, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, 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 };
|