@leafer-ui/worker 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/worker.cjs +77 -47
- package/dist/worker.esm.js +78 -48
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +242 -144
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +240 -144
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +11 -11
package/dist/worker.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$9, multiplyParent: multiplyParent$
|
|
2082
|
+
const { copy: copy$9, 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$7, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$
|
|
4292
|
+
const { copy: copy$7, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$3, divideParent, getLayout } = MatrixHelper;
|
|
4272
4293
|
const matrix$1 = {}, { 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$7(matrix$1, t.worldTransform);
|
|
4402
|
-
multiplyParent$
|
|
4431
|
+
multiplyParent$3(matrix$1, transform);
|
|
4403
4432
|
if (t.parent)
|
|
4404
4433
|
divideParent(matrix$1, t.parent.worldTransform);
|
|
4405
4434
|
L.setTransform(t, matrix$1, resize, transition);
|
|
4406
4435
|
},
|
|
4407
4436
|
transform(t, transform, resize, transition) {
|
|
4408
4437
|
copy$7(matrix$1, t.localTransform);
|
|
4409
|
-
multiplyParent$
|
|
4438
|
+
multiplyParent$3(matrix$1, transform);
|
|
4410
4439
|
L.setTransform(t, matrix$1, 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$4, 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; }
|
|
@@ -7099,6 +7139,11 @@ var LeaferUI = (function (exports) {
|
|
|
7099
7139
|
});
|
|
7100
7140
|
};
|
|
7101
7141
|
}
|
|
7142
|
+
function createAttr(defaultValue) {
|
|
7143
|
+
return (target, key) => {
|
|
7144
|
+
defineKey(target, key, createDescriptor(key, defaultValue));
|
|
7145
|
+
};
|
|
7146
|
+
}
|
|
7102
7147
|
|
|
7103
7148
|
function hasTransparent$3(color) {
|
|
7104
7149
|
if (!color || color.length === 7 || color.length === 4)
|
|
@@ -7156,22 +7201,9 @@ var LeaferUI = (function (exports) {
|
|
|
7156
7201
|
const debug$2 = Debug.get('UIData');
|
|
7157
7202
|
class UIData extends LeafData {
|
|
7158
7203
|
get scale() { const { scaleX, scaleY } = this; return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX; }
|
|
7159
|
-
get __strokeWidth() {
|
|
7160
|
-
|
|
7161
|
-
|
|
7162
|
-
const ui = this.__leaf;
|
|
7163
|
-
let { scaleX } = ui.__nowWorld || ui.__world;
|
|
7164
|
-
if (scaleX < 0)
|
|
7165
|
-
scaleX = -scaleX;
|
|
7166
|
-
return scaleX > 1 ? strokeWidth / scaleX : strokeWidth;
|
|
7167
|
-
}
|
|
7168
|
-
else
|
|
7169
|
-
return strokeWidth;
|
|
7170
|
-
}
|
|
7171
|
-
get __hasMultiPaint() {
|
|
7172
|
-
const t = this;
|
|
7173
|
-
return (t.fill && this.__useStroke) || (t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect;
|
|
7174
|
-
}
|
|
7204
|
+
get __strokeWidth() { return this.__getRealStrokeWidth(); }
|
|
7205
|
+
get __maxStrokeWidth() { const t = this; return t.__hasMultiStrokeStyle ? Math.max(t.__hasMultiStrokeStyle, t.strokeWidth) : t.strokeWidth; }
|
|
7206
|
+
get __hasMultiPaint() { const t = this; return (t.fill && this.__useStroke) || (t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect; }
|
|
7175
7207
|
get __clipAfterFill() { const t = this; return (t.cornerRadius || t.innerShadow || t.__pathInputed); }
|
|
7176
7208
|
get __hasSurface() { const t = this; return (t.fill || t.stroke); }
|
|
7177
7209
|
get __autoWidth() { return !this._width; }
|
|
@@ -7253,6 +7285,21 @@ var LeaferUI = (function (exports) {
|
|
|
7253
7285
|
Paint.compute('stroke', this.__leaf);
|
|
7254
7286
|
this.__needComputePaint = undefined;
|
|
7255
7287
|
}
|
|
7288
|
+
__getRealStrokeWidth(childStyle) {
|
|
7289
|
+
let { strokeWidth, strokeWidthFixed } = this;
|
|
7290
|
+
if (childStyle) {
|
|
7291
|
+
if (childStyle.strokeWidth)
|
|
7292
|
+
strokeWidth = childStyle.strokeWidth;
|
|
7293
|
+
if (childStyle.strokeWidthFixed !== undefined)
|
|
7294
|
+
strokeWidthFixed = childStyle.strokeWidthFixed;
|
|
7295
|
+
}
|
|
7296
|
+
if (strokeWidthFixed) {
|
|
7297
|
+
const scale = this.__leaf.getClampRenderScale();
|
|
7298
|
+
return scale > 1 ? strokeWidth / scale : strokeWidth;
|
|
7299
|
+
}
|
|
7300
|
+
else
|
|
7301
|
+
return strokeWidth;
|
|
7302
|
+
}
|
|
7256
7303
|
__setPaint(attrName, value) {
|
|
7257
7304
|
this.__setInput(attrName, value);
|
|
7258
7305
|
const layout = this.__leaf.__layout;
|
|
@@ -7277,6 +7324,7 @@ var LeaferUI = (function (exports) {
|
|
|
7277
7324
|
}
|
|
7278
7325
|
else {
|
|
7279
7326
|
stintSet$2(this, '__isAlphaPixelStroke', undefined);
|
|
7327
|
+
stintSet$2(this, '__hasMultiStrokeStyle', undefined);
|
|
7280
7328
|
this._stroke = this.__isStrokes = undefined;
|
|
7281
7329
|
}
|
|
7282
7330
|
}
|
|
@@ -7298,8 +7346,8 @@ var LeaferUI = (function (exports) {
|
|
|
7298
7346
|
|
|
7299
7347
|
class BoxData extends GroupData {
|
|
7300
7348
|
get __boxStroke() { return !this.__pathInputed; }
|
|
7301
|
-
get __drawAfterFill() { const t = this; return
|
|
7302
|
-
get __clipAfterFill() { return
|
|
7349
|
+
get __drawAfterFill() { const t = this; return t.__single || t.__clipAfterFill; }
|
|
7350
|
+
get __clipAfterFill() { const t = this; return t.overflow === 'hide' && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill); }
|
|
7303
7351
|
}
|
|
7304
7352
|
|
|
7305
7353
|
class LeaferData extends GroupData {
|
|
@@ -7419,7 +7467,7 @@ var LeaferUI = (function (exports) {
|
|
|
7419
7467
|
const UIBounds = {
|
|
7420
7468
|
__updateStrokeSpread() {
|
|
7421
7469
|
let width = 0, boxWidth = 0;
|
|
7422
|
-
const data = this.__, { strokeAlign, strokeWidth } = data, box = this.__box;
|
|
7470
|
+
const data = this.__, { strokeAlign, __maxStrokeWidth: strokeWidth } = data, box = this.__box;
|
|
7423
7471
|
if ((data.stroke || data.hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
|
|
7424
7472
|
boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth;
|
|
7425
7473
|
if (!data.__boxStroke) {
|
|
@@ -7439,13 +7487,15 @@ var LeaferUI = (function (exports) {
|
|
|
7439
7487
|
},
|
|
7440
7488
|
__updateRenderSpread() {
|
|
7441
7489
|
let width = 0;
|
|
7442
|
-
const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
|
|
7490
|
+
const { shadow, innerShadow, blur, backgroundBlur, filter, renderSpread } = this.__;
|
|
7443
7491
|
if (shadow)
|
|
7444
7492
|
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));
|
|
7445
7493
|
if (blur)
|
|
7446
7494
|
width = Math.max(width, blur);
|
|
7447
7495
|
if (filter)
|
|
7448
7496
|
width += Filter.getSpread(filter);
|
|
7497
|
+
if (renderSpread)
|
|
7498
|
+
width += renderSpread;
|
|
7449
7499
|
let shapeWidth = width = Math.ceil(width);
|
|
7450
7500
|
if (innerShadow)
|
|
7451
7501
|
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));
|
|
@@ -7468,7 +7518,7 @@ var LeaferUI = (function (exports) {
|
|
|
7468
7518
|
}
|
|
7469
7519
|
if (data.__useEffect) {
|
|
7470
7520
|
const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
7471
|
-
stintSet$1(data, '__isFastShadow', shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread &&
|
|
7521
|
+
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')));
|
|
7472
7522
|
data.__useEffect = !!(shadow || otherEffect);
|
|
7473
7523
|
}
|
|
7474
7524
|
data.__checkSingle();
|
|
@@ -7575,17 +7625,17 @@ var LeaferUI = (function (exports) {
|
|
|
7575
7625
|
if (__drawAfterFill)
|
|
7576
7626
|
this.__drawAfterFill(canvas, options);
|
|
7577
7627
|
if (stroke) {
|
|
7578
|
-
const { strokeAlign, __strokeWidth } = this.__;
|
|
7579
|
-
if (!
|
|
7628
|
+
const { strokeAlign, __strokeWidth: strokeWidth } = this.__;
|
|
7629
|
+
if (!strokeWidth)
|
|
7580
7630
|
return;
|
|
7581
|
-
canvas.setStroke(stroke,
|
|
7582
|
-
const half =
|
|
7631
|
+
canvas.setStroke(stroke, strokeWidth, this.__);
|
|
7632
|
+
const half = strokeWidth / 2;
|
|
7583
7633
|
switch (strokeAlign) {
|
|
7584
7634
|
case 'center':
|
|
7585
7635
|
canvas.strokeRect(0, 0, width, height);
|
|
7586
7636
|
break;
|
|
7587
7637
|
case 'inside':
|
|
7588
|
-
width -=
|
|
7638
|
+
width -= strokeWidth, height -= strokeWidth;
|
|
7589
7639
|
if (width < 0 || height < 0) {
|
|
7590
7640
|
canvas.save();
|
|
7591
7641
|
this.__clip(canvas, options);
|
|
@@ -7596,7 +7646,7 @@ var LeaferUI = (function (exports) {
|
|
|
7596
7646
|
canvas.strokeRect(x + half, y + half, width, height);
|
|
7597
7647
|
break;
|
|
7598
7648
|
case 'outside':
|
|
7599
|
-
canvas.strokeRect(x - half, y - half, width +
|
|
7649
|
+
canvas.strokeRect(x - half, y - half, width + strokeWidth, height + strokeWidth);
|
|
7600
7650
|
break;
|
|
7601
7651
|
}
|
|
7602
7652
|
}
|
|
@@ -7609,6 +7659,8 @@ var LeaferUI = (function (exports) {
|
|
|
7609
7659
|
get isFrame() { return false; }
|
|
7610
7660
|
set scale(value) { MathHelper.assignScale(this, value); }
|
|
7611
7661
|
get scale() { return this.__.scale; }
|
|
7662
|
+
get isAutoWidth() { const t = this.__; return t.__autoWidth || t.autoWidth; }
|
|
7663
|
+
get isAutoHeight() { const t = this.__; return t.__autoHeight || t.autoHeight; }
|
|
7612
7664
|
get pen() {
|
|
7613
7665
|
const { path } = this.__;
|
|
7614
7666
|
pen.set(this.path = path || []);
|
|
@@ -7823,6 +7875,9 @@ var LeaferUI = (function (exports) {
|
|
|
7823
7875
|
__decorate([
|
|
7824
7876
|
naturalBoundsType(1)
|
|
7825
7877
|
], exports.UI.prototype, "pixelRatio", void 0);
|
|
7878
|
+
__decorate([
|
|
7879
|
+
affectRenderBoundsType(0)
|
|
7880
|
+
], exports.UI.prototype, "renderSpread", void 0);
|
|
7826
7881
|
__decorate([
|
|
7827
7882
|
pathInputType()
|
|
7828
7883
|
], exports.UI.prototype, "path", void 0);
|
|
@@ -7979,7 +8034,8 @@ var LeaferUI = (function (exports) {
|
|
|
7979
8034
|
}
|
|
7980
8035
|
toJSON(options) {
|
|
7981
8036
|
const data = super.toJSON(options);
|
|
7982
|
-
|
|
8037
|
+
if (!this.childlessJSON)
|
|
8038
|
+
data.children = this.children.map(child => child.toJSON(options));
|
|
7983
8039
|
return data;
|
|
7984
8040
|
}
|
|
7985
8041
|
pick(_hitPoint, _options) { return undefined; }
|
|
@@ -8426,8 +8482,8 @@ var LeaferUI = (function (exports) {
|
|
|
8426
8482
|
__updateRenderSpread() { return this.__updateRectRenderSpread() || -1; }
|
|
8427
8483
|
__updateRectBoxBounds() { }
|
|
8428
8484
|
__updateBoxBounds(_secondLayout) {
|
|
8429
|
-
const data = this.__;
|
|
8430
8485
|
if (this.children.length && !this.pathInputed) {
|
|
8486
|
+
const data = this.__;
|
|
8431
8487
|
if (data.__autoSide) {
|
|
8432
8488
|
if (data.__hasSurface)
|
|
8433
8489
|
this.__extraUpdate();
|
|
@@ -8454,20 +8510,26 @@ var LeaferUI = (function (exports) {
|
|
|
8454
8510
|
__updateStrokeBounds() { }
|
|
8455
8511
|
__updateRenderBounds() {
|
|
8456
8512
|
let isOverflow;
|
|
8457
|
-
const { renderBounds } = this.__layout;
|
|
8458
8513
|
if (this.children.length) {
|
|
8514
|
+
const data = this.__, { renderBounds, boxBounds } = this.__layout;
|
|
8459
8515
|
super.__updateRenderBounds();
|
|
8460
8516
|
copy$3(childrenRenderBounds, renderBounds);
|
|
8461
8517
|
this.__updateRectRenderBounds();
|
|
8462
|
-
|
|
8463
|
-
|
|
8518
|
+
if (data.scrollY || data.scrollX) {
|
|
8519
|
+
childrenRenderBounds.x += data.scrollX;
|
|
8520
|
+
childrenRenderBounds.y += data.scrollY;
|
|
8521
|
+
}
|
|
8522
|
+
isOverflow = !includes$1(boxBounds, childrenRenderBounds);
|
|
8523
|
+
if (isOverflow && data.overflow !== 'hide')
|
|
8464
8524
|
add(renderBounds, childrenRenderBounds);
|
|
8465
8525
|
}
|
|
8466
8526
|
else
|
|
8467
8527
|
this.__updateRectRenderBounds();
|
|
8468
8528
|
DataHelper.stintSet(this, 'isOverflow', isOverflow);
|
|
8529
|
+
this.__updateScrollBar();
|
|
8469
8530
|
}
|
|
8470
8531
|
__updateRectRenderBounds() { }
|
|
8532
|
+
__updateScrollBar() { }
|
|
8471
8533
|
__updateRectChange() { }
|
|
8472
8534
|
__updateChange() {
|
|
8473
8535
|
super.__updateChange();
|
|
@@ -8484,10 +8546,12 @@ var LeaferUI = (function (exports) {
|
|
|
8484
8546
|
if (this.children.length)
|
|
8485
8547
|
this.__renderGroup(canvas, options);
|
|
8486
8548
|
}
|
|
8549
|
+
if (this.scrollBar)
|
|
8550
|
+
this.scrollBar.__render(canvas, options);
|
|
8487
8551
|
}
|
|
8488
8552
|
__drawContent(canvas, options) {
|
|
8489
8553
|
this.__renderGroup(canvas, options);
|
|
8490
|
-
if (this.__.__useStroke) {
|
|
8554
|
+
if (this.__.__useStroke || this.__.__useEffect) {
|
|
8491
8555
|
canvas.setWorld(this.__nowWorld);
|
|
8492
8556
|
this.__drawRenderPath(canvas);
|
|
8493
8557
|
}
|
|
@@ -10290,18 +10354,20 @@ var LeaferUI = (function (exports) {
|
|
|
10290
10354
|
}
|
|
10291
10355
|
return this.__hit(inner);
|
|
10292
10356
|
};
|
|
10293
|
-
leaf.__hitFill = function (inner) {
|
|
10294
|
-
leaf.__hitStroke = function (inner, strokeWidth) {
|
|
10295
|
-
leaf.__hitPixel = function (inner) {
|
|
10296
|
-
leaf.__drawHitPath = function (canvas) {
|
|
10297
|
-
this.__drawRenderPath(canvas); };
|
|
10357
|
+
leaf.__hitFill = function (inner) { const h = this.__hitCanvas; return h && h.hitFill(inner, this.__.windingRule); };
|
|
10358
|
+
leaf.__hitStroke = function (inner, strokeWidth) { const h = this.__hitCanvas; return h && h.hitStroke(inner, strokeWidth); };
|
|
10359
|
+
leaf.__hitPixel = function (inner) { const h = this.__hitCanvas; return h && h.hitPixel(inner, this.__layout.renderBounds, h.hitScale); };
|
|
10360
|
+
leaf.__drawHitPath = function (canvas) { canvas && this.__drawRenderPath(canvas); };
|
|
10298
10361
|
|
|
10299
10362
|
const matrix = new Matrix();
|
|
10300
10363
|
const ui$1 = exports.UI.prototype;
|
|
10301
10364
|
ui$1.__updateHitCanvas = function () {
|
|
10302
10365
|
if (this.__box)
|
|
10303
10366
|
this.__box.__updateHitCanvas();
|
|
10304
|
-
const
|
|
10367
|
+
const leafer = this.leafer || (this.parent && this.parent.leafer);
|
|
10368
|
+
if (!leafer)
|
|
10369
|
+
return;
|
|
10370
|
+
const data = this.__, { hitCanvasManager } = leafer;
|
|
10305
10371
|
const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === 'pixel';
|
|
10306
10372
|
const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === 'pixel';
|
|
10307
10373
|
const isHitPixel = isHitPixelFill || isHitPixelStroke;
|
|
@@ -10337,7 +10403,7 @@ var LeaferUI = (function (exports) {
|
|
|
10337
10403
|
const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.__isAlphaPixelFill || data.__isCanvas)))) || hitFill === 'all';
|
|
10338
10404
|
if (needHitFillPath && this.__hitFill(inner))
|
|
10339
10405
|
return true;
|
|
10340
|
-
const { hitStroke,
|
|
10406
|
+
const { hitStroke, __maxStrokeWidth: strokeWidth } = data;
|
|
10341
10407
|
const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.__isAlphaPixelStroke))) || hitStroke === 'all';
|
|
10342
10408
|
if (!needHitFillPath && !needHitStrokePath)
|
|
10343
10409
|
return false;
|
|
@@ -10346,16 +10412,16 @@ var LeaferUI = (function (exports) {
|
|
|
10346
10412
|
if (needHitStrokePath) {
|
|
10347
10413
|
switch (data.strokeAlign) {
|
|
10348
10414
|
case 'inside':
|
|
10349
|
-
hitWidth +=
|
|
10415
|
+
hitWidth += strokeWidth * 2;
|
|
10350
10416
|
if (!needHitFillPath && this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
|
|
10351
10417
|
return true;
|
|
10352
10418
|
hitWidth = radiusWidth;
|
|
10353
10419
|
break;
|
|
10354
10420
|
case 'center':
|
|
10355
|
-
hitWidth +=
|
|
10421
|
+
hitWidth += strokeWidth;
|
|
10356
10422
|
break;
|
|
10357
10423
|
case 'outside':
|
|
10358
|
-
hitWidth +=
|
|
10424
|
+
hitWidth += strokeWidth * 2;
|
|
10359
10425
|
if (!needHitFillPath) {
|
|
10360
10426
|
if (!this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
|
|
10361
10427
|
return true;
|
|
@@ -10455,9 +10521,14 @@ var LeaferUI = (function (exports) {
|
|
|
10455
10521
|
}
|
|
10456
10522
|
}
|
|
10457
10523
|
canvas.fillStyle = item.style;
|
|
10458
|
-
if (item.transform) {
|
|
10524
|
+
if (item.transform || item.scaleFixed) {
|
|
10459
10525
|
canvas.save();
|
|
10460
|
-
|
|
10526
|
+
if (item.transform)
|
|
10527
|
+
canvas.transform(item.transform);
|
|
10528
|
+
if (item.scaleFixed) {
|
|
10529
|
+
const { scaleX, scaleY } = ui.getRenderScaleData(true);
|
|
10530
|
+
canvas.scale(1 / scaleX, 1 / scaleY);
|
|
10531
|
+
}
|
|
10461
10532
|
if (item.blendMode)
|
|
10462
10533
|
canvas.blendMode = item.blendMode;
|
|
10463
10534
|
fillPathOrText(ui, canvas);
|
|
@@ -10493,8 +10564,13 @@ var LeaferUI = (function (exports) {
|
|
|
10493
10564
|
}
|
|
10494
10565
|
function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
|
|
10495
10566
|
const data = ui.__;
|
|
10496
|
-
|
|
10497
|
-
|
|
10567
|
+
if (typeof stroke === 'object') {
|
|
10568
|
+
drawStrokesStyle(stroke, strokeWidthScale, true, ui, canvas);
|
|
10569
|
+
}
|
|
10570
|
+
else {
|
|
10571
|
+
canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
10572
|
+
drawTextStroke(ui, canvas);
|
|
10573
|
+
}
|
|
10498
10574
|
}
|
|
10499
10575
|
function drawAlign(stroke, align, ui, canvas) {
|
|
10500
10576
|
const out = canvas.getSameCanvas(true, true);
|
|
@@ -10503,15 +10579,9 @@ var LeaferUI = (function (exports) {
|
|
|
10503
10579
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
10504
10580
|
fillText(ui, out);
|
|
10505
10581
|
out.blendMode = 'normal';
|
|
10506
|
-
|
|
10582
|
+
LeafHelper.copyCanvasByWorld(ui, canvas, out);
|
|
10507
10583
|
out.recycle(ui.__nowWorld);
|
|
10508
10584
|
}
|
|
10509
|
-
function copyWorld(canvas, out, ui) {
|
|
10510
|
-
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
10511
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
10512
|
-
else
|
|
10513
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
10514
|
-
}
|
|
10515
10585
|
function drawTextStroke(ui, canvas) {
|
|
10516
10586
|
let row, data = ui.__.__textDrawData;
|
|
10517
10587
|
const { rows, decorationY } = data;
|
|
@@ -10527,14 +10597,21 @@ var LeaferUI = (function (exports) {
|
|
|
10527
10597
|
rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
10528
10598
|
}
|
|
10529
10599
|
}
|
|
10530
|
-
function drawStrokesStyle(strokes, isText, ui, canvas) {
|
|
10600
|
+
function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas) {
|
|
10531
10601
|
let item;
|
|
10602
|
+
const data = ui.__, { __hasMultiStrokeStyle } = data;
|
|
10603
|
+
__hasMultiStrokeStyle || canvas.setStroke(undefined, data.__strokeWidth * strokeWidthScale, data);
|
|
10532
10604
|
for (let i = 0, len = strokes.length; i < len; i++) {
|
|
10533
10605
|
item = strokes[i];
|
|
10534
10606
|
if (item.image && PaintImage.checkImage(ui, canvas, item, false))
|
|
10535
10607
|
continue;
|
|
10536
10608
|
if (item.style) {
|
|
10537
|
-
|
|
10609
|
+
if (__hasMultiStrokeStyle) {
|
|
10610
|
+
const { strokeStyle } = item;
|
|
10611
|
+
strokeStyle ? canvas.setStroke(item.style, data.__getRealStrokeWidth(strokeStyle) * strokeWidthScale, data, strokeStyle) : canvas.setStroke(item.style, data.__strokeWidth * strokeWidthScale, data);
|
|
10612
|
+
}
|
|
10613
|
+
else
|
|
10614
|
+
canvas.strokeStyle = item.style;
|
|
10538
10615
|
if (item.blendMode) {
|
|
10539
10616
|
canvas.saveBlendMode(item.blendMode);
|
|
10540
10617
|
isText ? drawTextStroke(ui, canvas) : canvas.stroke();
|
|
@@ -10573,8 +10650,13 @@ var LeaferUI = (function (exports) {
|
|
|
10573
10650
|
}
|
|
10574
10651
|
function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
10575
10652
|
const data = ui.__;
|
|
10576
|
-
|
|
10577
|
-
|
|
10653
|
+
if (typeof stroke === 'object') {
|
|
10654
|
+
drawStrokesStyle(stroke, strokeWidthScale, false, ui, canvas);
|
|
10655
|
+
}
|
|
10656
|
+
else {
|
|
10657
|
+
canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
10658
|
+
canvas.stroke();
|
|
10659
|
+
}
|
|
10578
10660
|
if (data.__useArrow)
|
|
10579
10661
|
Paint.strokeArrow(stroke, ui, canvas);
|
|
10580
10662
|
}
|
|
@@ -10596,7 +10678,7 @@ var LeaferUI = (function (exports) {
|
|
|
10596
10678
|
drawCenter(stroke, 2, ui, out);
|
|
10597
10679
|
out.clipUI(data);
|
|
10598
10680
|
out.clearWorld(renderBounds);
|
|
10599
|
-
|
|
10681
|
+
LeafHelper.copyCanvasByWorld(ui, canvas, out);
|
|
10600
10682
|
out.recycle(ui.__nowWorld);
|
|
10601
10683
|
}
|
|
10602
10684
|
}
|
|
@@ -10651,8 +10733,16 @@ var LeaferUI = (function (exports) {
|
|
|
10651
10733
|
if (!(paints instanceof Array))
|
|
10652
10734
|
paints = [paints];
|
|
10653
10735
|
recycleMap = PaintImage.recycleImage(attrName, data);
|
|
10736
|
+
let maxChildStrokeWidth;
|
|
10654
10737
|
for (let i = 0, len = paints.length, item; i < len; i++) {
|
|
10655
|
-
(item = getLeafPaint(attrName, paints[i], ui))
|
|
10738
|
+
if (item = getLeafPaint(attrName, paints[i], ui)) {
|
|
10739
|
+
leafPaints.push(item);
|
|
10740
|
+
if (item.strokeStyle) {
|
|
10741
|
+
maxChildStrokeWidth || (maxChildStrokeWidth = 1);
|
|
10742
|
+
if (item.strokeStyle.strokeWidth)
|
|
10743
|
+
maxChildStrokeWidth = Math.max(maxChildStrokeWidth, item.strokeStyle.strokeWidth);
|
|
10744
|
+
}
|
|
10745
|
+
}
|
|
10656
10746
|
}
|
|
10657
10747
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
10658
10748
|
if (leafPaints.length) {
|
|
@@ -10669,6 +10759,7 @@ var LeaferUI = (function (exports) {
|
|
|
10669
10759
|
else {
|
|
10670
10760
|
stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
|
|
10671
10761
|
stintSet(data, '__isTransparentStroke', isTransparent);
|
|
10762
|
+
stintSet(data, '__hasMultiStrokeStyle', maxChildStrokeWidth);
|
|
10672
10763
|
}
|
|
10673
10764
|
}
|
|
10674
10765
|
function getLeafPaint(attrName, paint, ui) {
|
|
@@ -10700,6 +10791,11 @@ var LeaferUI = (function (exports) {
|
|
|
10700
10791
|
if (data) {
|
|
10701
10792
|
if (typeof data.style === 'string' && hasTransparent$1(data.style))
|
|
10702
10793
|
data.isTransparent = true;
|
|
10794
|
+
if (paint.style) {
|
|
10795
|
+
if (paint.style.strokeWidth === 0)
|
|
10796
|
+
return undefined;
|
|
10797
|
+
data.strokeStyle = paint.style;
|
|
10798
|
+
}
|
|
10703
10799
|
if (paint.blendMode)
|
|
10704
10800
|
data.blendMode = paint.blendMode;
|
|
10705
10801
|
}
|
|
@@ -10719,8 +10815,8 @@ var LeaferUI = (function (exports) {
|
|
|
10719
10815
|
shape
|
|
10720
10816
|
};
|
|
10721
10817
|
|
|
10722
|
-
let origin = {};
|
|
10723
|
-
const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, scale: scaleHelper, rotate, skew: skewHelper } = MatrixHelper;
|
|
10818
|
+
let origin = {}, tempMatrix = getMatrixData();
|
|
10819
|
+
const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent, scale: scaleHelper, rotate, skew: skewHelper } = MatrixHelper;
|
|
10724
10820
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
10725
10821
|
const transform = get$3();
|
|
10726
10822
|
translate$1(transform, box.x + x, box.y + y);
|
|
@@ -10729,7 +10825,7 @@ var LeaferUI = (function (exports) {
|
|
|
10729
10825
|
rotateOfOuter$1(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
|
|
10730
10826
|
data.transform = transform;
|
|
10731
10827
|
}
|
|
10732
|
-
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew) {
|
|
10828
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipSize) {
|
|
10733
10829
|
const transform = get$3();
|
|
10734
10830
|
if (rotation)
|
|
10735
10831
|
rotate(transform, rotation);
|
|
@@ -10738,6 +10834,10 @@ var LeaferUI = (function (exports) {
|
|
|
10738
10834
|
if (scaleX)
|
|
10739
10835
|
scaleHelper(transform, scaleX, scaleY);
|
|
10740
10836
|
translate$1(transform, box.x + x, box.y + y);
|
|
10837
|
+
if (clipSize) {
|
|
10838
|
+
tempMatrix.a = box.width / clipSize.width, tempMatrix.d = box.height / clipSize.height;
|
|
10839
|
+
multiplyParent(transform, tempMatrix);
|
|
10840
|
+
}
|
|
10741
10841
|
data.transform = transform;
|
|
10742
10842
|
}
|
|
10743
10843
|
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
|
|
@@ -10774,13 +10874,15 @@ var LeaferUI = (function (exports) {
|
|
|
10774
10874
|
const tempScaleData = {};
|
|
10775
10875
|
const tempImage = {};
|
|
10776
10876
|
function createData(leafPaint, image, paint, box) {
|
|
10777
|
-
const { changeful, sync, editing } = paint;
|
|
10877
|
+
const { changeful, sync, editing, scaleFixed } = paint;
|
|
10778
10878
|
if (changeful)
|
|
10779
10879
|
leafPaint.changeful = changeful;
|
|
10780
10880
|
if (sync)
|
|
10781
10881
|
leafPaint.sync = sync;
|
|
10782
10882
|
if (editing)
|
|
10783
10883
|
leafPaint.editing = editing;
|
|
10884
|
+
if (scaleFixed)
|
|
10885
|
+
leafPaint.scaleFixed = scaleFixed;
|
|
10784
10886
|
leafPaint.data = getPatternData(paint, box, image);
|
|
10785
10887
|
}
|
|
10786
10888
|
function getPatternData(paint, box, image) {
|
|
@@ -10789,7 +10891,7 @@ var LeaferUI = (function (exports) {
|
|
|
10789
10891
|
if (paint.mode === 'strench')
|
|
10790
10892
|
paint.mode = 'stretch';
|
|
10791
10893
|
let { width, height } = image;
|
|
10792
|
-
const { opacity, mode, align, offset, scale, size, rotation, skew, repeat, filters } = paint;
|
|
10894
|
+
const { opacity, mode, align, offset, scale, size, rotation, skew, clipSize, repeat, filters } = paint;
|
|
10793
10895
|
const sameBox = box.width === width && box.height === height;
|
|
10794
10896
|
const data = { mode };
|
|
10795
10897
|
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
@@ -10823,8 +10925,8 @@ var LeaferUI = (function (exports) {
|
|
|
10823
10925
|
break;
|
|
10824
10926
|
case 'normal':
|
|
10825
10927
|
case 'clip':
|
|
10826
|
-
if (tempImage.x || tempImage.y || scaleX || rotation || skew)
|
|
10827
|
-
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew);
|
|
10928
|
+
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
|
|
10929
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, paint.clipSize);
|
|
10828
10930
|
break;
|
|
10829
10931
|
case 'repeat':
|
|
10830
10932
|
if (!sameBox || scaleX || rotation)
|
|
@@ -10961,18 +11063,16 @@ var LeaferUI = (function (exports) {
|
|
|
10961
11063
|
}
|
|
10962
11064
|
|
|
10963
11065
|
const { get: get$1, scale, copy: copy$1 } = MatrixHelper;
|
|
10964
|
-
const { ceil, abs
|
|
11066
|
+
const { ceil, abs } = Math;
|
|
10965
11067
|
function createPattern(ui, paint, pixelRatio) {
|
|
10966
|
-
let { scaleX, scaleY } =
|
|
11068
|
+
let { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
10967
11069
|
const id = scaleX + '-' + scaleY + '-' + pixelRatio;
|
|
10968
11070
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
10969
|
-
scaleX = abs$1(scaleX);
|
|
10970
|
-
scaleY = abs$1(scaleY);
|
|
10971
11071
|
const { image, data } = paint;
|
|
10972
11072
|
let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
|
|
10973
11073
|
if (sx) {
|
|
10974
|
-
sx = abs
|
|
10975
|
-
sy = abs
|
|
11074
|
+
sx = abs(sx);
|
|
11075
|
+
sy = abs(sy);
|
|
10976
11076
|
imageMatrix = get$1();
|
|
10977
11077
|
copy$1(imageMatrix, transform);
|
|
10978
11078
|
scale(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -11025,9 +11125,8 @@ var LeaferUI = (function (exports) {
|
|
|
11025
11125
|
}
|
|
11026
11126
|
}
|
|
11027
11127
|
|
|
11028
|
-
const { abs } = Math;
|
|
11029
11128
|
function checkImage(ui, canvas, paint, allowDraw) {
|
|
11030
|
-
const { scaleX, scaleY } =
|
|
11129
|
+
const { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
11031
11130
|
const { pixelRatio } = canvas, { data } = paint;
|
|
11032
11131
|
if (!data || (paint.patternId === scaleX + '-' + scaleY + '-' + pixelRatio && !Export.running)) {
|
|
11033
11132
|
return false;
|
|
@@ -11040,8 +11139,8 @@ var LeaferUI = (function (exports) {
|
|
|
11040
11139
|
else {
|
|
11041
11140
|
if (!(paint.changeful || ResizeEvent.isResizing(ui) || Export.running)) {
|
|
11042
11141
|
let { width, height } = data;
|
|
11043
|
-
width *=
|
|
11044
|
-
height *=
|
|
11142
|
+
width *= scaleX * pixelRatio;
|
|
11143
|
+
height *= scaleY * pixelRatio;
|
|
11045
11144
|
if (data.scaleX) {
|
|
11046
11145
|
width *= data.scaleX;
|
|
11047
11146
|
height *= data.scaleY;
|
|
@@ -11051,6 +11150,10 @@ var LeaferUI = (function (exports) {
|
|
|
11051
11150
|
}
|
|
11052
11151
|
}
|
|
11053
11152
|
if (allowDraw) {
|
|
11153
|
+
if (ui.__.__isFastShadow) {
|
|
11154
|
+
canvas.fillStyle = paint.style || '#000';
|
|
11155
|
+
canvas.fill();
|
|
11156
|
+
}
|
|
11054
11157
|
drawImage(ui, canvas, paint, data);
|
|
11055
11158
|
return true;
|
|
11056
11159
|
}
|
|
@@ -11239,10 +11342,7 @@ var LeaferUI = (function (exports) {
|
|
|
11239
11342
|
}
|
|
11240
11343
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
|
|
11241
11344
|
}
|
|
11242
|
-
|
|
11243
|
-
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
11244
|
-
else
|
|
11245
|
-
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
11345
|
+
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
11246
11346
|
if (end && index < end)
|
|
11247
11347
|
other.clearWorld(copyBounds, true);
|
|
11248
11348
|
});
|
|
@@ -11301,10 +11401,7 @@ var LeaferUI = (function (exports) {
|
|
|
11301
11401
|
copyBounds = bounds;
|
|
11302
11402
|
}
|
|
11303
11403
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
|
|
11304
|
-
|
|
11305
|
-
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
11306
|
-
else
|
|
11307
|
-
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
11404
|
+
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
11308
11405
|
if (end && index < end)
|
|
11309
11406
|
other.clearWorld(copyBounds, true);
|
|
11310
11407
|
});
|
|
@@ -11360,12 +11457,11 @@ var LeaferUI = (function (exports) {
|
|
|
11360
11457
|
contentCanvas = getCanvas(canvas);
|
|
11361
11458
|
child.__render(maskCanvas, options);
|
|
11362
11459
|
}
|
|
11363
|
-
if (
|
|
11364
|
-
|
|
11365
|
-
}
|
|
11366
|
-
if (excludeRenderBounds(child, options))
|
|
11460
|
+
if (mask === 'clipping' || mask === 'clipping-path')
|
|
11461
|
+
excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
11367
11462
|
continue;
|
|
11368
|
-
|
|
11463
|
+
}
|
|
11464
|
+
excludeRenderBounds(child, options) || child.__render(contentCanvas || canvas, options);
|
|
11369
11465
|
}
|
|
11370
11466
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
|
|
11371
11467
|
};
|
|
@@ -12077,6 +12173,8 @@ var LeaferUI = (function (exports) {
|
|
|
12077
12173
|
exports.boundsType = boundsType;
|
|
12078
12174
|
exports.canvasPatch = canvasPatch;
|
|
12079
12175
|
exports.canvasSizeAttrs = canvasSizeAttrs;
|
|
12176
|
+
exports.createAttr = createAttr;
|
|
12177
|
+
exports.createDescriptor = createDescriptor;
|
|
12080
12178
|
exports.cursorType = cursorType;
|
|
12081
12179
|
exports.dataProcessor = dataProcessor;
|
|
12082
12180
|
exports.dataType = dataType;
|
|
@@ -12115,7 +12213,7 @@ var LeaferUI = (function (exports) {
|
|
|
12115
12213
|
exports.strokeType = strokeType;
|
|
12116
12214
|
exports.surfaceType = surfaceType;
|
|
12117
12215
|
exports.tempBounds = tempBounds$1;
|
|
12118
|
-
exports.tempMatrix = tempMatrix;
|
|
12216
|
+
exports.tempMatrix = tempMatrix$1;
|
|
12119
12217
|
exports.tempPoint = tempPoint$2;
|
|
12120
12218
|
exports.useCanvas = useCanvas;
|
|
12121
12219
|
exports.useModule = useModule;
|