leafer-draw 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/web.cjs +77 -47
- package/dist/web.esm.js +78 -48
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +230 -134
- package/dist/web.min.cjs +1 -1
- package/dist/web.min.cjs.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +228 -134
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +3 -3
package/dist/web.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
|
const debug$4 = Debug.get('LeaferCanvas');
|
|
6257
6297
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
@@ -7123,6 +7163,11 @@ var LeaferUI = (function (exports) {
|
|
|
7123
7163
|
});
|
|
7124
7164
|
};
|
|
7125
7165
|
}
|
|
7166
|
+
function createAttr(defaultValue) {
|
|
7167
|
+
return (target, key) => {
|
|
7168
|
+
defineKey(target, key, createDescriptor(key, defaultValue));
|
|
7169
|
+
};
|
|
7170
|
+
}
|
|
7126
7171
|
|
|
7127
7172
|
function hasTransparent$3(color) {
|
|
7128
7173
|
if (!color || color.length === 7 || color.length === 4)
|
|
@@ -7180,22 +7225,9 @@ var LeaferUI = (function (exports) {
|
|
|
7180
7225
|
const debug$1 = Debug.get('UIData');
|
|
7181
7226
|
class UIData extends LeafData {
|
|
7182
7227
|
get scale() { const { scaleX, scaleY } = this; return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX; }
|
|
7183
|
-
get __strokeWidth() {
|
|
7184
|
-
|
|
7185
|
-
|
|
7186
|
-
const ui = this.__leaf;
|
|
7187
|
-
let { scaleX } = ui.__nowWorld || ui.__world;
|
|
7188
|
-
if (scaleX < 0)
|
|
7189
|
-
scaleX = -scaleX;
|
|
7190
|
-
return scaleX > 1 ? strokeWidth / scaleX : strokeWidth;
|
|
7191
|
-
}
|
|
7192
|
-
else
|
|
7193
|
-
return strokeWidth;
|
|
7194
|
-
}
|
|
7195
|
-
get __hasMultiPaint() {
|
|
7196
|
-
const t = this;
|
|
7197
|
-
return (t.fill && this.__useStroke) || (t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect;
|
|
7198
|
-
}
|
|
7228
|
+
get __strokeWidth() { return this.__getRealStrokeWidth(); }
|
|
7229
|
+
get __maxStrokeWidth() { const t = this; return t.__hasMultiStrokeStyle ? Math.max(t.__hasMultiStrokeStyle, t.strokeWidth) : t.strokeWidth; }
|
|
7230
|
+
get __hasMultiPaint() { const t = this; return (t.fill && this.__useStroke) || (t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect; }
|
|
7199
7231
|
get __clipAfterFill() { const t = this; return (t.cornerRadius || t.innerShadow || t.__pathInputed); }
|
|
7200
7232
|
get __hasSurface() { const t = this; return (t.fill || t.stroke); }
|
|
7201
7233
|
get __autoWidth() { return !this._width; }
|
|
@@ -7277,6 +7309,21 @@ var LeaferUI = (function (exports) {
|
|
|
7277
7309
|
Paint.compute('stroke', this.__leaf);
|
|
7278
7310
|
this.__needComputePaint = undefined;
|
|
7279
7311
|
}
|
|
7312
|
+
__getRealStrokeWidth(childStyle) {
|
|
7313
|
+
let { strokeWidth, strokeWidthFixed } = this;
|
|
7314
|
+
if (childStyle) {
|
|
7315
|
+
if (childStyle.strokeWidth)
|
|
7316
|
+
strokeWidth = childStyle.strokeWidth;
|
|
7317
|
+
if (childStyle.strokeWidthFixed !== undefined)
|
|
7318
|
+
strokeWidthFixed = childStyle.strokeWidthFixed;
|
|
7319
|
+
}
|
|
7320
|
+
if (strokeWidthFixed) {
|
|
7321
|
+
const scale = this.__leaf.getClampRenderScale();
|
|
7322
|
+
return scale > 1 ? strokeWidth / scale : strokeWidth;
|
|
7323
|
+
}
|
|
7324
|
+
else
|
|
7325
|
+
return strokeWidth;
|
|
7326
|
+
}
|
|
7280
7327
|
__setPaint(attrName, value) {
|
|
7281
7328
|
this.__setInput(attrName, value);
|
|
7282
7329
|
const layout = this.__leaf.__layout;
|
|
@@ -7301,6 +7348,7 @@ var LeaferUI = (function (exports) {
|
|
|
7301
7348
|
}
|
|
7302
7349
|
else {
|
|
7303
7350
|
stintSet$2(this, '__isAlphaPixelStroke', undefined);
|
|
7351
|
+
stintSet$2(this, '__hasMultiStrokeStyle', undefined);
|
|
7304
7352
|
this._stroke = this.__isStrokes = undefined;
|
|
7305
7353
|
}
|
|
7306
7354
|
}
|
|
@@ -7322,8 +7370,8 @@ var LeaferUI = (function (exports) {
|
|
|
7322
7370
|
|
|
7323
7371
|
class BoxData extends GroupData {
|
|
7324
7372
|
get __boxStroke() { return !this.__pathInputed; }
|
|
7325
|
-
get __drawAfterFill() { const t = this; return
|
|
7326
|
-
get __clipAfterFill() { return
|
|
7373
|
+
get __drawAfterFill() { const t = this; return t.__single || t.__clipAfterFill; }
|
|
7374
|
+
get __clipAfterFill() { const t = this; return t.overflow === 'hide' && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill); }
|
|
7327
7375
|
}
|
|
7328
7376
|
|
|
7329
7377
|
class LeaferData extends GroupData {
|
|
@@ -7443,7 +7491,7 @@ var LeaferUI = (function (exports) {
|
|
|
7443
7491
|
const UIBounds = {
|
|
7444
7492
|
__updateStrokeSpread() {
|
|
7445
7493
|
let width = 0, boxWidth = 0;
|
|
7446
|
-
const data = this.__, { strokeAlign, strokeWidth } = data, box = this.__box;
|
|
7494
|
+
const data = this.__, { strokeAlign, __maxStrokeWidth: strokeWidth } = data, box = this.__box;
|
|
7447
7495
|
if ((data.stroke || data.hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
|
|
7448
7496
|
boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth;
|
|
7449
7497
|
if (!data.__boxStroke) {
|
|
@@ -7463,13 +7511,15 @@ var LeaferUI = (function (exports) {
|
|
|
7463
7511
|
},
|
|
7464
7512
|
__updateRenderSpread() {
|
|
7465
7513
|
let width = 0;
|
|
7466
|
-
const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
|
|
7514
|
+
const { shadow, innerShadow, blur, backgroundBlur, filter, renderSpread } = this.__;
|
|
7467
7515
|
if (shadow)
|
|
7468
7516
|
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));
|
|
7469
7517
|
if (blur)
|
|
7470
7518
|
width = Math.max(width, blur);
|
|
7471
7519
|
if (filter)
|
|
7472
7520
|
width += Filter.getSpread(filter);
|
|
7521
|
+
if (renderSpread)
|
|
7522
|
+
width += renderSpread;
|
|
7473
7523
|
let shapeWidth = width = Math.ceil(width);
|
|
7474
7524
|
if (innerShadow)
|
|
7475
7525
|
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));
|
|
@@ -7492,7 +7542,7 @@ var LeaferUI = (function (exports) {
|
|
|
7492
7542
|
}
|
|
7493
7543
|
if (data.__useEffect) {
|
|
7494
7544
|
const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
7495
|
-
stintSet$1(data, '__isFastShadow', shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread &&
|
|
7545
|
+
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')));
|
|
7496
7546
|
data.__useEffect = !!(shadow || otherEffect);
|
|
7497
7547
|
}
|
|
7498
7548
|
data.__checkSingle();
|
|
@@ -7599,17 +7649,17 @@ var LeaferUI = (function (exports) {
|
|
|
7599
7649
|
if (__drawAfterFill)
|
|
7600
7650
|
this.__drawAfterFill(canvas, options);
|
|
7601
7651
|
if (stroke) {
|
|
7602
|
-
const { strokeAlign, __strokeWidth } = this.__;
|
|
7603
|
-
if (!
|
|
7652
|
+
const { strokeAlign, __strokeWidth: strokeWidth } = this.__;
|
|
7653
|
+
if (!strokeWidth)
|
|
7604
7654
|
return;
|
|
7605
|
-
canvas.setStroke(stroke,
|
|
7606
|
-
const half =
|
|
7655
|
+
canvas.setStroke(stroke, strokeWidth, this.__);
|
|
7656
|
+
const half = strokeWidth / 2;
|
|
7607
7657
|
switch (strokeAlign) {
|
|
7608
7658
|
case 'center':
|
|
7609
7659
|
canvas.strokeRect(0, 0, width, height);
|
|
7610
7660
|
break;
|
|
7611
7661
|
case 'inside':
|
|
7612
|
-
width -=
|
|
7662
|
+
width -= strokeWidth, height -= strokeWidth;
|
|
7613
7663
|
if (width < 0 || height < 0) {
|
|
7614
7664
|
canvas.save();
|
|
7615
7665
|
this.__clip(canvas, options);
|
|
@@ -7620,7 +7670,7 @@ var LeaferUI = (function (exports) {
|
|
|
7620
7670
|
canvas.strokeRect(x + half, y + half, width, height);
|
|
7621
7671
|
break;
|
|
7622
7672
|
case 'outside':
|
|
7623
|
-
canvas.strokeRect(x - half, y - half, width +
|
|
7673
|
+
canvas.strokeRect(x - half, y - half, width + strokeWidth, height + strokeWidth);
|
|
7624
7674
|
break;
|
|
7625
7675
|
}
|
|
7626
7676
|
}
|
|
@@ -7633,6 +7683,8 @@ var LeaferUI = (function (exports) {
|
|
|
7633
7683
|
get isFrame() { return false; }
|
|
7634
7684
|
set scale(value) { MathHelper.assignScale(this, value); }
|
|
7635
7685
|
get scale() { return this.__.scale; }
|
|
7686
|
+
get isAutoWidth() { const t = this.__; return t.__autoWidth || t.autoWidth; }
|
|
7687
|
+
get isAutoHeight() { const t = this.__; return t.__autoHeight || t.autoHeight; }
|
|
7636
7688
|
get pen() {
|
|
7637
7689
|
const { path } = this.__;
|
|
7638
7690
|
pen.set(this.path = path || []);
|
|
@@ -7847,6 +7899,9 @@ var LeaferUI = (function (exports) {
|
|
|
7847
7899
|
__decorate([
|
|
7848
7900
|
naturalBoundsType(1)
|
|
7849
7901
|
], exports.UI.prototype, "pixelRatio", void 0);
|
|
7902
|
+
__decorate([
|
|
7903
|
+
affectRenderBoundsType(0)
|
|
7904
|
+
], exports.UI.prototype, "renderSpread", void 0);
|
|
7850
7905
|
__decorate([
|
|
7851
7906
|
pathInputType()
|
|
7852
7907
|
], exports.UI.prototype, "path", void 0);
|
|
@@ -8003,7 +8058,8 @@ var LeaferUI = (function (exports) {
|
|
|
8003
8058
|
}
|
|
8004
8059
|
toJSON(options) {
|
|
8005
8060
|
const data = super.toJSON(options);
|
|
8006
|
-
|
|
8061
|
+
if (!this.childlessJSON)
|
|
8062
|
+
data.children = this.children.map(child => child.toJSON(options));
|
|
8007
8063
|
return data;
|
|
8008
8064
|
}
|
|
8009
8065
|
pick(_hitPoint, _options) { return undefined; }
|
|
@@ -8450,8 +8506,8 @@ var LeaferUI = (function (exports) {
|
|
|
8450
8506
|
__updateRenderSpread() { return this.__updateRectRenderSpread() || -1; }
|
|
8451
8507
|
__updateRectBoxBounds() { }
|
|
8452
8508
|
__updateBoxBounds(_secondLayout) {
|
|
8453
|
-
const data = this.__;
|
|
8454
8509
|
if (this.children.length && !this.pathInputed) {
|
|
8510
|
+
const data = this.__;
|
|
8455
8511
|
if (data.__autoSide) {
|
|
8456
8512
|
if (data.__hasSurface)
|
|
8457
8513
|
this.__extraUpdate();
|
|
@@ -8478,20 +8534,26 @@ var LeaferUI = (function (exports) {
|
|
|
8478
8534
|
__updateStrokeBounds() { }
|
|
8479
8535
|
__updateRenderBounds() {
|
|
8480
8536
|
let isOverflow;
|
|
8481
|
-
const { renderBounds } = this.__layout;
|
|
8482
8537
|
if (this.children.length) {
|
|
8538
|
+
const data = this.__, { renderBounds, boxBounds } = this.__layout;
|
|
8483
8539
|
super.__updateRenderBounds();
|
|
8484
8540
|
copy$2(childrenRenderBounds, renderBounds);
|
|
8485
8541
|
this.__updateRectRenderBounds();
|
|
8486
|
-
|
|
8487
|
-
|
|
8542
|
+
if (data.scrollY || data.scrollX) {
|
|
8543
|
+
childrenRenderBounds.x += data.scrollX;
|
|
8544
|
+
childrenRenderBounds.y += data.scrollY;
|
|
8545
|
+
}
|
|
8546
|
+
isOverflow = !includes$1(boxBounds, childrenRenderBounds);
|
|
8547
|
+
if (isOverflow && data.overflow !== 'hide')
|
|
8488
8548
|
add(renderBounds, childrenRenderBounds);
|
|
8489
8549
|
}
|
|
8490
8550
|
else
|
|
8491
8551
|
this.__updateRectRenderBounds();
|
|
8492
8552
|
DataHelper.stintSet(this, 'isOverflow', isOverflow);
|
|
8553
|
+
this.__updateScrollBar();
|
|
8493
8554
|
}
|
|
8494
8555
|
__updateRectRenderBounds() { }
|
|
8556
|
+
__updateScrollBar() { }
|
|
8495
8557
|
__updateRectChange() { }
|
|
8496
8558
|
__updateChange() {
|
|
8497
8559
|
super.__updateChange();
|
|
@@ -8508,10 +8570,12 @@ var LeaferUI = (function (exports) {
|
|
|
8508
8570
|
if (this.children.length)
|
|
8509
8571
|
this.__renderGroup(canvas, options);
|
|
8510
8572
|
}
|
|
8573
|
+
if (this.scrollBar)
|
|
8574
|
+
this.scrollBar.__render(canvas, options);
|
|
8511
8575
|
}
|
|
8512
8576
|
__drawContent(canvas, options) {
|
|
8513
8577
|
this.__renderGroup(canvas, options);
|
|
8514
|
-
if (this.__.__useStroke) {
|
|
8578
|
+
if (this.__.__useStroke || this.__.__useEffect) {
|
|
8515
8579
|
canvas.setWorld(this.__nowWorld);
|
|
8516
8580
|
this.__drawRenderPath(canvas);
|
|
8517
8581
|
}
|
|
@@ -9170,9 +9234,14 @@ var LeaferUI = (function (exports) {
|
|
|
9170
9234
|
}
|
|
9171
9235
|
}
|
|
9172
9236
|
canvas.fillStyle = item.style;
|
|
9173
|
-
if (item.transform) {
|
|
9237
|
+
if (item.transform || item.scaleFixed) {
|
|
9174
9238
|
canvas.save();
|
|
9175
|
-
|
|
9239
|
+
if (item.transform)
|
|
9240
|
+
canvas.transform(item.transform);
|
|
9241
|
+
if (item.scaleFixed) {
|
|
9242
|
+
const { scaleX, scaleY } = ui.getRenderScaleData(true);
|
|
9243
|
+
canvas.scale(1 / scaleX, 1 / scaleY);
|
|
9244
|
+
}
|
|
9176
9245
|
if (item.blendMode)
|
|
9177
9246
|
canvas.blendMode = item.blendMode;
|
|
9178
9247
|
fillPathOrText(ui, canvas);
|
|
@@ -9208,8 +9277,13 @@ var LeaferUI = (function (exports) {
|
|
|
9208
9277
|
}
|
|
9209
9278
|
function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
|
|
9210
9279
|
const data = ui.__;
|
|
9211
|
-
|
|
9212
|
-
|
|
9280
|
+
if (typeof stroke === 'object') {
|
|
9281
|
+
drawStrokesStyle(stroke, strokeWidthScale, true, ui, canvas);
|
|
9282
|
+
}
|
|
9283
|
+
else {
|
|
9284
|
+
canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
9285
|
+
drawTextStroke(ui, canvas);
|
|
9286
|
+
}
|
|
9213
9287
|
}
|
|
9214
9288
|
function drawAlign(stroke, align, ui, canvas) {
|
|
9215
9289
|
const out = canvas.getSameCanvas(true, true);
|
|
@@ -9218,15 +9292,9 @@ var LeaferUI = (function (exports) {
|
|
|
9218
9292
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
9219
9293
|
fillText(ui, out);
|
|
9220
9294
|
out.blendMode = 'normal';
|
|
9221
|
-
|
|
9295
|
+
LeafHelper.copyCanvasByWorld(ui, canvas, out);
|
|
9222
9296
|
out.recycle(ui.__nowWorld);
|
|
9223
9297
|
}
|
|
9224
|
-
function copyWorld(canvas, out, ui) {
|
|
9225
|
-
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
9226
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9227
|
-
else
|
|
9228
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
9229
|
-
}
|
|
9230
9298
|
function drawTextStroke(ui, canvas) {
|
|
9231
9299
|
let row, data = ui.__.__textDrawData;
|
|
9232
9300
|
const { rows, decorationY } = data;
|
|
@@ -9242,14 +9310,21 @@ var LeaferUI = (function (exports) {
|
|
|
9242
9310
|
rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
9243
9311
|
}
|
|
9244
9312
|
}
|
|
9245
|
-
function drawStrokesStyle(strokes, isText, ui, canvas) {
|
|
9313
|
+
function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas) {
|
|
9246
9314
|
let item;
|
|
9315
|
+
const data = ui.__, { __hasMultiStrokeStyle } = data;
|
|
9316
|
+
__hasMultiStrokeStyle || canvas.setStroke(undefined, data.__strokeWidth * strokeWidthScale, data);
|
|
9247
9317
|
for (let i = 0, len = strokes.length; i < len; i++) {
|
|
9248
9318
|
item = strokes[i];
|
|
9249
9319
|
if (item.image && PaintImage.checkImage(ui, canvas, item, false))
|
|
9250
9320
|
continue;
|
|
9251
9321
|
if (item.style) {
|
|
9252
|
-
|
|
9322
|
+
if (__hasMultiStrokeStyle) {
|
|
9323
|
+
const { strokeStyle } = item;
|
|
9324
|
+
strokeStyle ? canvas.setStroke(item.style, data.__getRealStrokeWidth(strokeStyle) * strokeWidthScale, data, strokeStyle) : canvas.setStroke(item.style, data.__strokeWidth * strokeWidthScale, data);
|
|
9325
|
+
}
|
|
9326
|
+
else
|
|
9327
|
+
canvas.strokeStyle = item.style;
|
|
9253
9328
|
if (item.blendMode) {
|
|
9254
9329
|
canvas.saveBlendMode(item.blendMode);
|
|
9255
9330
|
isText ? drawTextStroke(ui, canvas) : canvas.stroke();
|
|
@@ -9288,8 +9363,13 @@ var LeaferUI = (function (exports) {
|
|
|
9288
9363
|
}
|
|
9289
9364
|
function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
9290
9365
|
const data = ui.__;
|
|
9291
|
-
|
|
9292
|
-
|
|
9366
|
+
if (typeof stroke === 'object') {
|
|
9367
|
+
drawStrokesStyle(stroke, strokeWidthScale, false, ui, canvas);
|
|
9368
|
+
}
|
|
9369
|
+
else {
|
|
9370
|
+
canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
9371
|
+
canvas.stroke();
|
|
9372
|
+
}
|
|
9293
9373
|
if (data.__useArrow)
|
|
9294
9374
|
Paint.strokeArrow(stroke, ui, canvas);
|
|
9295
9375
|
}
|
|
@@ -9311,7 +9391,7 @@ var LeaferUI = (function (exports) {
|
|
|
9311
9391
|
drawCenter(stroke, 2, ui, out);
|
|
9312
9392
|
out.clipUI(data);
|
|
9313
9393
|
out.clearWorld(renderBounds);
|
|
9314
|
-
|
|
9394
|
+
LeafHelper.copyCanvasByWorld(ui, canvas, out);
|
|
9315
9395
|
out.recycle(ui.__nowWorld);
|
|
9316
9396
|
}
|
|
9317
9397
|
}
|
|
@@ -9366,8 +9446,16 @@ var LeaferUI = (function (exports) {
|
|
|
9366
9446
|
if (!(paints instanceof Array))
|
|
9367
9447
|
paints = [paints];
|
|
9368
9448
|
recycleMap = PaintImage.recycleImage(attrName, data);
|
|
9449
|
+
let maxChildStrokeWidth;
|
|
9369
9450
|
for (let i = 0, len = paints.length, item; i < len; i++) {
|
|
9370
|
-
(item = getLeafPaint(attrName, paints[i], ui))
|
|
9451
|
+
if (item = getLeafPaint(attrName, paints[i], ui)) {
|
|
9452
|
+
leafPaints.push(item);
|
|
9453
|
+
if (item.strokeStyle) {
|
|
9454
|
+
maxChildStrokeWidth || (maxChildStrokeWidth = 1);
|
|
9455
|
+
if (item.strokeStyle.strokeWidth)
|
|
9456
|
+
maxChildStrokeWidth = Math.max(maxChildStrokeWidth, item.strokeStyle.strokeWidth);
|
|
9457
|
+
}
|
|
9458
|
+
}
|
|
9371
9459
|
}
|
|
9372
9460
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
9373
9461
|
if (leafPaints.length) {
|
|
@@ -9384,6 +9472,7 @@ var LeaferUI = (function (exports) {
|
|
|
9384
9472
|
else {
|
|
9385
9473
|
stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
|
|
9386
9474
|
stintSet(data, '__isTransparentStroke', isTransparent);
|
|
9475
|
+
stintSet(data, '__hasMultiStrokeStyle', maxChildStrokeWidth);
|
|
9387
9476
|
}
|
|
9388
9477
|
}
|
|
9389
9478
|
function getLeafPaint(attrName, paint, ui) {
|
|
@@ -9415,6 +9504,11 @@ var LeaferUI = (function (exports) {
|
|
|
9415
9504
|
if (data) {
|
|
9416
9505
|
if (typeof data.style === 'string' && hasTransparent$1(data.style))
|
|
9417
9506
|
data.isTransparent = true;
|
|
9507
|
+
if (paint.style) {
|
|
9508
|
+
if (paint.style.strokeWidth === 0)
|
|
9509
|
+
return undefined;
|
|
9510
|
+
data.strokeStyle = paint.style;
|
|
9511
|
+
}
|
|
9418
9512
|
if (paint.blendMode)
|
|
9419
9513
|
data.blendMode = paint.blendMode;
|
|
9420
9514
|
}
|
|
@@ -9434,8 +9528,8 @@ var LeaferUI = (function (exports) {
|
|
|
9434
9528
|
shape
|
|
9435
9529
|
};
|
|
9436
9530
|
|
|
9437
|
-
let origin = {};
|
|
9438
|
-
const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, scale: scaleHelper, rotate, skew: skewHelper } = MatrixHelper;
|
|
9531
|
+
let origin = {}, tempMatrix = getMatrixData();
|
|
9532
|
+
const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent, scale: scaleHelper, rotate, skew: skewHelper } = MatrixHelper;
|
|
9439
9533
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
9440
9534
|
const transform = get$3();
|
|
9441
9535
|
translate$1(transform, box.x + x, box.y + y);
|
|
@@ -9444,7 +9538,7 @@ var LeaferUI = (function (exports) {
|
|
|
9444
9538
|
rotateOfOuter$1(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
|
|
9445
9539
|
data.transform = transform;
|
|
9446
9540
|
}
|
|
9447
|
-
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew) {
|
|
9541
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipSize) {
|
|
9448
9542
|
const transform = get$3();
|
|
9449
9543
|
if (rotation)
|
|
9450
9544
|
rotate(transform, rotation);
|
|
@@ -9453,6 +9547,10 @@ var LeaferUI = (function (exports) {
|
|
|
9453
9547
|
if (scaleX)
|
|
9454
9548
|
scaleHelper(transform, scaleX, scaleY);
|
|
9455
9549
|
translate$1(transform, box.x + x, box.y + y);
|
|
9550
|
+
if (clipSize) {
|
|
9551
|
+
tempMatrix.a = box.width / clipSize.width, tempMatrix.d = box.height / clipSize.height;
|
|
9552
|
+
multiplyParent(transform, tempMatrix);
|
|
9553
|
+
}
|
|
9456
9554
|
data.transform = transform;
|
|
9457
9555
|
}
|
|
9458
9556
|
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
|
|
@@ -9489,13 +9587,15 @@ var LeaferUI = (function (exports) {
|
|
|
9489
9587
|
const tempScaleData = {};
|
|
9490
9588
|
const tempImage = {};
|
|
9491
9589
|
function createData(leafPaint, image, paint, box) {
|
|
9492
|
-
const { changeful, sync, editing } = paint;
|
|
9590
|
+
const { changeful, sync, editing, scaleFixed } = paint;
|
|
9493
9591
|
if (changeful)
|
|
9494
9592
|
leafPaint.changeful = changeful;
|
|
9495
9593
|
if (sync)
|
|
9496
9594
|
leafPaint.sync = sync;
|
|
9497
9595
|
if (editing)
|
|
9498
9596
|
leafPaint.editing = editing;
|
|
9597
|
+
if (scaleFixed)
|
|
9598
|
+
leafPaint.scaleFixed = scaleFixed;
|
|
9499
9599
|
leafPaint.data = getPatternData(paint, box, image);
|
|
9500
9600
|
}
|
|
9501
9601
|
function getPatternData(paint, box, image) {
|
|
@@ -9504,7 +9604,7 @@ var LeaferUI = (function (exports) {
|
|
|
9504
9604
|
if (paint.mode === 'strench')
|
|
9505
9605
|
paint.mode = 'stretch';
|
|
9506
9606
|
let { width, height } = image;
|
|
9507
|
-
const { opacity, mode, align, offset, scale, size, rotation, skew, repeat, filters } = paint;
|
|
9607
|
+
const { opacity, mode, align, offset, scale, size, rotation, skew, clipSize, repeat, filters } = paint;
|
|
9508
9608
|
const sameBox = box.width === width && box.height === height;
|
|
9509
9609
|
const data = { mode };
|
|
9510
9610
|
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
@@ -9538,8 +9638,8 @@ var LeaferUI = (function (exports) {
|
|
|
9538
9638
|
break;
|
|
9539
9639
|
case 'normal':
|
|
9540
9640
|
case 'clip':
|
|
9541
|
-
if (tempImage.x || tempImage.y || scaleX || rotation || skew)
|
|
9542
|
-
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew);
|
|
9641
|
+
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
|
|
9642
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, paint.clipSize);
|
|
9543
9643
|
break;
|
|
9544
9644
|
case 'repeat':
|
|
9545
9645
|
if (!sameBox || scaleX || rotation)
|
|
@@ -9676,18 +9776,16 @@ var LeaferUI = (function (exports) {
|
|
|
9676
9776
|
}
|
|
9677
9777
|
|
|
9678
9778
|
const { get: get$1, scale, copy: copy$1 } = MatrixHelper;
|
|
9679
|
-
const { ceil, abs
|
|
9779
|
+
const { ceil, abs } = Math;
|
|
9680
9780
|
function createPattern(ui, paint, pixelRatio) {
|
|
9681
|
-
let { scaleX, scaleY } =
|
|
9781
|
+
let { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
9682
9782
|
const id = scaleX + '-' + scaleY + '-' + pixelRatio;
|
|
9683
9783
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
9684
|
-
scaleX = abs$1(scaleX);
|
|
9685
|
-
scaleY = abs$1(scaleY);
|
|
9686
9784
|
const { image, data } = paint;
|
|
9687
9785
|
let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
|
|
9688
9786
|
if (sx) {
|
|
9689
|
-
sx = abs
|
|
9690
|
-
sy = abs
|
|
9787
|
+
sx = abs(sx);
|
|
9788
|
+
sy = abs(sy);
|
|
9691
9789
|
imageMatrix = get$1();
|
|
9692
9790
|
copy$1(imageMatrix, transform);
|
|
9693
9791
|
scale(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -9740,9 +9838,8 @@ var LeaferUI = (function (exports) {
|
|
|
9740
9838
|
}
|
|
9741
9839
|
}
|
|
9742
9840
|
|
|
9743
|
-
const { abs } = Math;
|
|
9744
9841
|
function checkImage(ui, canvas, paint, allowDraw) {
|
|
9745
|
-
const { scaleX, scaleY } =
|
|
9842
|
+
const { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
9746
9843
|
const { pixelRatio } = canvas, { data } = paint;
|
|
9747
9844
|
if (!data || (paint.patternId === scaleX + '-' + scaleY + '-' + pixelRatio && !Export.running)) {
|
|
9748
9845
|
return false;
|
|
@@ -9755,8 +9852,8 @@ var LeaferUI = (function (exports) {
|
|
|
9755
9852
|
else {
|
|
9756
9853
|
if (!(paint.changeful || ResizeEvent.isResizing(ui) || Export.running)) {
|
|
9757
9854
|
let { width, height } = data;
|
|
9758
|
-
width *=
|
|
9759
|
-
height *=
|
|
9855
|
+
width *= scaleX * pixelRatio;
|
|
9856
|
+
height *= scaleY * pixelRatio;
|
|
9760
9857
|
if (data.scaleX) {
|
|
9761
9858
|
width *= data.scaleX;
|
|
9762
9859
|
height *= data.scaleY;
|
|
@@ -9766,6 +9863,10 @@ var LeaferUI = (function (exports) {
|
|
|
9766
9863
|
}
|
|
9767
9864
|
}
|
|
9768
9865
|
if (allowDraw) {
|
|
9866
|
+
if (ui.__.__isFastShadow) {
|
|
9867
|
+
canvas.fillStyle = paint.style || '#000';
|
|
9868
|
+
canvas.fill();
|
|
9869
|
+
}
|
|
9769
9870
|
drawImage(ui, canvas, paint, data);
|
|
9770
9871
|
return true;
|
|
9771
9872
|
}
|
|
@@ -9954,10 +10055,7 @@ var LeaferUI = (function (exports) {
|
|
|
9954
10055
|
}
|
|
9955
10056
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
|
|
9956
10057
|
}
|
|
9957
|
-
|
|
9958
|
-
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
9959
|
-
else
|
|
9960
|
-
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
10058
|
+
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
9961
10059
|
if (end && index < end)
|
|
9962
10060
|
other.clearWorld(copyBounds, true);
|
|
9963
10061
|
});
|
|
@@ -10016,10 +10114,7 @@ var LeaferUI = (function (exports) {
|
|
|
10016
10114
|
copyBounds = bounds;
|
|
10017
10115
|
}
|
|
10018
10116
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
|
|
10019
|
-
|
|
10020
|
-
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
10021
|
-
else
|
|
10022
|
-
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
10117
|
+
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
10023
10118
|
if (end && index < end)
|
|
10024
10119
|
other.clearWorld(copyBounds, true);
|
|
10025
10120
|
});
|
|
@@ -10075,12 +10170,11 @@ var LeaferUI = (function (exports) {
|
|
|
10075
10170
|
contentCanvas = getCanvas(canvas);
|
|
10076
10171
|
child.__render(maskCanvas, options);
|
|
10077
10172
|
}
|
|
10078
|
-
if (
|
|
10079
|
-
|
|
10080
|
-
}
|
|
10081
|
-
if (excludeRenderBounds(child, options))
|
|
10173
|
+
if (mask === 'clipping' || mask === 'clipping-path')
|
|
10174
|
+
excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
10082
10175
|
continue;
|
|
10083
|
-
|
|
10176
|
+
}
|
|
10177
|
+
excludeRenderBounds(child, options) || child.__render(contentCanvas || canvas, options);
|
|
10084
10178
|
}
|
|
10085
10179
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
|
|
10086
10180
|
};
|
|
@@ -10775,6 +10869,8 @@ var LeaferUI = (function (exports) {
|
|
|
10775
10869
|
exports.boundsType = boundsType;
|
|
10776
10870
|
exports.canvasPatch = canvasPatch;
|
|
10777
10871
|
exports.canvasSizeAttrs = canvasSizeAttrs;
|
|
10872
|
+
exports.createAttr = createAttr;
|
|
10873
|
+
exports.createDescriptor = createDescriptor;
|
|
10778
10874
|
exports.cursorType = cursorType;
|
|
10779
10875
|
exports.dataProcessor = dataProcessor;
|
|
10780
10876
|
exports.dataType = dataType;
|
|
@@ -10813,7 +10909,7 @@ var LeaferUI = (function (exports) {
|
|
|
10813
10909
|
exports.strokeType = strokeType;
|
|
10814
10910
|
exports.surfaceType = surfaceType;
|
|
10815
10911
|
exports.tempBounds = tempBounds$1;
|
|
10816
|
-
exports.tempMatrix = tempMatrix;
|
|
10912
|
+
exports.tempMatrix = tempMatrix$1;
|
|
10817
10913
|
exports.tempPoint = tempPoint$2;
|
|
10818
10914
|
exports.useCanvas = useCanvas;
|
|
10819
10915
|
exports.useModule = useModule;
|