@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.js
CHANGED
|
@@ -439,7 +439,7 @@ var LeaferUI = (function (exports) {
|
|
|
439
439
|
const M$6 = MatrixHelper;
|
|
440
440
|
|
|
441
441
|
const { toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3 } = MatrixHelper;
|
|
442
|
-
const { sin: sin$4, cos: cos$4, abs: abs$
|
|
442
|
+
const { sin: sin$4, cos: cos$4, abs: abs$3, sqrt: sqrt$2, atan2: atan2$2, min: min$1, round: round$2 } = Math;
|
|
443
443
|
const PointHelper = {
|
|
444
444
|
defaultPoint: getPointData(),
|
|
445
445
|
tempPoint: {},
|
|
@@ -534,8 +534,8 @@ var LeaferUI = (function (exports) {
|
|
|
534
534
|
return getDistanceFrom(t.x, t.y, point.x, point.y);
|
|
535
535
|
},
|
|
536
536
|
getDistanceFrom(x1, y1, x2, y2) {
|
|
537
|
-
const x = abs$
|
|
538
|
-
const y = abs$
|
|
537
|
+
const x = abs$3(x2 - x1);
|
|
538
|
+
const y = abs$3(y2 - y1);
|
|
539
539
|
return sqrt$2(x * x + y * y);
|
|
540
540
|
},
|
|
541
541
|
getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
|
|
@@ -766,7 +766,7 @@ var LeaferUI = (function (exports) {
|
|
|
766
766
|
MatrixHelper.reset(this);
|
|
767
767
|
}
|
|
768
768
|
}
|
|
769
|
-
const tempMatrix = new Matrix();
|
|
769
|
+
const tempMatrix$1 = new Matrix();
|
|
770
770
|
|
|
771
771
|
const TwoPointBoundsHelper = {
|
|
772
772
|
tempPointBounds: {},
|
|
@@ -863,6 +863,12 @@ var LeaferUI = (function (exports) {
|
|
|
863
863
|
}
|
|
864
864
|
if (!onlyBoxSize)
|
|
865
865
|
to.x += box.x, to.y += box.y;
|
|
866
|
+
},
|
|
867
|
+
getPoint(around, box, to) {
|
|
868
|
+
if (!to)
|
|
869
|
+
to = {};
|
|
870
|
+
AroundHelper.toPoint(around, box, to, true);
|
|
871
|
+
return to;
|
|
866
872
|
}
|
|
867
873
|
};
|
|
868
874
|
function get$4(around) {
|
|
@@ -1791,10 +1797,13 @@ var LeaferUI = (function (exports) {
|
|
|
1791
1797
|
return (target, key) => {
|
|
1792
1798
|
if (!realName)
|
|
1793
1799
|
realName = key;
|
|
1794
|
-
|
|
1800
|
+
const property = {
|
|
1795
1801
|
get() { return this.context[realName]; },
|
|
1796
1802
|
set(value) { this.context[realName] = value; }
|
|
1797
|
-
}
|
|
1803
|
+
};
|
|
1804
|
+
if (key === 'strokeCap')
|
|
1805
|
+
property.set = function (value) { this.context[realName] = value === 'none' ? 'butt' : value; };
|
|
1806
|
+
Object.defineProperty(target, key, property);
|
|
1798
1807
|
};
|
|
1799
1808
|
}
|
|
1800
1809
|
const contextMethodNameList = [];
|
|
@@ -2070,15 +2079,15 @@ var LeaferUI = (function (exports) {
|
|
|
2070
2079
|
contextMethod()
|
|
2071
2080
|
], Canvas.prototype, "strokeText", null);
|
|
2072
2081
|
|
|
2073
|
-
const { copy: copy$8, multiplyParent: multiplyParent$
|
|
2082
|
+
const { copy: copy$8, multiplyParent: multiplyParent$4 } = MatrixHelper, { round: round$1 } = Math;
|
|
2074
2083
|
const minSize = { width: 1, height: 1, pixelRatio: 1 };
|
|
2075
2084
|
const canvasSizeAttrs = ['width', 'height', 'pixelRatio'];
|
|
2076
2085
|
class LeaferCanvasBase extends Canvas {
|
|
2077
2086
|
get width() { return this.size.width; }
|
|
2078
2087
|
get height() { return this.size.height; }
|
|
2079
2088
|
get pixelRatio() { return this.size.pixelRatio; }
|
|
2080
|
-
get pixelWidth() { return this.width * this.pixelRatio; }
|
|
2081
|
-
get pixelHeight() { return this.height * this.pixelRatio; }
|
|
2089
|
+
get pixelWidth() { return this.width * this.pixelRatio || 0; }
|
|
2090
|
+
get pixelHeight() { return this.height * this.pixelRatio || 0; }
|
|
2082
2091
|
get pixelSnap() { return this.config.pixelSnap; }
|
|
2083
2092
|
set pixelSnap(value) { this.config.pixelSnap = value; }
|
|
2084
2093
|
get allowBackgroundColor() { return this.view && this.parentView; }
|
|
@@ -2143,7 +2152,7 @@ var LeaferUI = (function (exports) {
|
|
|
2143
2152
|
setWorld(matrix, parentMatrix) {
|
|
2144
2153
|
const { pixelRatio, pixelSnap } = this, w = this.worldTransform;
|
|
2145
2154
|
if (parentMatrix)
|
|
2146
|
-
multiplyParent$
|
|
2155
|
+
multiplyParent$4(matrix, parentMatrix, w);
|
|
2147
2156
|
w.a = matrix.a * pixelRatio;
|
|
2148
2157
|
w.b = matrix.b * pixelRatio;
|
|
2149
2158
|
w.c = matrix.c * pixelRatio;
|
|
@@ -2165,20 +2174,33 @@ var LeaferUI = (function (exports) {
|
|
|
2165
2174
|
if (w)
|
|
2166
2175
|
this.setTransform(w.a, w.b, w.c, w.d, w.e, w.f);
|
|
2167
2176
|
}
|
|
2168
|
-
setStroke(color, strokeWidth, options) {
|
|
2177
|
+
setStroke(color, strokeWidth, options, childOptions) {
|
|
2169
2178
|
if (strokeWidth)
|
|
2170
2179
|
this.strokeWidth = strokeWidth;
|
|
2171
2180
|
if (color)
|
|
2172
2181
|
this.strokeStyle = color;
|
|
2173
2182
|
if (options)
|
|
2174
|
-
this.setStrokeOptions(options);
|
|
2175
|
-
}
|
|
2176
|
-
setStrokeOptions(options) {
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2183
|
+
this.setStrokeOptions(options, childOptions);
|
|
2184
|
+
}
|
|
2185
|
+
setStrokeOptions(options, childOptions) {
|
|
2186
|
+
let { strokeCap, strokeJoin, dashPattern, dashOffset, miterLimit } = options;
|
|
2187
|
+
if (childOptions) {
|
|
2188
|
+
if (childOptions.strokeCap)
|
|
2189
|
+
strokeCap = childOptions.strokeCap;
|
|
2190
|
+
if (childOptions.strokeJoin)
|
|
2191
|
+
strokeJoin = childOptions.strokeJoin;
|
|
2192
|
+
if (childOptions.dashPattern !== undefined)
|
|
2193
|
+
dashPattern = childOptions.dashPattern;
|
|
2194
|
+
if (childOptions.dashOffset !== undefined)
|
|
2195
|
+
dashOffset = childOptions.dashOffset;
|
|
2196
|
+
if (childOptions.miterLimit)
|
|
2197
|
+
miterLimit = childOptions.miterLimit;
|
|
2198
|
+
}
|
|
2199
|
+
this.strokeCap = strokeCap;
|
|
2200
|
+
this.strokeJoin = strokeJoin;
|
|
2201
|
+
this.dashPattern = dashPattern;
|
|
2202
|
+
this.dashOffset = dashOffset;
|
|
2203
|
+
this.miterLimit = miterLimit;
|
|
2182
2204
|
}
|
|
2183
2205
|
saveBlendMode(blendMode) {
|
|
2184
2206
|
this.savedBlendMode = this.blendMode;
|
|
@@ -2412,7 +2434,7 @@ var LeaferUI = (function (exports) {
|
|
|
2412
2434
|
}
|
|
2413
2435
|
};
|
|
2414
2436
|
|
|
2415
|
-
const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$
|
|
2437
|
+
const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$2, PI: PI$2, sqrt: sqrt$1, pow } = Math;
|
|
2416
2438
|
const { setPoint: setPoint$1, addPoint: addPoint$1 } = TwoPointBoundsHelper;
|
|
2417
2439
|
const { set, toNumberPoints } = PointHelper;
|
|
2418
2440
|
const { M: M$5, L: L$6, C: C$4, Q: Q$4, Z: Z$5 } = PathCommandMap;
|
|
@@ -2487,7 +2509,7 @@ var LeaferUI = (function (exports) {
|
|
|
2487
2509
|
let totalRadian = endRadian - startRadian;
|
|
2488
2510
|
if (totalRadian < 0)
|
|
2489
2511
|
totalRadian += PI2;
|
|
2490
|
-
if (totalRadian === PI$2 || (abs$
|
|
2512
|
+
if (totalRadian === PI$2 || (abs$2(BAx + BAy) < 1.e-12) || (abs$2(CBx + CBy) < 1.e-12)) {
|
|
2491
2513
|
if (data)
|
|
2492
2514
|
data.push(L$6, x1, y1);
|
|
2493
2515
|
if (setPointBounds) {
|
|
@@ -2529,7 +2551,7 @@ var LeaferUI = (function (exports) {
|
|
|
2529
2551
|
totalRadian -= PI2;
|
|
2530
2552
|
if (anticlockwise)
|
|
2531
2553
|
totalRadian -= PI2;
|
|
2532
|
-
const parts = ceil$1(abs$
|
|
2554
|
+
const parts = ceil$1(abs$2(totalRadian / PI_2));
|
|
2533
2555
|
const partRadian = totalRadian / parts;
|
|
2534
2556
|
const partRadian4Sin = sin$3(partRadian / 4);
|
|
2535
2557
|
const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$3(partRadian / 2);
|
|
@@ -2974,7 +2996,7 @@ var LeaferUI = (function (exports) {
|
|
|
2974
2996
|
|
|
2975
2997
|
const { M: M$3, L: L$4, C: C$2, Q: Q$2, Z: Z$3, N: N$2, D: D$2, X: X$2, G: G$2, F: F$3, O: O$2, P: P$2, U: U$2 } = PathCommandMap;
|
|
2976
2998
|
const { getMinDistanceFrom, getRadianFrom } = PointHelper;
|
|
2977
|
-
const { tan, min, abs: abs$
|
|
2999
|
+
const { tan, min, abs: abs$1 } = Math;
|
|
2978
3000
|
const startPoint = {};
|
|
2979
3001
|
const PathCommandDataHelper = {
|
|
2980
3002
|
beginPath(data) {
|
|
@@ -3037,7 +3059,7 @@ var LeaferUI = (function (exports) {
|
|
|
3037
3059
|
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
|
|
3038
3060
|
if (lastX !== undefined) {
|
|
3039
3061
|
const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
|
|
3040
|
-
radius = min(radius, min(d / 2, d / 2 * abs$
|
|
3062
|
+
radius = min(radius, min(d / 2, d / 2 * abs$1(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
|
|
3041
3063
|
}
|
|
3042
3064
|
data.push(U$2, x1, y1, x2, y2, radius);
|
|
3043
3065
|
},
|
|
@@ -3913,6 +3935,13 @@ var LeaferUI = (function (exports) {
|
|
|
3913
3935
|
function getDescriptor(object, name) {
|
|
3914
3936
|
return Object.getOwnPropertyDescriptor(object, name);
|
|
3915
3937
|
}
|
|
3938
|
+
function createDescriptor(key, defaultValue) {
|
|
3939
|
+
const privateKey = '_' + key;
|
|
3940
|
+
return {
|
|
3941
|
+
get() { const v = this[privateKey]; return v === undefined ? defaultValue : v; },
|
|
3942
|
+
set(value) { this[privateKey] = value; }
|
|
3943
|
+
};
|
|
3944
|
+
}
|
|
3916
3945
|
function getNames(object) {
|
|
3917
3946
|
return Object.getOwnPropertyNames(object);
|
|
3918
3947
|
}
|
|
@@ -4145,15 +4174,7 @@ var LeaferUI = (function (exports) {
|
|
|
4145
4174
|
const data = target.__DataProcessor.prototype;
|
|
4146
4175
|
const computedKey = '_' + key;
|
|
4147
4176
|
const setMethodName = getSetMethodName(key);
|
|
4148
|
-
const property =
|
|
4149
|
-
get() {
|
|
4150
|
-
const v = this[computedKey];
|
|
4151
|
-
return v === undefined ? defaultValue : v;
|
|
4152
|
-
},
|
|
4153
|
-
set(value) {
|
|
4154
|
-
this[computedKey] = value;
|
|
4155
|
-
}
|
|
4156
|
-
};
|
|
4177
|
+
const property = createDescriptor(key, defaultValue);
|
|
4157
4178
|
if (defaultValue === undefined) {
|
|
4158
4179
|
property.get = function () { return this[computedKey]; };
|
|
4159
4180
|
}
|
|
@@ -4268,7 +4289,7 @@ var LeaferUI = (function (exports) {
|
|
|
4268
4289
|
};
|
|
4269
4290
|
}
|
|
4270
4291
|
|
|
4271
|
-
const { copy: copy$6, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$
|
|
4292
|
+
const { copy: copy$6, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$3, divideParent, getLayout } = MatrixHelper;
|
|
4272
4293
|
const matrix = {}, { round } = Math;
|
|
4273
4294
|
const LeafHelper = {
|
|
4274
4295
|
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
@@ -4340,6 +4361,14 @@ var LeaferUI = (function (exports) {
|
|
|
4340
4361
|
}
|
|
4341
4362
|
return true;
|
|
4342
4363
|
},
|
|
4364
|
+
copyCanvasByWorld(leaf, currentCanvas, fromCanvas, fromWorld, blendMode, onlyResetTransform) {
|
|
4365
|
+
if (!fromWorld)
|
|
4366
|
+
fromWorld = leaf.__nowWorld;
|
|
4367
|
+
if (leaf.__worldFlipped || Platform.fullImageShadow)
|
|
4368
|
+
currentCanvas.copyWorldByReset(fromCanvas, fromWorld, leaf.__nowWorld, blendMode, onlyResetTransform);
|
|
4369
|
+
else
|
|
4370
|
+
currentCanvas.copyWorldToInner(fromCanvas, fromWorld, leaf.__layout.renderBounds, blendMode);
|
|
4371
|
+
},
|
|
4343
4372
|
moveWorld(t, x, y = 0, isInnerPoint, transition) {
|
|
4344
4373
|
const local = typeof x === 'object' ? Object.assign({}, x) : { x, y };
|
|
4345
4374
|
isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : (t.parent && toInnerPoint$1(t.parent.worldTransform, local, local, true));
|
|
@@ -4399,14 +4428,14 @@ var LeaferUI = (function (exports) {
|
|
|
4399
4428
|
},
|
|
4400
4429
|
transformWorld(t, transform, resize, transition) {
|
|
4401
4430
|
copy$6(matrix, t.worldTransform);
|
|
4402
|
-
multiplyParent$
|
|
4431
|
+
multiplyParent$3(matrix, transform);
|
|
4403
4432
|
if (t.parent)
|
|
4404
4433
|
divideParent(matrix, t.parent.worldTransform);
|
|
4405
4434
|
L.setTransform(t, matrix, resize, transition);
|
|
4406
4435
|
},
|
|
4407
4436
|
transform(t, transform, resize, transition) {
|
|
4408
4437
|
copy$6(matrix, t.localTransform);
|
|
4409
|
-
multiplyParent$
|
|
4438
|
+
multiplyParent$3(matrix, transform);
|
|
4410
4439
|
L.setTransform(t, matrix, resize, transition);
|
|
4411
4440
|
},
|
|
4412
4441
|
setTransform(t, transform, resize, transition) {
|
|
@@ -5268,17 +5297,18 @@ var LeaferUI = (function (exports) {
|
|
|
5268
5297
|
}
|
|
5269
5298
|
};
|
|
5270
5299
|
|
|
5271
|
-
const { setLayout, multiplyParent: multiplyParent$
|
|
5300
|
+
const { setLayout, multiplyParent: multiplyParent$2, translateInner, defaultWorld } = MatrixHelper;
|
|
5272
5301
|
const { toPoint: toPoint$3, tempPoint } = AroundHelper;
|
|
5273
5302
|
const LeafMatrix = {
|
|
5274
5303
|
__updateWorldMatrix() {
|
|
5275
|
-
|
|
5304
|
+
const { parent, __layout } = this;
|
|
5305
|
+
multiplyParent$2(this.__local || __layout, parent ? parent.__world : defaultWorld, this.__world, !!__layout.affectScaleOrRotation, this.__, parent && (parent.scrollY || parent.scrollX) && parent.__);
|
|
5276
5306
|
},
|
|
5277
5307
|
__updateLocalMatrix() {
|
|
5278
5308
|
if (this.__local) {
|
|
5279
5309
|
const layout = this.__layout, local = this.__local, data = this.__;
|
|
5280
5310
|
if (layout.affectScaleOrRotation) {
|
|
5281
|
-
if ((layout.scaleChanged && (layout.resized = 'scale')) || layout.rotationChanged) {
|
|
5311
|
+
if ((layout.scaleChanged && (layout.resized || (layout.resized = 'scale'))) || layout.rotationChanged) {
|
|
5282
5312
|
setLayout(local, data, null, null, layout.affectRotation);
|
|
5283
5313
|
layout.scaleChanged = layout.rotationChanged = undefined;
|
|
5284
5314
|
}
|
|
@@ -5444,10 +5474,7 @@ var LeaferUI = (function (exports) {
|
|
|
5444
5474
|
return this.__renderEraser(canvas, options);
|
|
5445
5475
|
const tempCanvas = canvas.getSameCanvas(true, true);
|
|
5446
5476
|
this.__draw(tempCanvas, options, canvas);
|
|
5447
|
-
|
|
5448
|
-
canvas.copyWorldByReset(tempCanvas, this.__nowWorld, null, data.__blendMode, true);
|
|
5449
|
-
else
|
|
5450
|
-
canvas.copyWorldToInner(tempCanvas, this.__nowWorld, this.__layout.renderBounds, data.__blendMode);
|
|
5477
|
+
LeafHelper.copyCanvasByWorld(this, canvas, tempCanvas, this.__nowWorld, data.__blendMode, true);
|
|
5451
5478
|
tempCanvas.recycle(this.__nowWorld);
|
|
5452
5479
|
}
|
|
5453
5480
|
else {
|
|
@@ -5495,7 +5522,7 @@ var LeaferUI = (function (exports) {
|
|
|
5495
5522
|
options.dimOpacity = data.dim === true ? 0.2 : data.dim;
|
|
5496
5523
|
else if (data.dimskip)
|
|
5497
5524
|
options.dimOpacity && (options.dimOpacity = 0);
|
|
5498
|
-
if (data.__single) {
|
|
5525
|
+
if (data.__single && !this.isBranchLeaf) {
|
|
5499
5526
|
if (data.eraser === 'path')
|
|
5500
5527
|
return this.__renderEraser(canvas, options);
|
|
5501
5528
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
@@ -5517,9 +5544,7 @@ var LeaferUI = (function (exports) {
|
|
|
5517
5544
|
else {
|
|
5518
5545
|
const { children } = this;
|
|
5519
5546
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
5520
|
-
|
|
5521
|
-
continue;
|
|
5522
|
-
children[i].__render(canvas, options);
|
|
5547
|
+
excludeRenderBounds$1(children[i], options) || children[i].__render(canvas, options);
|
|
5523
5548
|
}
|
|
5524
5549
|
}
|
|
5525
5550
|
},
|
|
@@ -5527,16 +5552,15 @@ var LeaferUI = (function (exports) {
|
|
|
5527
5552
|
if (this.__worldOpacity) {
|
|
5528
5553
|
const { children } = this;
|
|
5529
5554
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
5530
|
-
|
|
5531
|
-
continue;
|
|
5532
|
-
children[i].__clip(canvas, options);
|
|
5555
|
+
excludeRenderBounds$1(children[i], options) || children[i].__clip(canvas, options);
|
|
5533
5556
|
}
|
|
5534
5557
|
}
|
|
5535
5558
|
}
|
|
5536
5559
|
};
|
|
5537
5560
|
|
|
5561
|
+
const tempScaleData$1 = {};
|
|
5538
5562
|
const { LEAF, create } = IncrementId;
|
|
5539
|
-
const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
|
|
5563
|
+
const { toInnerPoint, toOuterPoint, multiplyParent: multiplyParent$1 } = MatrixHelper;
|
|
5540
5564
|
const { toOuterOf } = BoundsHelper;
|
|
5541
5565
|
const { copy: copy$3, move } = PointHelper;
|
|
5542
5566
|
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
|
|
@@ -5718,7 +5742,7 @@ var LeaferUI = (function (exports) {
|
|
|
5718
5742
|
if (!this.__cameraWorld)
|
|
5719
5743
|
this.__cameraWorld = {};
|
|
5720
5744
|
const cameraWorld = this.__cameraWorld, world = this.__world;
|
|
5721
|
-
multiplyParent(world, options.matrix, cameraWorld, undefined, world);
|
|
5745
|
+
multiplyParent$1(world, options.matrix, cameraWorld, undefined, world);
|
|
5722
5746
|
toOuterOf(this.__layout.renderBounds, cameraWorld, cameraWorld);
|
|
5723
5747
|
cameraWorld.half !== world.half && (cameraWorld.half = world.half);
|
|
5724
5748
|
return cameraWorld;
|
|
@@ -5727,6 +5751,22 @@ var LeaferUI = (function (exports) {
|
|
|
5727
5751
|
return this.__world;
|
|
5728
5752
|
}
|
|
5729
5753
|
}
|
|
5754
|
+
getClampRenderScale() {
|
|
5755
|
+
let { scaleX } = this.__nowWorld || this.__world;
|
|
5756
|
+
if (scaleX < 0)
|
|
5757
|
+
scaleX = -scaleX;
|
|
5758
|
+
return scaleX > 1 ? scaleX : 1;
|
|
5759
|
+
}
|
|
5760
|
+
getRenderScaleData(abs, scaleFixed) {
|
|
5761
|
+
const { scaleX, scaleY } = ImageManager.patternLocked ? this.__world : this.__nowWorld;
|
|
5762
|
+
if (scaleFixed)
|
|
5763
|
+
tempScaleData$1.scaleX = tempScaleData$1.scaleY = 1;
|
|
5764
|
+
else if (abs)
|
|
5765
|
+
tempScaleData$1.scaleX = scaleX < 0 ? -scaleX : scaleX, tempScaleData$1.scaleY = scaleY < 0 ? -scaleY : scaleY;
|
|
5766
|
+
else
|
|
5767
|
+
tempScaleData$1.scaleX = scaleX, tempScaleData$1.scaleY = scaleY;
|
|
5768
|
+
return tempScaleData$1;
|
|
5769
|
+
}
|
|
5730
5770
|
getTransform(relative) {
|
|
5731
5771
|
return this.__layout.getTransform(relative || 'local');
|
|
5732
5772
|
}
|
|
@@ -6251,7 +6291,7 @@ var LeaferUI = (function (exports) {
|
|
|
6251
6291
|
}
|
|
6252
6292
|
}
|
|
6253
6293
|
|
|
6254
|
-
const version = "1.
|
|
6294
|
+
const version = "1.8.0";
|
|
6255
6295
|
|
|
6256
6296
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6257
6297
|
get allowBackgroundColor() { return true; }
|
|
@@ -6942,6 +6982,11 @@ var LeaferUI = (function (exports) {
|
|
|
6942
6982
|
});
|
|
6943
6983
|
};
|
|
6944
6984
|
}
|
|
6985
|
+
function createAttr(defaultValue) {
|
|
6986
|
+
return (target, key) => {
|
|
6987
|
+
defineKey(target, key, createDescriptor(key, defaultValue));
|
|
6988
|
+
};
|
|
6989
|
+
}
|
|
6945
6990
|
|
|
6946
6991
|
function hasTransparent$3(color) {
|
|
6947
6992
|
if (!color || color.length === 7 || color.length === 4)
|
|
@@ -6999,22 +7044,9 @@ var LeaferUI = (function (exports) {
|
|
|
6999
7044
|
const debug$1 = Debug.get('UIData');
|
|
7000
7045
|
class UIData extends LeafData {
|
|
7001
7046
|
get scale() { const { scaleX, scaleY } = this; return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX; }
|
|
7002
|
-
get __strokeWidth() {
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
const ui = this.__leaf;
|
|
7006
|
-
let { scaleX } = ui.__nowWorld || ui.__world;
|
|
7007
|
-
if (scaleX < 0)
|
|
7008
|
-
scaleX = -scaleX;
|
|
7009
|
-
return scaleX > 1 ? strokeWidth / scaleX : strokeWidth;
|
|
7010
|
-
}
|
|
7011
|
-
else
|
|
7012
|
-
return strokeWidth;
|
|
7013
|
-
}
|
|
7014
|
-
get __hasMultiPaint() {
|
|
7015
|
-
const t = this;
|
|
7016
|
-
return (t.fill && this.__useStroke) || (t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect;
|
|
7017
|
-
}
|
|
7047
|
+
get __strokeWidth() { return this.__getRealStrokeWidth(); }
|
|
7048
|
+
get __maxStrokeWidth() { const t = this; return t.__hasMultiStrokeStyle ? Math.max(t.__hasMultiStrokeStyle, t.strokeWidth) : t.strokeWidth; }
|
|
7049
|
+
get __hasMultiPaint() { const t = this; return (t.fill && this.__useStroke) || (t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect; }
|
|
7018
7050
|
get __clipAfterFill() { const t = this; return (t.cornerRadius || t.innerShadow || t.__pathInputed); }
|
|
7019
7051
|
get __hasSurface() { const t = this; return (t.fill || t.stroke); }
|
|
7020
7052
|
get __autoWidth() { return !this._width; }
|
|
@@ -7096,6 +7128,21 @@ var LeaferUI = (function (exports) {
|
|
|
7096
7128
|
Paint.compute('stroke', this.__leaf);
|
|
7097
7129
|
this.__needComputePaint = undefined;
|
|
7098
7130
|
}
|
|
7131
|
+
__getRealStrokeWidth(childStyle) {
|
|
7132
|
+
let { strokeWidth, strokeWidthFixed } = this;
|
|
7133
|
+
if (childStyle) {
|
|
7134
|
+
if (childStyle.strokeWidth)
|
|
7135
|
+
strokeWidth = childStyle.strokeWidth;
|
|
7136
|
+
if (childStyle.strokeWidthFixed !== undefined)
|
|
7137
|
+
strokeWidthFixed = childStyle.strokeWidthFixed;
|
|
7138
|
+
}
|
|
7139
|
+
if (strokeWidthFixed) {
|
|
7140
|
+
const scale = this.__leaf.getClampRenderScale();
|
|
7141
|
+
return scale > 1 ? strokeWidth / scale : strokeWidth;
|
|
7142
|
+
}
|
|
7143
|
+
else
|
|
7144
|
+
return strokeWidth;
|
|
7145
|
+
}
|
|
7099
7146
|
__setPaint(attrName, value) {
|
|
7100
7147
|
this.__setInput(attrName, value);
|
|
7101
7148
|
const layout = this.__leaf.__layout;
|
|
@@ -7120,6 +7167,7 @@ var LeaferUI = (function (exports) {
|
|
|
7120
7167
|
}
|
|
7121
7168
|
else {
|
|
7122
7169
|
stintSet$2(this, '__isAlphaPixelStroke', undefined);
|
|
7170
|
+
stintSet$2(this, '__hasMultiStrokeStyle', undefined);
|
|
7123
7171
|
this._stroke = this.__isStrokes = undefined;
|
|
7124
7172
|
}
|
|
7125
7173
|
}
|
|
@@ -7141,8 +7189,8 @@ var LeaferUI = (function (exports) {
|
|
|
7141
7189
|
|
|
7142
7190
|
class BoxData extends GroupData {
|
|
7143
7191
|
get __boxStroke() { return !this.__pathInputed; }
|
|
7144
|
-
get __drawAfterFill() { const t = this; return
|
|
7145
|
-
get __clipAfterFill() { return
|
|
7192
|
+
get __drawAfterFill() { const t = this; return t.__single || t.__clipAfterFill; }
|
|
7193
|
+
get __clipAfterFill() { const t = this; return t.overflow === 'hide' && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill); }
|
|
7146
7194
|
}
|
|
7147
7195
|
|
|
7148
7196
|
class LeaferData extends GroupData {
|
|
@@ -7262,7 +7310,7 @@ var LeaferUI = (function (exports) {
|
|
|
7262
7310
|
const UIBounds = {
|
|
7263
7311
|
__updateStrokeSpread() {
|
|
7264
7312
|
let width = 0, boxWidth = 0;
|
|
7265
|
-
const data = this.__, { strokeAlign, strokeWidth } = data, box = this.__box;
|
|
7313
|
+
const data = this.__, { strokeAlign, __maxStrokeWidth: strokeWidth } = data, box = this.__box;
|
|
7266
7314
|
if ((data.stroke || data.hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
|
|
7267
7315
|
boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth;
|
|
7268
7316
|
if (!data.__boxStroke) {
|
|
@@ -7282,13 +7330,15 @@ var LeaferUI = (function (exports) {
|
|
|
7282
7330
|
},
|
|
7283
7331
|
__updateRenderSpread() {
|
|
7284
7332
|
let width = 0;
|
|
7285
|
-
const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
|
|
7333
|
+
const { shadow, innerShadow, blur, backgroundBlur, filter, renderSpread } = this.__;
|
|
7286
7334
|
if (shadow)
|
|
7287
7335
|
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));
|
|
7288
7336
|
if (blur)
|
|
7289
7337
|
width = Math.max(width, blur);
|
|
7290
7338
|
if (filter)
|
|
7291
7339
|
width += Filter.getSpread(filter);
|
|
7340
|
+
if (renderSpread)
|
|
7341
|
+
width += renderSpread;
|
|
7292
7342
|
let shapeWidth = width = Math.ceil(width);
|
|
7293
7343
|
if (innerShadow)
|
|
7294
7344
|
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));
|
|
@@ -7311,7 +7361,7 @@ var LeaferUI = (function (exports) {
|
|
|
7311
7361
|
}
|
|
7312
7362
|
if (data.__useEffect) {
|
|
7313
7363
|
const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
7314
|
-
stintSet$1(data, '__isFastShadow', shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread &&
|
|
7364
|
+
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')));
|
|
7315
7365
|
data.__useEffect = !!(shadow || otherEffect);
|
|
7316
7366
|
}
|
|
7317
7367
|
data.__checkSingle();
|
|
@@ -7418,17 +7468,17 @@ var LeaferUI = (function (exports) {
|
|
|
7418
7468
|
if (__drawAfterFill)
|
|
7419
7469
|
this.__drawAfterFill(canvas, options);
|
|
7420
7470
|
if (stroke) {
|
|
7421
|
-
const { strokeAlign, __strokeWidth } = this.__;
|
|
7422
|
-
if (!
|
|
7471
|
+
const { strokeAlign, __strokeWidth: strokeWidth } = this.__;
|
|
7472
|
+
if (!strokeWidth)
|
|
7423
7473
|
return;
|
|
7424
|
-
canvas.setStroke(stroke,
|
|
7425
|
-
const half =
|
|
7474
|
+
canvas.setStroke(stroke, strokeWidth, this.__);
|
|
7475
|
+
const half = strokeWidth / 2;
|
|
7426
7476
|
switch (strokeAlign) {
|
|
7427
7477
|
case 'center':
|
|
7428
7478
|
canvas.strokeRect(0, 0, width, height);
|
|
7429
7479
|
break;
|
|
7430
7480
|
case 'inside':
|
|
7431
|
-
width -=
|
|
7481
|
+
width -= strokeWidth, height -= strokeWidth;
|
|
7432
7482
|
if (width < 0 || height < 0) {
|
|
7433
7483
|
canvas.save();
|
|
7434
7484
|
this.__clip(canvas, options);
|
|
@@ -7439,7 +7489,7 @@ var LeaferUI = (function (exports) {
|
|
|
7439
7489
|
canvas.strokeRect(x + half, y + half, width, height);
|
|
7440
7490
|
break;
|
|
7441
7491
|
case 'outside':
|
|
7442
|
-
canvas.strokeRect(x - half, y - half, width +
|
|
7492
|
+
canvas.strokeRect(x - half, y - half, width + strokeWidth, height + strokeWidth);
|
|
7443
7493
|
break;
|
|
7444
7494
|
}
|
|
7445
7495
|
}
|
|
@@ -7452,6 +7502,8 @@ var LeaferUI = (function (exports) {
|
|
|
7452
7502
|
get isFrame() { return false; }
|
|
7453
7503
|
set scale(value) { MathHelper.assignScale(this, value); }
|
|
7454
7504
|
get scale() { return this.__.scale; }
|
|
7505
|
+
get isAutoWidth() { const t = this.__; return t.__autoWidth || t.autoWidth; }
|
|
7506
|
+
get isAutoHeight() { const t = this.__; return t.__autoHeight || t.autoHeight; }
|
|
7455
7507
|
get pen() {
|
|
7456
7508
|
const { path } = this.__;
|
|
7457
7509
|
pen.set(this.path = path || []);
|
|
@@ -7666,6 +7718,9 @@ var LeaferUI = (function (exports) {
|
|
|
7666
7718
|
__decorate([
|
|
7667
7719
|
naturalBoundsType(1)
|
|
7668
7720
|
], exports.UI.prototype, "pixelRatio", void 0);
|
|
7721
|
+
__decorate([
|
|
7722
|
+
affectRenderBoundsType(0)
|
|
7723
|
+
], exports.UI.prototype, "renderSpread", void 0);
|
|
7669
7724
|
__decorate([
|
|
7670
7725
|
pathInputType()
|
|
7671
7726
|
], exports.UI.prototype, "path", void 0);
|
|
@@ -7822,7 +7877,8 @@ var LeaferUI = (function (exports) {
|
|
|
7822
7877
|
}
|
|
7823
7878
|
toJSON(options) {
|
|
7824
7879
|
const data = super.toJSON(options);
|
|
7825
|
-
|
|
7880
|
+
if (!this.childlessJSON)
|
|
7881
|
+
data.children = this.children.map(child => child.toJSON(options));
|
|
7826
7882
|
return data;
|
|
7827
7883
|
}
|
|
7828
7884
|
pick(_hitPoint, _options) { return undefined; }
|
|
@@ -8269,8 +8325,8 @@ var LeaferUI = (function (exports) {
|
|
|
8269
8325
|
__updateRenderSpread() { return this.__updateRectRenderSpread() || -1; }
|
|
8270
8326
|
__updateRectBoxBounds() { }
|
|
8271
8327
|
__updateBoxBounds(_secondLayout) {
|
|
8272
|
-
const data = this.__;
|
|
8273
8328
|
if (this.children.length && !this.pathInputed) {
|
|
8329
|
+
const data = this.__;
|
|
8274
8330
|
if (data.__autoSide) {
|
|
8275
8331
|
if (data.__hasSurface)
|
|
8276
8332
|
this.__extraUpdate();
|
|
@@ -8297,20 +8353,26 @@ var LeaferUI = (function (exports) {
|
|
|
8297
8353
|
__updateStrokeBounds() { }
|
|
8298
8354
|
__updateRenderBounds() {
|
|
8299
8355
|
let isOverflow;
|
|
8300
|
-
const { renderBounds } = this.__layout;
|
|
8301
8356
|
if (this.children.length) {
|
|
8357
|
+
const data = this.__, { renderBounds, boxBounds } = this.__layout;
|
|
8302
8358
|
super.__updateRenderBounds();
|
|
8303
8359
|
copy$2(childrenRenderBounds, renderBounds);
|
|
8304
8360
|
this.__updateRectRenderBounds();
|
|
8305
|
-
|
|
8306
|
-
|
|
8361
|
+
if (data.scrollY || data.scrollX) {
|
|
8362
|
+
childrenRenderBounds.x += data.scrollX;
|
|
8363
|
+
childrenRenderBounds.y += data.scrollY;
|
|
8364
|
+
}
|
|
8365
|
+
isOverflow = !includes$1(boxBounds, childrenRenderBounds);
|
|
8366
|
+
if (isOverflow && data.overflow !== 'hide')
|
|
8307
8367
|
add(renderBounds, childrenRenderBounds);
|
|
8308
8368
|
}
|
|
8309
8369
|
else
|
|
8310
8370
|
this.__updateRectRenderBounds();
|
|
8311
8371
|
DataHelper.stintSet(this, 'isOverflow', isOverflow);
|
|
8372
|
+
this.__updateScrollBar();
|
|
8312
8373
|
}
|
|
8313
8374
|
__updateRectRenderBounds() { }
|
|
8375
|
+
__updateScrollBar() { }
|
|
8314
8376
|
__updateRectChange() { }
|
|
8315
8377
|
__updateChange() {
|
|
8316
8378
|
super.__updateChange();
|
|
@@ -8327,10 +8389,12 @@ var LeaferUI = (function (exports) {
|
|
|
8327
8389
|
if (this.children.length)
|
|
8328
8390
|
this.__renderGroup(canvas, options);
|
|
8329
8391
|
}
|
|
8392
|
+
if (this.scrollBar)
|
|
8393
|
+
this.scrollBar.__render(canvas, options);
|
|
8330
8394
|
}
|
|
8331
8395
|
__drawContent(canvas, options) {
|
|
8332
8396
|
this.__renderGroup(canvas, options);
|
|
8333
|
-
if (this.__.__useStroke) {
|
|
8397
|
+
if (this.__.__useStroke || this.__.__useEffect) {
|
|
8334
8398
|
canvas.setWorld(this.__nowWorld);
|
|
8335
8399
|
this.__drawRenderPath(canvas);
|
|
8336
8400
|
}
|
|
@@ -8989,9 +9053,14 @@ var LeaferUI = (function (exports) {
|
|
|
8989
9053
|
}
|
|
8990
9054
|
}
|
|
8991
9055
|
canvas.fillStyle = item.style;
|
|
8992
|
-
if (item.transform) {
|
|
9056
|
+
if (item.transform || item.scaleFixed) {
|
|
8993
9057
|
canvas.save();
|
|
8994
|
-
|
|
9058
|
+
if (item.transform)
|
|
9059
|
+
canvas.transform(item.transform);
|
|
9060
|
+
if (item.scaleFixed) {
|
|
9061
|
+
const { scaleX, scaleY } = ui.getRenderScaleData(true);
|
|
9062
|
+
canvas.scale(1 / scaleX, 1 / scaleY);
|
|
9063
|
+
}
|
|
8995
9064
|
if (item.blendMode)
|
|
8996
9065
|
canvas.blendMode = item.blendMode;
|
|
8997
9066
|
fillPathOrText(ui, canvas);
|
|
@@ -9027,8 +9096,13 @@ var LeaferUI = (function (exports) {
|
|
|
9027
9096
|
}
|
|
9028
9097
|
function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
|
|
9029
9098
|
const data = ui.__;
|
|
9030
|
-
|
|
9031
|
-
|
|
9099
|
+
if (typeof stroke === 'object') {
|
|
9100
|
+
drawStrokesStyle(stroke, strokeWidthScale, true, ui, canvas);
|
|
9101
|
+
}
|
|
9102
|
+
else {
|
|
9103
|
+
canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
9104
|
+
drawTextStroke(ui, canvas);
|
|
9105
|
+
}
|
|
9032
9106
|
}
|
|
9033
9107
|
function drawAlign(stroke, align, ui, canvas) {
|
|
9034
9108
|
const out = canvas.getSameCanvas(true, true);
|
|
@@ -9037,15 +9111,9 @@ var LeaferUI = (function (exports) {
|
|
|
9037
9111
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
9038
9112
|
fillText(ui, out);
|
|
9039
9113
|
out.blendMode = 'normal';
|
|
9040
|
-
|
|
9114
|
+
LeafHelper.copyCanvasByWorld(ui, canvas, out);
|
|
9041
9115
|
out.recycle(ui.__nowWorld);
|
|
9042
9116
|
}
|
|
9043
|
-
function copyWorld(canvas, out, ui) {
|
|
9044
|
-
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
9045
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9046
|
-
else
|
|
9047
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
9048
|
-
}
|
|
9049
9117
|
function drawTextStroke(ui, canvas) {
|
|
9050
9118
|
let row, data = ui.__.__textDrawData;
|
|
9051
9119
|
const { rows, decorationY } = data;
|
|
@@ -9061,14 +9129,21 @@ var LeaferUI = (function (exports) {
|
|
|
9061
9129
|
rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
9062
9130
|
}
|
|
9063
9131
|
}
|
|
9064
|
-
function drawStrokesStyle(strokes, isText, ui, canvas) {
|
|
9132
|
+
function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas) {
|
|
9065
9133
|
let item;
|
|
9134
|
+
const data = ui.__, { __hasMultiStrokeStyle } = data;
|
|
9135
|
+
__hasMultiStrokeStyle || canvas.setStroke(undefined, data.__strokeWidth * strokeWidthScale, data);
|
|
9066
9136
|
for (let i = 0, len = strokes.length; i < len; i++) {
|
|
9067
9137
|
item = strokes[i];
|
|
9068
9138
|
if (item.image && PaintImage.checkImage(ui, canvas, item, false))
|
|
9069
9139
|
continue;
|
|
9070
9140
|
if (item.style) {
|
|
9071
|
-
|
|
9141
|
+
if (__hasMultiStrokeStyle) {
|
|
9142
|
+
const { strokeStyle } = item;
|
|
9143
|
+
strokeStyle ? canvas.setStroke(item.style, data.__getRealStrokeWidth(strokeStyle) * strokeWidthScale, data, strokeStyle) : canvas.setStroke(item.style, data.__strokeWidth * strokeWidthScale, data);
|
|
9144
|
+
}
|
|
9145
|
+
else
|
|
9146
|
+
canvas.strokeStyle = item.style;
|
|
9072
9147
|
if (item.blendMode) {
|
|
9073
9148
|
canvas.saveBlendMode(item.blendMode);
|
|
9074
9149
|
isText ? drawTextStroke(ui, canvas) : canvas.stroke();
|
|
@@ -9107,8 +9182,13 @@ var LeaferUI = (function (exports) {
|
|
|
9107
9182
|
}
|
|
9108
9183
|
function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
9109
9184
|
const data = ui.__;
|
|
9110
|
-
|
|
9111
|
-
|
|
9185
|
+
if (typeof stroke === 'object') {
|
|
9186
|
+
drawStrokesStyle(stroke, strokeWidthScale, false, ui, canvas);
|
|
9187
|
+
}
|
|
9188
|
+
else {
|
|
9189
|
+
canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
9190
|
+
canvas.stroke();
|
|
9191
|
+
}
|
|
9112
9192
|
if (data.__useArrow)
|
|
9113
9193
|
Paint.strokeArrow(stroke, ui, canvas);
|
|
9114
9194
|
}
|
|
@@ -9130,7 +9210,7 @@ var LeaferUI = (function (exports) {
|
|
|
9130
9210
|
drawCenter(stroke, 2, ui, out);
|
|
9131
9211
|
out.clipUI(data);
|
|
9132
9212
|
out.clearWorld(renderBounds);
|
|
9133
|
-
|
|
9213
|
+
LeafHelper.copyCanvasByWorld(ui, canvas, out);
|
|
9134
9214
|
out.recycle(ui.__nowWorld);
|
|
9135
9215
|
}
|
|
9136
9216
|
}
|
|
@@ -9185,8 +9265,16 @@ var LeaferUI = (function (exports) {
|
|
|
9185
9265
|
if (!(paints instanceof Array))
|
|
9186
9266
|
paints = [paints];
|
|
9187
9267
|
recycleMap = PaintImage.recycleImage(attrName, data);
|
|
9268
|
+
let maxChildStrokeWidth;
|
|
9188
9269
|
for (let i = 0, len = paints.length, item; i < len; i++) {
|
|
9189
|
-
(item = getLeafPaint(attrName, paints[i], ui))
|
|
9270
|
+
if (item = getLeafPaint(attrName, paints[i], ui)) {
|
|
9271
|
+
leafPaints.push(item);
|
|
9272
|
+
if (item.strokeStyle) {
|
|
9273
|
+
maxChildStrokeWidth || (maxChildStrokeWidth = 1);
|
|
9274
|
+
if (item.strokeStyle.strokeWidth)
|
|
9275
|
+
maxChildStrokeWidth = Math.max(maxChildStrokeWidth, item.strokeStyle.strokeWidth);
|
|
9276
|
+
}
|
|
9277
|
+
}
|
|
9190
9278
|
}
|
|
9191
9279
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
9192
9280
|
if (leafPaints.length) {
|
|
@@ -9203,6 +9291,7 @@ var LeaferUI = (function (exports) {
|
|
|
9203
9291
|
else {
|
|
9204
9292
|
stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
|
|
9205
9293
|
stintSet(data, '__isTransparentStroke', isTransparent);
|
|
9294
|
+
stintSet(data, '__hasMultiStrokeStyle', maxChildStrokeWidth);
|
|
9206
9295
|
}
|
|
9207
9296
|
}
|
|
9208
9297
|
function getLeafPaint(attrName, paint, ui) {
|
|
@@ -9234,6 +9323,11 @@ var LeaferUI = (function (exports) {
|
|
|
9234
9323
|
if (data) {
|
|
9235
9324
|
if (typeof data.style === 'string' && hasTransparent$1(data.style))
|
|
9236
9325
|
data.isTransparent = true;
|
|
9326
|
+
if (paint.style) {
|
|
9327
|
+
if (paint.style.strokeWidth === 0)
|
|
9328
|
+
return undefined;
|
|
9329
|
+
data.strokeStyle = paint.style;
|
|
9330
|
+
}
|
|
9237
9331
|
if (paint.blendMode)
|
|
9238
9332
|
data.blendMode = paint.blendMode;
|
|
9239
9333
|
}
|
|
@@ -9253,8 +9347,8 @@ var LeaferUI = (function (exports) {
|
|
|
9253
9347
|
shape
|
|
9254
9348
|
};
|
|
9255
9349
|
|
|
9256
|
-
let origin = {};
|
|
9257
|
-
const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, scale: scaleHelper, rotate, skew: skewHelper } = MatrixHelper;
|
|
9350
|
+
let origin = {}, tempMatrix = getMatrixData();
|
|
9351
|
+
const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent, scale: scaleHelper, rotate, skew: skewHelper } = MatrixHelper;
|
|
9258
9352
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
9259
9353
|
const transform = get$3();
|
|
9260
9354
|
translate$1(transform, box.x + x, box.y + y);
|
|
@@ -9263,7 +9357,7 @@ var LeaferUI = (function (exports) {
|
|
|
9263
9357
|
rotateOfOuter$1(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
|
|
9264
9358
|
data.transform = transform;
|
|
9265
9359
|
}
|
|
9266
|
-
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew) {
|
|
9360
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipSize) {
|
|
9267
9361
|
const transform = get$3();
|
|
9268
9362
|
if (rotation)
|
|
9269
9363
|
rotate(transform, rotation);
|
|
@@ -9272,6 +9366,10 @@ var LeaferUI = (function (exports) {
|
|
|
9272
9366
|
if (scaleX)
|
|
9273
9367
|
scaleHelper(transform, scaleX, scaleY);
|
|
9274
9368
|
translate$1(transform, box.x + x, box.y + y);
|
|
9369
|
+
if (clipSize) {
|
|
9370
|
+
tempMatrix.a = box.width / clipSize.width, tempMatrix.d = box.height / clipSize.height;
|
|
9371
|
+
multiplyParent(transform, tempMatrix);
|
|
9372
|
+
}
|
|
9275
9373
|
data.transform = transform;
|
|
9276
9374
|
}
|
|
9277
9375
|
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
|
|
@@ -9308,13 +9406,15 @@ var LeaferUI = (function (exports) {
|
|
|
9308
9406
|
const tempScaleData = {};
|
|
9309
9407
|
const tempImage = {};
|
|
9310
9408
|
function createData(leafPaint, image, paint, box) {
|
|
9311
|
-
const { changeful, sync, editing } = paint;
|
|
9409
|
+
const { changeful, sync, editing, scaleFixed } = paint;
|
|
9312
9410
|
if (changeful)
|
|
9313
9411
|
leafPaint.changeful = changeful;
|
|
9314
9412
|
if (sync)
|
|
9315
9413
|
leafPaint.sync = sync;
|
|
9316
9414
|
if (editing)
|
|
9317
9415
|
leafPaint.editing = editing;
|
|
9416
|
+
if (scaleFixed)
|
|
9417
|
+
leafPaint.scaleFixed = scaleFixed;
|
|
9318
9418
|
leafPaint.data = getPatternData(paint, box, image);
|
|
9319
9419
|
}
|
|
9320
9420
|
function getPatternData(paint, box, image) {
|
|
@@ -9323,7 +9423,7 @@ var LeaferUI = (function (exports) {
|
|
|
9323
9423
|
if (paint.mode === 'strench')
|
|
9324
9424
|
paint.mode = 'stretch';
|
|
9325
9425
|
let { width, height } = image;
|
|
9326
|
-
const { opacity, mode, align, offset, scale, size, rotation, skew, repeat, filters } = paint;
|
|
9426
|
+
const { opacity, mode, align, offset, scale, size, rotation, skew, clipSize, repeat, filters } = paint;
|
|
9327
9427
|
const sameBox = box.width === width && box.height === height;
|
|
9328
9428
|
const data = { mode };
|
|
9329
9429
|
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
@@ -9357,8 +9457,8 @@ var LeaferUI = (function (exports) {
|
|
|
9357
9457
|
break;
|
|
9358
9458
|
case 'normal':
|
|
9359
9459
|
case 'clip':
|
|
9360
|
-
if (tempImage.x || tempImage.y || scaleX || rotation || skew)
|
|
9361
|
-
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew);
|
|
9460
|
+
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
|
|
9461
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, paint.clipSize);
|
|
9362
9462
|
break;
|
|
9363
9463
|
case 'repeat':
|
|
9364
9464
|
if (!sameBox || scaleX || rotation)
|
|
@@ -9495,18 +9595,16 @@ var LeaferUI = (function (exports) {
|
|
|
9495
9595
|
}
|
|
9496
9596
|
|
|
9497
9597
|
const { get: get$1, scale, copy: copy$1 } = MatrixHelper;
|
|
9498
|
-
const { ceil, abs
|
|
9598
|
+
const { ceil, abs } = Math;
|
|
9499
9599
|
function createPattern(ui, paint, pixelRatio) {
|
|
9500
|
-
let { scaleX, scaleY } =
|
|
9600
|
+
let { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
9501
9601
|
const id = scaleX + '-' + scaleY + '-' + pixelRatio;
|
|
9502
9602
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
9503
|
-
scaleX = abs$1(scaleX);
|
|
9504
|
-
scaleY = abs$1(scaleY);
|
|
9505
9603
|
const { image, data } = paint;
|
|
9506
9604
|
let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
|
|
9507
9605
|
if (sx) {
|
|
9508
|
-
sx = abs
|
|
9509
|
-
sy = abs
|
|
9606
|
+
sx = abs(sx);
|
|
9607
|
+
sy = abs(sy);
|
|
9510
9608
|
imageMatrix = get$1();
|
|
9511
9609
|
copy$1(imageMatrix, transform);
|
|
9512
9610
|
scale(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -9559,9 +9657,8 @@ var LeaferUI = (function (exports) {
|
|
|
9559
9657
|
}
|
|
9560
9658
|
}
|
|
9561
9659
|
|
|
9562
|
-
const { abs } = Math;
|
|
9563
9660
|
function checkImage(ui, canvas, paint, allowDraw) {
|
|
9564
|
-
const { scaleX, scaleY } =
|
|
9661
|
+
const { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
9565
9662
|
const { pixelRatio } = canvas, { data } = paint;
|
|
9566
9663
|
if (!data || (paint.patternId === scaleX + '-' + scaleY + '-' + pixelRatio && !Export.running)) {
|
|
9567
9664
|
return false;
|
|
@@ -9574,8 +9671,8 @@ var LeaferUI = (function (exports) {
|
|
|
9574
9671
|
else {
|
|
9575
9672
|
if (!(paint.changeful || ResizeEvent.isResizing(ui) || Export.running)) {
|
|
9576
9673
|
let { width, height } = data;
|
|
9577
|
-
width *=
|
|
9578
|
-
height *=
|
|
9674
|
+
width *= scaleX * pixelRatio;
|
|
9675
|
+
height *= scaleY * pixelRatio;
|
|
9579
9676
|
if (data.scaleX) {
|
|
9580
9677
|
width *= data.scaleX;
|
|
9581
9678
|
height *= data.scaleY;
|
|
@@ -9585,6 +9682,10 @@ var LeaferUI = (function (exports) {
|
|
|
9585
9682
|
}
|
|
9586
9683
|
}
|
|
9587
9684
|
if (allowDraw) {
|
|
9685
|
+
if (ui.__.__isFastShadow) {
|
|
9686
|
+
canvas.fillStyle = paint.style || '#000';
|
|
9687
|
+
canvas.fill();
|
|
9688
|
+
}
|
|
9588
9689
|
drawImage(ui, canvas, paint, data);
|
|
9589
9690
|
return true;
|
|
9590
9691
|
}
|
|
@@ -9773,10 +9874,7 @@ var LeaferUI = (function (exports) {
|
|
|
9773
9874
|
}
|
|
9774
9875
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
|
|
9775
9876
|
}
|
|
9776
|
-
|
|
9777
|
-
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
9778
|
-
else
|
|
9779
|
-
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
9877
|
+
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
9780
9878
|
if (end && index < end)
|
|
9781
9879
|
other.clearWorld(copyBounds, true);
|
|
9782
9880
|
});
|
|
@@ -9835,10 +9933,7 @@ var LeaferUI = (function (exports) {
|
|
|
9835
9933
|
copyBounds = bounds;
|
|
9836
9934
|
}
|
|
9837
9935
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
|
|
9838
|
-
|
|
9839
|
-
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
9840
|
-
else
|
|
9841
|
-
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
9936
|
+
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
9842
9937
|
if (end && index < end)
|
|
9843
9938
|
other.clearWorld(copyBounds, true);
|
|
9844
9939
|
});
|
|
@@ -9894,12 +9989,11 @@ var LeaferUI = (function (exports) {
|
|
|
9894
9989
|
contentCanvas = getCanvas(canvas);
|
|
9895
9990
|
child.__render(maskCanvas, options);
|
|
9896
9991
|
}
|
|
9897
|
-
if (
|
|
9898
|
-
|
|
9899
|
-
}
|
|
9900
|
-
if (excludeRenderBounds(child, options))
|
|
9992
|
+
if (mask === 'clipping' || mask === 'clipping-path')
|
|
9993
|
+
excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
9901
9994
|
continue;
|
|
9902
|
-
|
|
9995
|
+
}
|
|
9996
|
+
excludeRenderBounds(child, options) || child.__render(contentCanvas || canvas, options);
|
|
9903
9997
|
}
|
|
9904
9998
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
|
|
9905
9999
|
};
|
|
@@ -10594,6 +10688,8 @@ var LeaferUI = (function (exports) {
|
|
|
10594
10688
|
exports.boundsType = boundsType;
|
|
10595
10689
|
exports.canvasPatch = canvasPatch;
|
|
10596
10690
|
exports.canvasSizeAttrs = canvasSizeAttrs;
|
|
10691
|
+
exports.createAttr = createAttr;
|
|
10692
|
+
exports.createDescriptor = createDescriptor;
|
|
10597
10693
|
exports.cursorType = cursorType;
|
|
10598
10694
|
exports.dataProcessor = dataProcessor;
|
|
10599
10695
|
exports.dataType = dataType;
|
|
@@ -10632,7 +10728,7 @@ var LeaferUI = (function (exports) {
|
|
|
10632
10728
|
exports.strokeType = strokeType;
|
|
10633
10729
|
exports.surfaceType = surfaceType;
|
|
10634
10730
|
exports.tempBounds = tempBounds$1;
|
|
10635
|
-
exports.tempMatrix = tempMatrix;
|
|
10731
|
+
exports.tempMatrix = tempMatrix$1;
|
|
10636
10732
|
exports.tempPoint = tempPoint$2;
|
|
10637
10733
|
exports.useCanvas = useCanvas;
|
|
10638
10734
|
exports.useModule = useModule;
|