leafer-draw 1.6.7 → 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 +86 -50
- package/dist/web.esm.js +87 -51
- package/dist/web.esm.min.js +1 -1
- package/dist/web.esm.min.js.map +1 -1
- package/dist/web.js +301 -181
- 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 +299 -181
- 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.module.js
CHANGED
|
@@ -43,7 +43,7 @@ const IncrementId = {
|
|
|
43
43
|
};
|
|
44
44
|
const I$1 = IncrementId;
|
|
45
45
|
|
|
46
|
-
const { round: round$3, pow: pow$1, PI: PI$
|
|
46
|
+
const { round: round$3, pow: pow$1, PI: PI$3 } = Math;
|
|
47
47
|
const MathHelper = {
|
|
48
48
|
within(value, min, max) {
|
|
49
49
|
if (typeof min === 'object')
|
|
@@ -139,9 +139,9 @@ const MathHelper = {
|
|
|
139
139
|
function randInt(num) {
|
|
140
140
|
return Math.round(Math.random() * num);
|
|
141
141
|
}
|
|
142
|
-
const OneRadian = PI$
|
|
143
|
-
const PI2 = PI$
|
|
144
|
-
const PI_2 = PI$
|
|
142
|
+
const OneRadian = PI$3 / 180;
|
|
143
|
+
const PI2 = PI$3 * 2;
|
|
144
|
+
const PI_2 = PI$3 / 2;
|
|
145
145
|
function getPointData() { return { x: 0, y: 0 }; }
|
|
146
146
|
function getBoundsData() { return { x: 0, y: 0, width: 0, height: 0 }; }
|
|
147
147
|
function getMatrixData() { return { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 }; }
|
|
@@ -436,7 +436,7 @@ const MatrixHelper = {
|
|
|
436
436
|
const M$6 = MatrixHelper;
|
|
437
437
|
|
|
438
438
|
const { toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3 } = MatrixHelper;
|
|
439
|
-
const { sin: sin$4, cos: cos$4, abs: abs$
|
|
439
|
+
const { sin: sin$4, cos: cos$4, abs: abs$3, sqrt: sqrt$2, atan2: atan2$2, min: min$1, round: round$2 } = Math;
|
|
440
440
|
const PointHelper = {
|
|
441
441
|
defaultPoint: getPointData(),
|
|
442
442
|
tempPoint: {},
|
|
@@ -531,8 +531,8 @@ const PointHelper = {
|
|
|
531
531
|
return getDistanceFrom(t.x, t.y, point.x, point.y);
|
|
532
532
|
},
|
|
533
533
|
getDistanceFrom(x1, y1, x2, y2) {
|
|
534
|
-
const x = abs$
|
|
535
|
-
const y = abs$
|
|
534
|
+
const x = abs$3(x2 - x1);
|
|
535
|
+
const y = abs$3(y2 - y1);
|
|
536
536
|
return sqrt$2(x * x + y * y);
|
|
537
537
|
},
|
|
538
538
|
getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
|
|
@@ -549,10 +549,11 @@ const PointHelper = {
|
|
|
549
549
|
getRadianFrom(fromX, fromY, originX, originY, toX, toY, toOriginX, toOriginY) {
|
|
550
550
|
if (toOriginX === undefined)
|
|
551
551
|
toOriginX = originX, toOriginY = originY;
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
const
|
|
555
|
-
|
|
552
|
+
const a = fromX - originX;
|
|
553
|
+
const b = fromY - originY;
|
|
554
|
+
const c = toX - toOriginX;
|
|
555
|
+
const d = toY - toOriginY;
|
|
556
|
+
return Math.atan2(a * d - b * c, a * c + b * d);
|
|
556
557
|
},
|
|
557
558
|
getAtan2(t, to) {
|
|
558
559
|
return atan2$2(to.y - t.y, to.x - t.x);
|
|
@@ -762,7 +763,7 @@ class Matrix {
|
|
|
762
763
|
MatrixHelper.reset(this);
|
|
763
764
|
}
|
|
764
765
|
}
|
|
765
|
-
const tempMatrix = new Matrix();
|
|
766
|
+
const tempMatrix$1 = new Matrix();
|
|
766
767
|
|
|
767
768
|
const TwoPointBoundsHelper = {
|
|
768
769
|
tempPointBounds: {},
|
|
@@ -859,6 +860,12 @@ const AroundHelper = {
|
|
|
859
860
|
}
|
|
860
861
|
if (!onlyBoxSize)
|
|
861
862
|
to.x += box.x, to.y += box.y;
|
|
863
|
+
},
|
|
864
|
+
getPoint(around, box, to) {
|
|
865
|
+
if (!to)
|
|
866
|
+
to = {};
|
|
867
|
+
AroundHelper.toPoint(around, box, to, true);
|
|
868
|
+
return to;
|
|
862
869
|
}
|
|
863
870
|
};
|
|
864
871
|
function get$4(around) {
|
|
@@ -1787,10 +1794,13 @@ function contextAttr(realName) {
|
|
|
1787
1794
|
return (target, key) => {
|
|
1788
1795
|
if (!realName)
|
|
1789
1796
|
realName = key;
|
|
1790
|
-
|
|
1797
|
+
const property = {
|
|
1791
1798
|
get() { return this.context[realName]; },
|
|
1792
1799
|
set(value) { this.context[realName] = value; }
|
|
1793
|
-
}
|
|
1800
|
+
};
|
|
1801
|
+
if (key === 'strokeCap')
|
|
1802
|
+
property.set = function (value) { this.context[realName] = value === 'none' ? 'butt' : value; };
|
|
1803
|
+
Object.defineProperty(target, key, property);
|
|
1794
1804
|
};
|
|
1795
1805
|
}
|
|
1796
1806
|
const contextMethodNameList = [];
|
|
@@ -2066,15 +2076,15 @@ __decorate([
|
|
|
2066
2076
|
contextMethod()
|
|
2067
2077
|
], Canvas$1.prototype, "strokeText", null);
|
|
2068
2078
|
|
|
2069
|
-
const { copy: copy$8, multiplyParent: multiplyParent$
|
|
2079
|
+
const { copy: copy$8, multiplyParent: multiplyParent$4 } = MatrixHelper, { round: round$1 } = Math;
|
|
2070
2080
|
const minSize = { width: 1, height: 1, pixelRatio: 1 };
|
|
2071
2081
|
const canvasSizeAttrs = ['width', 'height', 'pixelRatio'];
|
|
2072
2082
|
class LeaferCanvasBase extends Canvas$1 {
|
|
2073
2083
|
get width() { return this.size.width; }
|
|
2074
2084
|
get height() { return this.size.height; }
|
|
2075
2085
|
get pixelRatio() { return this.size.pixelRatio; }
|
|
2076
|
-
get pixelWidth() { return this.width * this.pixelRatio; }
|
|
2077
|
-
get pixelHeight() { return this.height * this.pixelRatio; }
|
|
2086
|
+
get pixelWidth() { return this.width * this.pixelRatio || 0; }
|
|
2087
|
+
get pixelHeight() { return this.height * this.pixelRatio || 0; }
|
|
2078
2088
|
get pixelSnap() { return this.config.pixelSnap; }
|
|
2079
2089
|
set pixelSnap(value) { this.config.pixelSnap = value; }
|
|
2080
2090
|
get allowBackgroundColor() { return this.view && this.parentView; }
|
|
@@ -2139,7 +2149,7 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2139
2149
|
setWorld(matrix, parentMatrix) {
|
|
2140
2150
|
const { pixelRatio, pixelSnap } = this, w = this.worldTransform;
|
|
2141
2151
|
if (parentMatrix)
|
|
2142
|
-
multiplyParent$
|
|
2152
|
+
multiplyParent$4(matrix, parentMatrix, w);
|
|
2143
2153
|
w.a = matrix.a * pixelRatio;
|
|
2144
2154
|
w.b = matrix.b * pixelRatio;
|
|
2145
2155
|
w.c = matrix.c * pixelRatio;
|
|
@@ -2161,20 +2171,33 @@ class LeaferCanvasBase extends Canvas$1 {
|
|
|
2161
2171
|
if (w)
|
|
2162
2172
|
this.setTransform(w.a, w.b, w.c, w.d, w.e, w.f);
|
|
2163
2173
|
}
|
|
2164
|
-
setStroke(color, strokeWidth, options) {
|
|
2174
|
+
setStroke(color, strokeWidth, options, childOptions) {
|
|
2165
2175
|
if (strokeWidth)
|
|
2166
2176
|
this.strokeWidth = strokeWidth;
|
|
2167
2177
|
if (color)
|
|
2168
2178
|
this.strokeStyle = color;
|
|
2169
2179
|
if (options)
|
|
2170
|
-
this.setStrokeOptions(options);
|
|
2171
|
-
}
|
|
2172
|
-
setStrokeOptions(options) {
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2180
|
+
this.setStrokeOptions(options, childOptions);
|
|
2181
|
+
}
|
|
2182
|
+
setStrokeOptions(options, childOptions) {
|
|
2183
|
+
let { strokeCap, strokeJoin, dashPattern, dashOffset, miterLimit } = options;
|
|
2184
|
+
if (childOptions) {
|
|
2185
|
+
if (childOptions.strokeCap)
|
|
2186
|
+
strokeCap = childOptions.strokeCap;
|
|
2187
|
+
if (childOptions.strokeJoin)
|
|
2188
|
+
strokeJoin = childOptions.strokeJoin;
|
|
2189
|
+
if (childOptions.dashPattern !== undefined)
|
|
2190
|
+
dashPattern = childOptions.dashPattern;
|
|
2191
|
+
if (childOptions.dashOffset !== undefined)
|
|
2192
|
+
dashOffset = childOptions.dashOffset;
|
|
2193
|
+
if (childOptions.miterLimit)
|
|
2194
|
+
miterLimit = childOptions.miterLimit;
|
|
2195
|
+
}
|
|
2196
|
+
this.strokeCap = strokeCap;
|
|
2197
|
+
this.strokeJoin = strokeJoin;
|
|
2198
|
+
this.dashPattern = dashPattern;
|
|
2199
|
+
this.dashOffset = dashOffset;
|
|
2200
|
+
this.miterLimit = miterLimit;
|
|
2178
2201
|
}
|
|
2179
2202
|
saveBlendMode(blendMode) {
|
|
2180
2203
|
this.savedBlendMode = this.blendMode;
|
|
@@ -2408,7 +2431,7 @@ const RectHelper = {
|
|
|
2408
2431
|
}
|
|
2409
2432
|
};
|
|
2410
2433
|
|
|
2411
|
-
const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$
|
|
2434
|
+
const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$2, PI: PI$2, sqrt: sqrt$1, pow } = Math;
|
|
2412
2435
|
const { setPoint: setPoint$1, addPoint: addPoint$1 } = TwoPointBoundsHelper;
|
|
2413
2436
|
const { set, toNumberPoints } = PointHelper;
|
|
2414
2437
|
const { M: M$5, L: L$6, C: C$4, Q: Q$4, Z: Z$5 } = PathCommandMap;
|
|
@@ -2483,7 +2506,7 @@ const BezierHelper = {
|
|
|
2483
2506
|
let totalRadian = endRadian - startRadian;
|
|
2484
2507
|
if (totalRadian < 0)
|
|
2485
2508
|
totalRadian += PI2;
|
|
2486
|
-
if (totalRadian === PI$2 || (abs$
|
|
2509
|
+
if (totalRadian === PI$2 || (abs$2(BAx + BAy) < 1.e-12) || (abs$2(CBx + CBy) < 1.e-12)) {
|
|
2487
2510
|
if (data)
|
|
2488
2511
|
data.push(L$6, x1, y1);
|
|
2489
2512
|
if (setPointBounds) {
|
|
@@ -2525,7 +2548,7 @@ const BezierHelper = {
|
|
|
2525
2548
|
totalRadian -= PI2;
|
|
2526
2549
|
if (anticlockwise)
|
|
2527
2550
|
totalRadian -= PI2;
|
|
2528
|
-
const parts = ceil$1(abs$
|
|
2551
|
+
const parts = ceil$1(abs$2(totalRadian / PI_2));
|
|
2529
2552
|
const partRadian = totalRadian / parts;
|
|
2530
2553
|
const partRadian4Sin = sin$3(partRadian / 4);
|
|
2531
2554
|
const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$3(partRadian / 2);
|
|
@@ -2970,7 +2993,7 @@ const { current, pushData, copyData } = PathConvert;
|
|
|
2970
2993
|
|
|
2971
2994
|
const { M: M$3, L: L$4, C: C$2, Q: Q$2, Z: Z$3, N: N$2, D: D$2, X: X$2, G: G$2, F: F$3, O: O$2, P: P$2, U: U$2 } = PathCommandMap;
|
|
2972
2995
|
const { getMinDistanceFrom, getRadianFrom } = PointHelper;
|
|
2973
|
-
const { tan, min, abs: abs$
|
|
2996
|
+
const { tan, min, abs: abs$1 } = Math;
|
|
2974
2997
|
const startPoint = {};
|
|
2975
2998
|
const PathCommandDataHelper = {
|
|
2976
2999
|
beginPath(data) {
|
|
@@ -3033,7 +3056,7 @@ const PathCommandDataHelper = {
|
|
|
3033
3056
|
arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
|
|
3034
3057
|
if (lastX !== undefined) {
|
|
3035
3058
|
const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
|
|
3036
|
-
radius = min(radius, min(d / 2, d / 2 * abs$
|
|
3059
|
+
radius = min(radius, min(d / 2, d / 2 * abs$1(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
|
|
3037
3060
|
}
|
|
3038
3061
|
data.push(U$2, x1, y1, x2, y2, radius);
|
|
3039
3062
|
},
|
|
@@ -3339,7 +3362,7 @@ const { getCenterX, getCenterY } = PointHelper;
|
|
|
3339
3362
|
const { arcTo } = PathCommandDataHelper;
|
|
3340
3363
|
const PathCorner = {
|
|
3341
3364
|
smooth(data, cornerRadius, _cornerSmoothing) {
|
|
3342
|
-
let command, commandLen;
|
|
3365
|
+
let command, lastCommand, commandLen;
|
|
3343
3366
|
let i = 0, x = 0, y = 0, startX = 0, startY = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0;
|
|
3344
3367
|
const len = data.length;
|
|
3345
3368
|
const smooth = [];
|
|
@@ -3377,8 +3400,10 @@ const PathCorner = {
|
|
|
3377
3400
|
lastY = y;
|
|
3378
3401
|
break;
|
|
3379
3402
|
case Z:
|
|
3380
|
-
|
|
3381
|
-
|
|
3403
|
+
if (lastCommand !== Z) {
|
|
3404
|
+
arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY);
|
|
3405
|
+
smooth.push(Z);
|
|
3406
|
+
}
|
|
3382
3407
|
i += 1;
|
|
3383
3408
|
break;
|
|
3384
3409
|
default:
|
|
@@ -3387,6 +3412,7 @@ const PathCorner = {
|
|
|
3387
3412
|
smooth.push(data[i + j]);
|
|
3388
3413
|
i += commandLen;
|
|
3389
3414
|
}
|
|
3415
|
+
lastCommand = command;
|
|
3390
3416
|
}
|
|
3391
3417
|
if (command !== Z) {
|
|
3392
3418
|
smooth[1] = startX;
|
|
@@ -3883,12 +3909,12 @@ class LeaferImage {
|
|
|
3883
3909
|
try {
|
|
3884
3910
|
if (transform && pattern.setTransform) {
|
|
3885
3911
|
pattern.setTransform(transform);
|
|
3886
|
-
transform =
|
|
3912
|
+
transform = undefined;
|
|
3887
3913
|
}
|
|
3888
3914
|
}
|
|
3889
3915
|
catch (_a) { }
|
|
3890
3916
|
if (paint)
|
|
3891
|
-
paint
|
|
3917
|
+
DataHelper.stintSet(paint, 'transform', transform);
|
|
3892
3918
|
return pattern;
|
|
3893
3919
|
}
|
|
3894
3920
|
destroy() {
|
|
@@ -3906,6 +3932,13 @@ function defineKey(target, key, descriptor, noConfigurable) {
|
|
|
3906
3932
|
function getDescriptor(object, name) {
|
|
3907
3933
|
return Object.getOwnPropertyDescriptor(object, name);
|
|
3908
3934
|
}
|
|
3935
|
+
function createDescriptor(key, defaultValue) {
|
|
3936
|
+
const privateKey = '_' + key;
|
|
3937
|
+
return {
|
|
3938
|
+
get() { const v = this[privateKey]; return v === undefined ? defaultValue : v; },
|
|
3939
|
+
set(value) { this[privateKey] = value; }
|
|
3940
|
+
};
|
|
3941
|
+
}
|
|
3909
3942
|
function getNames(object) {
|
|
3910
3943
|
return Object.getOwnPropertyNames(object);
|
|
3911
3944
|
}
|
|
@@ -3993,10 +4026,14 @@ function pathInputType(defaultValue) {
|
|
|
3993
4026
|
}));
|
|
3994
4027
|
}
|
|
3995
4028
|
const pathType = boundsType;
|
|
3996
|
-
function affectStrokeBoundsType(defaultValue) {
|
|
4029
|
+
function affectStrokeBoundsType(defaultValue, useStroke) {
|
|
3997
4030
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3998
4031
|
set(value) {
|
|
3999
|
-
this.__setAttr(key, value)
|
|
4032
|
+
if (this.__setAttr(key, value)) {
|
|
4033
|
+
doStrokeType(this);
|
|
4034
|
+
if (useStroke)
|
|
4035
|
+
this.__.__useStroke = true;
|
|
4036
|
+
}
|
|
4000
4037
|
}
|
|
4001
4038
|
}));
|
|
4002
4039
|
}
|
|
@@ -4134,15 +4171,7 @@ function defineDataProcessor(target, key, defaultValue) {
|
|
|
4134
4171
|
const data = target.__DataProcessor.prototype;
|
|
4135
4172
|
const computedKey = '_' + key;
|
|
4136
4173
|
const setMethodName = getSetMethodName(key);
|
|
4137
|
-
const property =
|
|
4138
|
-
get() {
|
|
4139
|
-
const v = this[computedKey];
|
|
4140
|
-
return v === undefined ? defaultValue : v;
|
|
4141
|
-
},
|
|
4142
|
-
set(value) {
|
|
4143
|
-
this[computedKey] = value;
|
|
4144
|
-
}
|
|
4145
|
-
};
|
|
4174
|
+
const property = createDescriptor(key, defaultValue);
|
|
4146
4175
|
if (defaultValue === undefined) {
|
|
4147
4176
|
property.get = function () { return this[computedKey]; };
|
|
4148
4177
|
}
|
|
@@ -4257,7 +4286,7 @@ function registerUIEvent() {
|
|
|
4257
4286
|
};
|
|
4258
4287
|
}
|
|
4259
4288
|
|
|
4260
|
-
const { copy: copy$6, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$
|
|
4289
|
+
const { copy: copy$6, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$3, divideParent, getLayout } = MatrixHelper;
|
|
4261
4290
|
const matrix = {}, { round } = Math;
|
|
4262
4291
|
const LeafHelper = {
|
|
4263
4292
|
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
@@ -4329,6 +4358,14 @@ const LeafHelper = {
|
|
|
4329
4358
|
}
|
|
4330
4359
|
return true;
|
|
4331
4360
|
},
|
|
4361
|
+
copyCanvasByWorld(leaf, currentCanvas, fromCanvas, fromWorld, blendMode, onlyResetTransform) {
|
|
4362
|
+
if (!fromWorld)
|
|
4363
|
+
fromWorld = leaf.__nowWorld;
|
|
4364
|
+
if (leaf.__worldFlipped || Platform.fullImageShadow)
|
|
4365
|
+
currentCanvas.copyWorldByReset(fromCanvas, fromWorld, leaf.__nowWorld, blendMode, onlyResetTransform);
|
|
4366
|
+
else
|
|
4367
|
+
currentCanvas.copyWorldToInner(fromCanvas, fromWorld, leaf.__layout.renderBounds, blendMode);
|
|
4368
|
+
},
|
|
4332
4369
|
moveWorld(t, x, y = 0, isInnerPoint, transition) {
|
|
4333
4370
|
const local = typeof x === 'object' ? Object.assign({}, x) : { x, y };
|
|
4334
4371
|
isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : (t.parent && toInnerPoint$1(t.parent.worldTransform, local, local, true));
|
|
@@ -4388,14 +4425,14 @@ const LeafHelper = {
|
|
|
4388
4425
|
},
|
|
4389
4426
|
transformWorld(t, transform, resize, transition) {
|
|
4390
4427
|
copy$6(matrix, t.worldTransform);
|
|
4391
|
-
multiplyParent$
|
|
4428
|
+
multiplyParent$3(matrix, transform);
|
|
4392
4429
|
if (t.parent)
|
|
4393
4430
|
divideParent(matrix, t.parent.worldTransform);
|
|
4394
4431
|
L.setTransform(t, matrix, resize, transition);
|
|
4395
4432
|
},
|
|
4396
4433
|
transform(t, transform, resize, transition) {
|
|
4397
4434
|
copy$6(matrix, t.localTransform);
|
|
4398
|
-
multiplyParent$
|
|
4435
|
+
multiplyParent$3(matrix, transform);
|
|
4399
4436
|
L.setTransform(t, matrix, resize, transition);
|
|
4400
4437
|
},
|
|
4401
4438
|
setTransform(t, transform, resize, transition) {
|
|
@@ -5257,17 +5294,18 @@ const LeafDataProxy = {
|
|
|
5257
5294
|
}
|
|
5258
5295
|
};
|
|
5259
5296
|
|
|
5260
|
-
const { setLayout, multiplyParent: multiplyParent$
|
|
5297
|
+
const { setLayout, multiplyParent: multiplyParent$2, translateInner, defaultWorld } = MatrixHelper;
|
|
5261
5298
|
const { toPoint: toPoint$3, tempPoint } = AroundHelper;
|
|
5262
5299
|
const LeafMatrix = {
|
|
5263
5300
|
__updateWorldMatrix() {
|
|
5264
|
-
|
|
5301
|
+
const { parent, __layout } = this;
|
|
5302
|
+
multiplyParent$2(this.__local || __layout, parent ? parent.__world : defaultWorld, this.__world, !!__layout.affectScaleOrRotation, this.__, parent && (parent.scrollY || parent.scrollX) && parent.__);
|
|
5265
5303
|
},
|
|
5266
5304
|
__updateLocalMatrix() {
|
|
5267
5305
|
if (this.__local) {
|
|
5268
5306
|
const layout = this.__layout, local = this.__local, data = this.__;
|
|
5269
5307
|
if (layout.affectScaleOrRotation) {
|
|
5270
|
-
if ((layout.scaleChanged && (layout.resized = 'scale')) || layout.rotationChanged) {
|
|
5308
|
+
if ((layout.scaleChanged && (layout.resized || (layout.resized = 'scale'))) || layout.rotationChanged) {
|
|
5271
5309
|
setLayout(local, data, null, null, layout.affectRotation);
|
|
5272
5310
|
layout.scaleChanged = layout.rotationChanged = undefined;
|
|
5273
5311
|
}
|
|
@@ -5422,6 +5460,8 @@ const LeafBounds = {
|
|
|
5422
5460
|
|
|
5423
5461
|
const LeafRender = {
|
|
5424
5462
|
__render(canvas, options) {
|
|
5463
|
+
if (options.shape)
|
|
5464
|
+
return this.__renderShape(canvas, options);
|
|
5425
5465
|
if (this.__worldOpacity) {
|
|
5426
5466
|
const data = this.__;
|
|
5427
5467
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
@@ -5431,12 +5471,7 @@ const LeafRender = {
|
|
|
5431
5471
|
return this.__renderEraser(canvas, options);
|
|
5432
5472
|
const tempCanvas = canvas.getSameCanvas(true, true);
|
|
5433
5473
|
this.__draw(tempCanvas, options, canvas);
|
|
5434
|
-
|
|
5435
|
-
canvas.copyWorldByReset(tempCanvas, this.__nowWorld, null, data.__blendMode, true);
|
|
5436
|
-
}
|
|
5437
|
-
else {
|
|
5438
|
-
canvas.copyWorldToInner(tempCanvas, this.__nowWorld, this.__layout.renderBounds, data.__blendMode);
|
|
5439
|
-
}
|
|
5474
|
+
LeafHelper.copyCanvasByWorld(this, canvas, tempCanvas, this.__nowWorld, data.__blendMode, true);
|
|
5440
5475
|
tempCanvas.recycle(this.__nowWorld);
|
|
5441
5476
|
}
|
|
5442
5477
|
else {
|
|
@@ -5446,6 +5481,12 @@ const LeafRender = {
|
|
|
5446
5481
|
Debug.drawBounds(this, canvas, options);
|
|
5447
5482
|
}
|
|
5448
5483
|
},
|
|
5484
|
+
__renderShape(canvas, options) {
|
|
5485
|
+
if (this.__worldOpacity) {
|
|
5486
|
+
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
5487
|
+
this.__drawShape(canvas, options);
|
|
5488
|
+
}
|
|
5489
|
+
},
|
|
5449
5490
|
__clip(canvas, options) {
|
|
5450
5491
|
if (this.__worldOpacity) {
|
|
5451
5492
|
canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
|
|
@@ -5478,7 +5519,7 @@ const BranchRender = {
|
|
|
5478
5519
|
options.dimOpacity = data.dim === true ? 0.2 : data.dim;
|
|
5479
5520
|
else if (data.dimskip)
|
|
5480
5521
|
options.dimOpacity && (options.dimOpacity = 0);
|
|
5481
|
-
if (data.__single) {
|
|
5522
|
+
if (data.__single && !this.isBranchLeaf) {
|
|
5482
5523
|
if (data.eraser === 'path')
|
|
5483
5524
|
return this.__renderEraser(canvas, options);
|
|
5484
5525
|
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
@@ -5500,9 +5541,7 @@ const BranchRender = {
|
|
|
5500
5541
|
else {
|
|
5501
5542
|
const { children } = this;
|
|
5502
5543
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
5503
|
-
|
|
5504
|
-
continue;
|
|
5505
|
-
children[i].__render(canvas, options);
|
|
5544
|
+
excludeRenderBounds$1(children[i], options) || children[i].__render(canvas, options);
|
|
5506
5545
|
}
|
|
5507
5546
|
}
|
|
5508
5547
|
},
|
|
@@ -5510,16 +5549,15 @@ const BranchRender = {
|
|
|
5510
5549
|
if (this.__worldOpacity) {
|
|
5511
5550
|
const { children } = this;
|
|
5512
5551
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
5513
|
-
|
|
5514
|
-
continue;
|
|
5515
|
-
children[i].__clip(canvas, options);
|
|
5552
|
+
excludeRenderBounds$1(children[i], options) || children[i].__clip(canvas, options);
|
|
5516
5553
|
}
|
|
5517
5554
|
}
|
|
5518
5555
|
}
|
|
5519
5556
|
};
|
|
5520
5557
|
|
|
5558
|
+
const tempScaleData$1 = {};
|
|
5521
5559
|
const { LEAF, create } = IncrementId;
|
|
5522
|
-
const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
|
|
5560
|
+
const { toInnerPoint, toOuterPoint, multiplyParent: multiplyParent$1 } = MatrixHelper;
|
|
5523
5561
|
const { toOuterOf } = BoundsHelper;
|
|
5524
5562
|
const { copy: copy$3, move } = PointHelper;
|
|
5525
5563
|
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
|
|
@@ -5701,7 +5739,7 @@ let Leaf = class Leaf {
|
|
|
5701
5739
|
if (!this.__cameraWorld)
|
|
5702
5740
|
this.__cameraWorld = {};
|
|
5703
5741
|
const cameraWorld = this.__cameraWorld, world = this.__world;
|
|
5704
|
-
multiplyParent(world, options.matrix, cameraWorld, undefined, world);
|
|
5742
|
+
multiplyParent$1(world, options.matrix, cameraWorld, undefined, world);
|
|
5705
5743
|
toOuterOf(this.__layout.renderBounds, cameraWorld, cameraWorld);
|
|
5706
5744
|
cameraWorld.half !== world.half && (cameraWorld.half = world.half);
|
|
5707
5745
|
return cameraWorld;
|
|
@@ -5710,6 +5748,22 @@ let Leaf = class Leaf {
|
|
|
5710
5748
|
return this.__world;
|
|
5711
5749
|
}
|
|
5712
5750
|
}
|
|
5751
|
+
getClampRenderScale() {
|
|
5752
|
+
let { scaleX } = this.__nowWorld || this.__world;
|
|
5753
|
+
if (scaleX < 0)
|
|
5754
|
+
scaleX = -scaleX;
|
|
5755
|
+
return scaleX > 1 ? scaleX : 1;
|
|
5756
|
+
}
|
|
5757
|
+
getRenderScaleData(abs, scaleFixed) {
|
|
5758
|
+
const { scaleX, scaleY } = ImageManager.patternLocked ? this.__world : this.__nowWorld;
|
|
5759
|
+
if (scaleFixed)
|
|
5760
|
+
tempScaleData$1.scaleX = tempScaleData$1.scaleY = 1;
|
|
5761
|
+
else if (abs)
|
|
5762
|
+
tempScaleData$1.scaleX = scaleX < 0 ? -scaleX : scaleX, tempScaleData$1.scaleY = scaleY < 0 ? -scaleY : scaleY;
|
|
5763
|
+
else
|
|
5764
|
+
tempScaleData$1.scaleX = scaleX, tempScaleData$1.scaleY = scaleY;
|
|
5765
|
+
return tempScaleData$1;
|
|
5766
|
+
}
|
|
5713
5767
|
getTransform(relative) {
|
|
5714
5768
|
return this.__layout.getTransform(relative || 'local');
|
|
5715
5769
|
}
|
|
@@ -5865,7 +5919,8 @@ let Leaf = class Leaf {
|
|
|
5865
5919
|
__drawFast(_canvas, _options) { }
|
|
5866
5920
|
__draw(_canvas, _options, _originCanvas) { }
|
|
5867
5921
|
__clip(_canvas, _options) { }
|
|
5868
|
-
__renderShape(_canvas, _options
|
|
5922
|
+
__renderShape(_canvas, _options) { }
|
|
5923
|
+
__drawShape(_canvas, _options) { }
|
|
5869
5924
|
__updateWorldOpacity() { }
|
|
5870
5925
|
__updateChange() { }
|
|
5871
5926
|
__drawPath(_canvas) { }
|
|
@@ -6233,7 +6288,7 @@ class LeafLevelList {
|
|
|
6233
6288
|
}
|
|
6234
6289
|
}
|
|
6235
6290
|
|
|
6236
|
-
const version = "1.
|
|
6291
|
+
const version = "1.8.0";
|
|
6237
6292
|
|
|
6238
6293
|
const debug$4 = Debug.get('LeaferCanvas');
|
|
6239
6294
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
@@ -7105,6 +7160,11 @@ function zoomLayerType() {
|
|
|
7105
7160
|
});
|
|
7106
7161
|
};
|
|
7107
7162
|
}
|
|
7163
|
+
function createAttr(defaultValue) {
|
|
7164
|
+
return (target, key) => {
|
|
7165
|
+
defineKey(target, key, createDescriptor(key, defaultValue));
|
|
7166
|
+
};
|
|
7167
|
+
}
|
|
7108
7168
|
|
|
7109
7169
|
function hasTransparent$3(color) {
|
|
7110
7170
|
if (!color || color.length === 7 || color.length === 4)
|
|
@@ -7162,26 +7222,9 @@ const emptyPaint = {};
|
|
|
7162
7222
|
const debug$1 = Debug.get('UIData');
|
|
7163
7223
|
class UIData extends LeafData {
|
|
7164
7224
|
get scale() { const { scaleX, scaleY } = this; return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX; }
|
|
7165
|
-
get __strokeWidth() {
|
|
7166
|
-
|
|
7167
|
-
|
|
7168
|
-
const ui = this.__leaf;
|
|
7169
|
-
let { scaleX } = ui.__nowWorld || ui.__world;
|
|
7170
|
-
if (scaleX < 0)
|
|
7171
|
-
scaleX = -scaleX;
|
|
7172
|
-
return scaleX > 1 ? strokeWidth / scaleX : strokeWidth;
|
|
7173
|
-
}
|
|
7174
|
-
else
|
|
7175
|
-
return strokeWidth;
|
|
7176
|
-
}
|
|
7177
|
-
get __hasStroke() { return this.stroke && this.strokeWidth; }
|
|
7178
|
-
get __hasHalf() { const t = this; return (t.stroke && t.strokeAlign === 'center' && t.strokeWidth % 2) || undefined; }
|
|
7179
|
-
get __hasMultiPaint() {
|
|
7180
|
-
const t = this;
|
|
7181
|
-
if ((t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect)
|
|
7182
|
-
return true;
|
|
7183
|
-
return t.fill && this.__hasStroke;
|
|
7184
|
-
}
|
|
7225
|
+
get __strokeWidth() { return this.__getRealStrokeWidth(); }
|
|
7226
|
+
get __maxStrokeWidth() { const t = this; return t.__hasMultiStrokeStyle ? Math.max(t.__hasMultiStrokeStyle, t.strokeWidth) : t.strokeWidth; }
|
|
7227
|
+
get __hasMultiPaint() { const t = this; return (t.fill && this.__useStroke) || (t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect; }
|
|
7185
7228
|
get __clipAfterFill() { const t = this; return (t.cornerRadius || t.innerShadow || t.__pathInputed); }
|
|
7186
7229
|
get __hasSurface() { const t = this; return (t.fill || t.stroke); }
|
|
7187
7230
|
get __autoWidth() { return !this._width; }
|
|
@@ -7263,6 +7306,21 @@ class UIData extends LeafData {
|
|
|
7263
7306
|
Paint.compute('stroke', this.__leaf);
|
|
7264
7307
|
this.__needComputePaint = undefined;
|
|
7265
7308
|
}
|
|
7309
|
+
__getRealStrokeWidth(childStyle) {
|
|
7310
|
+
let { strokeWidth, strokeWidthFixed } = this;
|
|
7311
|
+
if (childStyle) {
|
|
7312
|
+
if (childStyle.strokeWidth)
|
|
7313
|
+
strokeWidth = childStyle.strokeWidth;
|
|
7314
|
+
if (childStyle.strokeWidthFixed !== undefined)
|
|
7315
|
+
strokeWidthFixed = childStyle.strokeWidthFixed;
|
|
7316
|
+
}
|
|
7317
|
+
if (strokeWidthFixed) {
|
|
7318
|
+
const scale = this.__leaf.getClampRenderScale();
|
|
7319
|
+
return scale > 1 ? strokeWidth / scale : strokeWidth;
|
|
7320
|
+
}
|
|
7321
|
+
else
|
|
7322
|
+
return strokeWidth;
|
|
7323
|
+
}
|
|
7266
7324
|
__setPaint(attrName, value) {
|
|
7267
7325
|
this.__setInput(attrName, value);
|
|
7268
7326
|
const layout = this.__leaf.__layout;
|
|
@@ -7287,6 +7345,7 @@ class UIData extends LeafData {
|
|
|
7287
7345
|
}
|
|
7288
7346
|
else {
|
|
7289
7347
|
stintSet$2(this, '__isAlphaPixelStroke', undefined);
|
|
7348
|
+
stintSet$2(this, '__hasMultiStrokeStyle', undefined);
|
|
7290
7349
|
this._stroke = this.__isStrokes = undefined;
|
|
7291
7350
|
}
|
|
7292
7351
|
}
|
|
@@ -7308,8 +7367,8 @@ class GroupData extends UIData {
|
|
|
7308
7367
|
|
|
7309
7368
|
class BoxData extends GroupData {
|
|
7310
7369
|
get __boxStroke() { return !this.__pathInputed; }
|
|
7311
|
-
get __drawAfterFill() { const t = this; return
|
|
7312
|
-
get __clipAfterFill() { return
|
|
7370
|
+
get __drawAfterFill() { const t = this; return t.__single || t.__clipAfterFill; }
|
|
7371
|
+
get __clipAfterFill() { const t = this; return t.overflow === 'hide' && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill); }
|
|
7313
7372
|
}
|
|
7314
7373
|
|
|
7315
7374
|
class LeaferData extends GroupData {
|
|
@@ -7429,7 +7488,7 @@ class CanvasData extends RectData {
|
|
|
7429
7488
|
const UIBounds = {
|
|
7430
7489
|
__updateStrokeSpread() {
|
|
7431
7490
|
let width = 0, boxWidth = 0;
|
|
7432
|
-
const data = this.__, { strokeAlign, strokeWidth } = data, box = this.__box;
|
|
7491
|
+
const data = this.__, { strokeAlign, __maxStrokeWidth: strokeWidth } = data, box = this.__box;
|
|
7433
7492
|
if ((data.stroke || data.hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
|
|
7434
7493
|
boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth;
|
|
7435
7494
|
if (!data.__boxStroke) {
|
|
@@ -7449,13 +7508,15 @@ const UIBounds = {
|
|
|
7449
7508
|
},
|
|
7450
7509
|
__updateRenderSpread() {
|
|
7451
7510
|
let width = 0;
|
|
7452
|
-
const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
|
|
7511
|
+
const { shadow, innerShadow, blur, backgroundBlur, filter, renderSpread } = this.__;
|
|
7453
7512
|
if (shadow)
|
|
7454
7513
|
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));
|
|
7455
7514
|
if (blur)
|
|
7456
7515
|
width = Math.max(width, blur);
|
|
7457
7516
|
if (filter)
|
|
7458
7517
|
width += Filter.getSpread(filter);
|
|
7518
|
+
if (renderSpread)
|
|
7519
|
+
width += renderSpread;
|
|
7459
7520
|
let shapeWidth = width = Math.ceil(width);
|
|
7460
7521
|
if (innerShadow)
|
|
7461
7522
|
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));
|
|
@@ -7471,15 +7532,18 @@ const { stintSet: stintSet$1 } = DataHelper;
|
|
|
7471
7532
|
const UIRender = {
|
|
7472
7533
|
__updateChange() {
|
|
7473
7534
|
const data = this.__;
|
|
7535
|
+
if (data.__useStroke) {
|
|
7536
|
+
const useStroke = data.__useStroke = !!(data.stroke && data.strokeWidth);
|
|
7537
|
+
stintSet$1(this.__world, 'half', useStroke && data.strokeAlign === 'center' && data.strokeWidth % 2);
|
|
7538
|
+
stintSet$1(data, '__fillAfterStroke', useStroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
|
|
7539
|
+
}
|
|
7474
7540
|
if (data.__useEffect) {
|
|
7475
7541
|
const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
|
|
7476
|
-
stintSet$1(data, '__isFastShadow', shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread &&
|
|
7542
|
+
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')));
|
|
7477
7543
|
data.__useEffect = !!(shadow || otherEffect);
|
|
7478
7544
|
}
|
|
7479
|
-
stintSet$1(this.__world, 'half', data.__hasHalf);
|
|
7480
|
-
stintSet$1(data, '__fillAfterStroke', data.stroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
|
|
7481
7545
|
data.__checkSingle();
|
|
7482
|
-
stintSet$1(data, '__complex', data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
|
|
7546
|
+
stintSet$1(data, '__complex', (data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect));
|
|
7483
7547
|
},
|
|
7484
7548
|
__drawFast(canvas, options) {
|
|
7485
7549
|
drawFast(this, canvas, options);
|
|
@@ -7537,18 +7601,15 @@ const UIRender = {
|
|
|
7537
7601
|
this.__drawFast(canvas, options);
|
|
7538
7602
|
}
|
|
7539
7603
|
},
|
|
7540
|
-
|
|
7541
|
-
|
|
7542
|
-
|
|
7543
|
-
|
|
7544
|
-
this.
|
|
7545
|
-
|
|
7546
|
-
|
|
7547
|
-
|
|
7548
|
-
|
|
7549
|
-
if (stroke && !ignoreStroke)
|
|
7550
|
-
this.__.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
7551
|
-
}
|
|
7604
|
+
__drawShape(canvas, options) {
|
|
7605
|
+
this.__drawRenderPath(canvas);
|
|
7606
|
+
const data = this.__, { fill, stroke } = data;
|
|
7607
|
+
if (fill && !options.ignoreFill)
|
|
7608
|
+
data.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
|
|
7609
|
+
if (data.__isCanvas)
|
|
7610
|
+
this.__drawAfterFill(canvas, options);
|
|
7611
|
+
if (stroke && !options.ignoreStroke)
|
|
7612
|
+
data.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
|
|
7552
7613
|
},
|
|
7553
7614
|
__drawAfterFill(canvas, options) {
|
|
7554
7615
|
if (this.__.__clipAfterFill) {
|
|
@@ -7585,17 +7646,17 @@ const RectRender = {
|
|
|
7585
7646
|
if (__drawAfterFill)
|
|
7586
7647
|
this.__drawAfterFill(canvas, options);
|
|
7587
7648
|
if (stroke) {
|
|
7588
|
-
const { strokeAlign, __strokeWidth } = this.__;
|
|
7589
|
-
if (!
|
|
7649
|
+
const { strokeAlign, __strokeWidth: strokeWidth } = this.__;
|
|
7650
|
+
if (!strokeWidth)
|
|
7590
7651
|
return;
|
|
7591
|
-
canvas.setStroke(stroke,
|
|
7592
|
-
const half =
|
|
7652
|
+
canvas.setStroke(stroke, strokeWidth, this.__);
|
|
7653
|
+
const half = strokeWidth / 2;
|
|
7593
7654
|
switch (strokeAlign) {
|
|
7594
7655
|
case 'center':
|
|
7595
7656
|
canvas.strokeRect(0, 0, width, height);
|
|
7596
7657
|
break;
|
|
7597
7658
|
case 'inside':
|
|
7598
|
-
width -=
|
|
7659
|
+
width -= strokeWidth, height -= strokeWidth;
|
|
7599
7660
|
if (width < 0 || height < 0) {
|
|
7600
7661
|
canvas.save();
|
|
7601
7662
|
this.__clip(canvas, options);
|
|
@@ -7606,7 +7667,7 @@ const RectRender = {
|
|
|
7606
7667
|
canvas.strokeRect(x + half, y + half, width, height);
|
|
7607
7668
|
break;
|
|
7608
7669
|
case 'outside':
|
|
7609
|
-
canvas.strokeRect(x - half, y - half, width +
|
|
7670
|
+
canvas.strokeRect(x - half, y - half, width + strokeWidth, height + strokeWidth);
|
|
7610
7671
|
break;
|
|
7611
7672
|
}
|
|
7612
7673
|
}
|
|
@@ -7619,6 +7680,8 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7619
7680
|
get isFrame() { return false; }
|
|
7620
7681
|
set scale(value) { MathHelper.assignScale(this, value); }
|
|
7621
7682
|
get scale() { return this.__.scale; }
|
|
7683
|
+
get isAutoWidth() { const t = this.__; return t.__autoWidth || t.autoWidth; }
|
|
7684
|
+
get isAutoHeight() { const t = this.__; return t.__autoHeight || t.autoHeight; }
|
|
7622
7685
|
get pen() {
|
|
7623
7686
|
const { path } = this.__;
|
|
7624
7687
|
pen.set(this.path = path || []);
|
|
@@ -7673,12 +7736,14 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7673
7736
|
}
|
|
7674
7737
|
}
|
|
7675
7738
|
__updateRenderPath() {
|
|
7676
|
-
|
|
7677
|
-
|
|
7739
|
+
const data = this.__;
|
|
7740
|
+
if (data.path) {
|
|
7678
7741
|
data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
7679
7742
|
if (data.__useArrow)
|
|
7680
7743
|
PathArrow.addArrows(this, !data.cornerRadius);
|
|
7681
7744
|
}
|
|
7745
|
+
else
|
|
7746
|
+
data.__pathForRender && (data.__pathForRender = undefined);
|
|
7682
7747
|
}
|
|
7683
7748
|
__drawRenderPath(canvas) {
|
|
7684
7749
|
canvas.beginPath();
|
|
@@ -7831,6 +7896,9 @@ __decorate([
|
|
|
7831
7896
|
__decorate([
|
|
7832
7897
|
naturalBoundsType(1)
|
|
7833
7898
|
], UI.prototype, "pixelRatio", void 0);
|
|
7899
|
+
__decorate([
|
|
7900
|
+
affectRenderBoundsType(0)
|
|
7901
|
+
], UI.prototype, "renderSpread", void 0);
|
|
7834
7902
|
__decorate([
|
|
7835
7903
|
pathInputType()
|
|
7836
7904
|
], UI.prototype, "path", void 0);
|
|
@@ -7889,13 +7957,13 @@ __decorate([
|
|
|
7889
7957
|
surfaceType()
|
|
7890
7958
|
], UI.prototype, "fill", void 0);
|
|
7891
7959
|
__decorate([
|
|
7892
|
-
strokeType()
|
|
7960
|
+
strokeType(undefined, true)
|
|
7893
7961
|
], UI.prototype, "stroke", void 0);
|
|
7894
7962
|
__decorate([
|
|
7895
7963
|
strokeType('inside')
|
|
7896
7964
|
], UI.prototype, "strokeAlign", void 0);
|
|
7897
7965
|
__decorate([
|
|
7898
|
-
strokeType(1)
|
|
7966
|
+
strokeType(1, true)
|
|
7899
7967
|
], UI.prototype, "strokeWidth", void 0);
|
|
7900
7968
|
__decorate([
|
|
7901
7969
|
strokeType(false)
|
|
@@ -7987,7 +8055,8 @@ let Group = class Group extends UI {
|
|
|
7987
8055
|
}
|
|
7988
8056
|
toJSON(options) {
|
|
7989
8057
|
const data = super.toJSON(options);
|
|
7990
|
-
|
|
8058
|
+
if (!this.childlessJSON)
|
|
8059
|
+
data.children = this.children.map(child => child.toJSON(options));
|
|
7991
8060
|
return data;
|
|
7992
8061
|
}
|
|
7993
8062
|
pick(_hitPoint, _options) { return undefined; }
|
|
@@ -8322,7 +8391,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8322
8391
|
list.push(item);
|
|
8323
8392
|
this.requestRender();
|
|
8324
8393
|
}
|
|
8325
|
-
zoom(_zoomType,
|
|
8394
|
+
zoom(_zoomType, _optionsOrPadding, _scroll, _transition) {
|
|
8326
8395
|
return Plugin.need('view');
|
|
8327
8396
|
}
|
|
8328
8397
|
getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
|
|
@@ -8367,7 +8436,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8367
8436
|
Leafer_1.list.remove(this);
|
|
8368
8437
|
try {
|
|
8369
8438
|
this.stop();
|
|
8370
|
-
this.
|
|
8439
|
+
this.emitLeafer(LeaferEvent.END);
|
|
8371
8440
|
this.__removeListenEvents();
|
|
8372
8441
|
this.__controllers.forEach(item => !(this.parent && item === this.interaction) && item.destroy());
|
|
8373
8442
|
this.__controllers.length = 0;
|
|
@@ -8434,8 +8503,8 @@ let Box = class Box extends Group {
|
|
|
8434
8503
|
__updateRenderSpread() { return this.__updateRectRenderSpread() || -1; }
|
|
8435
8504
|
__updateRectBoxBounds() { }
|
|
8436
8505
|
__updateBoxBounds(_secondLayout) {
|
|
8437
|
-
const data = this.__;
|
|
8438
8506
|
if (this.children.length && !this.pathInputed) {
|
|
8507
|
+
const data = this.__;
|
|
8439
8508
|
if (data.__autoSide) {
|
|
8440
8509
|
if (data.__hasSurface)
|
|
8441
8510
|
this.__extraUpdate();
|
|
@@ -8462,20 +8531,26 @@ let Box = class Box extends Group {
|
|
|
8462
8531
|
__updateStrokeBounds() { }
|
|
8463
8532
|
__updateRenderBounds() {
|
|
8464
8533
|
let isOverflow;
|
|
8465
|
-
const { renderBounds } = this.__layout;
|
|
8466
8534
|
if (this.children.length) {
|
|
8535
|
+
const data = this.__, { renderBounds, boxBounds } = this.__layout;
|
|
8467
8536
|
super.__updateRenderBounds();
|
|
8468
8537
|
copy$2(childrenRenderBounds, renderBounds);
|
|
8469
8538
|
this.__updateRectRenderBounds();
|
|
8470
|
-
|
|
8471
|
-
|
|
8539
|
+
if (data.scrollY || data.scrollX) {
|
|
8540
|
+
childrenRenderBounds.x += data.scrollX;
|
|
8541
|
+
childrenRenderBounds.y += data.scrollY;
|
|
8542
|
+
}
|
|
8543
|
+
isOverflow = !includes$1(boxBounds, childrenRenderBounds);
|
|
8544
|
+
if (isOverflow && data.overflow !== 'hide')
|
|
8472
8545
|
add(renderBounds, childrenRenderBounds);
|
|
8473
8546
|
}
|
|
8474
8547
|
else
|
|
8475
8548
|
this.__updateRectRenderBounds();
|
|
8476
8549
|
DataHelper.stintSet(this, 'isOverflow', isOverflow);
|
|
8550
|
+
this.__updateScrollBar();
|
|
8477
8551
|
}
|
|
8478
8552
|
__updateRectRenderBounds() { }
|
|
8553
|
+
__updateScrollBar() { }
|
|
8479
8554
|
__updateRectChange() { }
|
|
8480
8555
|
__updateChange() {
|
|
8481
8556
|
super.__updateChange();
|
|
@@ -8492,10 +8567,12 @@ let Box = class Box extends Group {
|
|
|
8492
8567
|
if (this.children.length)
|
|
8493
8568
|
this.__renderGroup(canvas, options);
|
|
8494
8569
|
}
|
|
8570
|
+
if (this.scrollBar)
|
|
8571
|
+
this.scrollBar.__render(canvas, options);
|
|
8495
8572
|
}
|
|
8496
8573
|
__drawContent(canvas, options) {
|
|
8497
8574
|
this.__renderGroup(canvas, options);
|
|
8498
|
-
if (this.__.
|
|
8575
|
+
if (this.__.__useStroke || this.__.__useEffect) {
|
|
8499
8576
|
canvas.setWorld(this.__nowWorld);
|
|
8500
8577
|
this.__drawRenderPath(canvas);
|
|
8501
8578
|
}
|
|
@@ -8715,8 +8792,8 @@ let Polygon = class Polygon extends UI {
|
|
|
8715
8792
|
for (let i = 1; i < sides; i++) {
|
|
8716
8793
|
lineTo$1(path, rx + rx * sin$1((i * 2 * PI$1) / sides), ry - ry * cos$1((i * 2 * PI$1) / sides));
|
|
8717
8794
|
}
|
|
8795
|
+
closePath$1(path);
|
|
8718
8796
|
}
|
|
8719
|
-
closePath$1(path);
|
|
8720
8797
|
}
|
|
8721
8798
|
__updateRenderPath() { }
|
|
8722
8799
|
__updateBoxBounds() { }
|
|
@@ -8954,6 +9031,11 @@ let Text = class Text extends UI {
|
|
|
8954
9031
|
return;
|
|
8955
9032
|
super.__draw(canvas, options, originCanvas);
|
|
8956
9033
|
}
|
|
9034
|
+
__drawShape(canvas, options) {
|
|
9035
|
+
if (options.shape)
|
|
9036
|
+
this.__box && this.__box.__drawShape(canvas, options);
|
|
9037
|
+
super.__drawShape(canvas, options);
|
|
9038
|
+
}
|
|
8957
9039
|
destroy() {
|
|
8958
9040
|
if (this.boxStyle)
|
|
8959
9041
|
this.boxStyle = null;
|
|
@@ -9149,9 +9231,14 @@ function fills(fills, ui, canvas) {
|
|
|
9149
9231
|
}
|
|
9150
9232
|
}
|
|
9151
9233
|
canvas.fillStyle = item.style;
|
|
9152
|
-
if (item.transform) {
|
|
9234
|
+
if (item.transform || item.scaleFixed) {
|
|
9153
9235
|
canvas.save();
|
|
9154
|
-
|
|
9236
|
+
if (item.transform)
|
|
9237
|
+
canvas.transform(item.transform);
|
|
9238
|
+
if (item.scaleFixed) {
|
|
9239
|
+
const { scaleX, scaleY } = ui.getRenderScaleData(true);
|
|
9240
|
+
canvas.scale(1 / scaleX, 1 / scaleY);
|
|
9241
|
+
}
|
|
9155
9242
|
if (item.blendMode)
|
|
9156
9243
|
canvas.blendMode = item.blendMode;
|
|
9157
9244
|
fillPathOrText(ui, canvas);
|
|
@@ -9187,8 +9274,13 @@ function strokeText(stroke, ui, canvas) {
|
|
|
9187
9274
|
}
|
|
9188
9275
|
function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
|
|
9189
9276
|
const data = ui.__;
|
|
9190
|
-
|
|
9191
|
-
|
|
9277
|
+
if (typeof stroke === 'object') {
|
|
9278
|
+
drawStrokesStyle(stroke, strokeWidthScale, true, ui, canvas);
|
|
9279
|
+
}
|
|
9280
|
+
else {
|
|
9281
|
+
canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
9282
|
+
drawTextStroke(ui, canvas);
|
|
9283
|
+
}
|
|
9192
9284
|
}
|
|
9193
9285
|
function drawAlign(stroke, align, ui, canvas) {
|
|
9194
9286
|
const out = canvas.getSameCanvas(true, true);
|
|
@@ -9197,15 +9289,9 @@ function drawAlign(stroke, align, ui, canvas) {
|
|
|
9197
9289
|
out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
|
|
9198
9290
|
fillText(ui, out);
|
|
9199
9291
|
out.blendMode = 'normal';
|
|
9200
|
-
|
|
9292
|
+
LeafHelper.copyCanvasByWorld(ui, canvas, out);
|
|
9201
9293
|
out.recycle(ui.__nowWorld);
|
|
9202
9294
|
}
|
|
9203
|
-
function copyWorld(canvas, out, ui) {
|
|
9204
|
-
if (ui.__worldFlipped || Platform.fullImageShadow)
|
|
9205
|
-
canvas.copyWorldByReset(out, ui.__nowWorld);
|
|
9206
|
-
else
|
|
9207
|
-
canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
|
|
9208
|
-
}
|
|
9209
9295
|
function drawTextStroke(ui, canvas) {
|
|
9210
9296
|
let row, data = ui.__.__textDrawData;
|
|
9211
9297
|
const { rows, decorationY } = data;
|
|
@@ -9221,14 +9307,21 @@ function drawTextStroke(ui, canvas) {
|
|
|
9221
9307
|
rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
9222
9308
|
}
|
|
9223
9309
|
}
|
|
9224
|
-
function drawStrokesStyle(strokes, isText, ui, canvas) {
|
|
9310
|
+
function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas) {
|
|
9225
9311
|
let item;
|
|
9312
|
+
const data = ui.__, { __hasMultiStrokeStyle } = data;
|
|
9313
|
+
__hasMultiStrokeStyle || canvas.setStroke(undefined, data.__strokeWidth * strokeWidthScale, data);
|
|
9226
9314
|
for (let i = 0, len = strokes.length; i < len; i++) {
|
|
9227
9315
|
item = strokes[i];
|
|
9228
9316
|
if (item.image && PaintImage.checkImage(ui, canvas, item, false))
|
|
9229
9317
|
continue;
|
|
9230
9318
|
if (item.style) {
|
|
9231
|
-
|
|
9319
|
+
if (__hasMultiStrokeStyle) {
|
|
9320
|
+
const { strokeStyle } = item;
|
|
9321
|
+
strokeStyle ? canvas.setStroke(item.style, data.__getRealStrokeWidth(strokeStyle) * strokeWidthScale, data, strokeStyle) : canvas.setStroke(item.style, data.__strokeWidth * strokeWidthScale, data);
|
|
9322
|
+
}
|
|
9323
|
+
else
|
|
9324
|
+
canvas.strokeStyle = item.style;
|
|
9232
9325
|
if (item.blendMode) {
|
|
9233
9326
|
canvas.saveBlendMode(item.blendMode);
|
|
9234
9327
|
isText ? drawTextStroke(ui, canvas) : canvas.stroke();
|
|
@@ -9267,8 +9360,13 @@ function strokes(strokes, ui, canvas) {
|
|
|
9267
9360
|
}
|
|
9268
9361
|
function drawCenter(stroke, strokeWidthScale, ui, canvas) {
|
|
9269
9362
|
const data = ui.__;
|
|
9270
|
-
|
|
9271
|
-
|
|
9363
|
+
if (typeof stroke === 'object') {
|
|
9364
|
+
drawStrokesStyle(stroke, strokeWidthScale, false, ui, canvas);
|
|
9365
|
+
}
|
|
9366
|
+
else {
|
|
9367
|
+
canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
|
|
9368
|
+
canvas.stroke();
|
|
9369
|
+
}
|
|
9272
9370
|
if (data.__useArrow)
|
|
9273
9371
|
Paint.strokeArrow(stroke, ui, canvas);
|
|
9274
9372
|
}
|
|
@@ -9290,7 +9388,7 @@ function drawOutside(stroke, ui, canvas) {
|
|
|
9290
9388
|
drawCenter(stroke, 2, ui, out);
|
|
9291
9389
|
out.clipUI(data);
|
|
9292
9390
|
out.clearWorld(renderBounds);
|
|
9293
|
-
|
|
9391
|
+
LeafHelper.copyCanvasByWorld(ui, canvas, out);
|
|
9294
9392
|
out.recycle(ui.__nowWorld);
|
|
9295
9393
|
}
|
|
9296
9394
|
}
|
|
@@ -9345,8 +9443,16 @@ function compute(attrName, ui) {
|
|
|
9345
9443
|
if (!(paints instanceof Array))
|
|
9346
9444
|
paints = [paints];
|
|
9347
9445
|
recycleMap = PaintImage.recycleImage(attrName, data);
|
|
9446
|
+
let maxChildStrokeWidth;
|
|
9348
9447
|
for (let i = 0, len = paints.length, item; i < len; i++) {
|
|
9349
|
-
(item = getLeafPaint(attrName, paints[i], ui))
|
|
9448
|
+
if (item = getLeafPaint(attrName, paints[i], ui)) {
|
|
9449
|
+
leafPaints.push(item);
|
|
9450
|
+
if (item.strokeStyle) {
|
|
9451
|
+
maxChildStrokeWidth || (maxChildStrokeWidth = 1);
|
|
9452
|
+
if (item.strokeStyle.strokeWidth)
|
|
9453
|
+
maxChildStrokeWidth = Math.max(maxChildStrokeWidth, item.strokeStyle.strokeWidth);
|
|
9454
|
+
}
|
|
9455
|
+
}
|
|
9350
9456
|
}
|
|
9351
9457
|
data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
|
|
9352
9458
|
if (leafPaints.length) {
|
|
@@ -9363,6 +9469,7 @@ function compute(attrName, ui) {
|
|
|
9363
9469
|
else {
|
|
9364
9470
|
stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
|
|
9365
9471
|
stintSet(data, '__isTransparentStroke', isTransparent);
|
|
9472
|
+
stintSet(data, '__hasMultiStrokeStyle', maxChildStrokeWidth);
|
|
9366
9473
|
}
|
|
9367
9474
|
}
|
|
9368
9475
|
function getLeafPaint(attrName, paint, ui) {
|
|
@@ -9394,6 +9501,11 @@ function getLeafPaint(attrName, paint, ui) {
|
|
|
9394
9501
|
if (data) {
|
|
9395
9502
|
if (typeof data.style === 'string' && hasTransparent$1(data.style))
|
|
9396
9503
|
data.isTransparent = true;
|
|
9504
|
+
if (paint.style) {
|
|
9505
|
+
if (paint.style.strokeWidth === 0)
|
|
9506
|
+
return undefined;
|
|
9507
|
+
data.strokeStyle = paint.style;
|
|
9508
|
+
}
|
|
9397
9509
|
if (paint.blendMode)
|
|
9398
9510
|
data.blendMode = paint.blendMode;
|
|
9399
9511
|
}
|
|
@@ -9413,8 +9525,8 @@ const PaintModule = {
|
|
|
9413
9525
|
shape
|
|
9414
9526
|
};
|
|
9415
9527
|
|
|
9416
|
-
let origin = {};
|
|
9417
|
-
const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, scale: scaleHelper, rotate } = MatrixHelper;
|
|
9528
|
+
let origin = {}, tempMatrix = getMatrixData();
|
|
9529
|
+
const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent, scale: scaleHelper, rotate, skew: skewHelper } = MatrixHelper;
|
|
9418
9530
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
9419
9531
|
const transform = get$3();
|
|
9420
9532
|
translate$1(transform, box.x + x, box.y + y);
|
|
@@ -9423,13 +9535,19 @@ function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
|
9423
9535
|
rotateOfOuter$1(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
|
|
9424
9536
|
data.transform = transform;
|
|
9425
9537
|
}
|
|
9426
|
-
function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
9538
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipSize) {
|
|
9427
9539
|
const transform = get$3();
|
|
9428
|
-
translate$1(transform, box.x + x, box.y + y);
|
|
9429
|
-
if (scaleX)
|
|
9430
|
-
scaleHelper(transform, scaleX, scaleY);
|
|
9431
9540
|
if (rotation)
|
|
9432
9541
|
rotate(transform, rotation);
|
|
9542
|
+
if (skew)
|
|
9543
|
+
skewHelper(transform, skew.x, skew.y);
|
|
9544
|
+
if (scaleX)
|
|
9545
|
+
scaleHelper(transform, scaleX, scaleY);
|
|
9546
|
+
translate$1(transform, box.x + x, box.y + y);
|
|
9547
|
+
if (clipSize) {
|
|
9548
|
+
tempMatrix.a = box.width / clipSize.width, tempMatrix.d = box.height / clipSize.height;
|
|
9549
|
+
multiplyParent(transform, tempMatrix);
|
|
9550
|
+
}
|
|
9433
9551
|
data.transform = transform;
|
|
9434
9552
|
}
|
|
9435
9553
|
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
|
|
@@ -9466,11 +9584,15 @@ const tempBox = new Bounds();
|
|
|
9466
9584
|
const tempScaleData = {};
|
|
9467
9585
|
const tempImage = {};
|
|
9468
9586
|
function createData(leafPaint, image, paint, box) {
|
|
9469
|
-
const { changeful, sync } = paint;
|
|
9587
|
+
const { changeful, sync, editing, scaleFixed } = paint;
|
|
9470
9588
|
if (changeful)
|
|
9471
9589
|
leafPaint.changeful = changeful;
|
|
9472
9590
|
if (sync)
|
|
9473
9591
|
leafPaint.sync = sync;
|
|
9592
|
+
if (editing)
|
|
9593
|
+
leafPaint.editing = editing;
|
|
9594
|
+
if (scaleFixed)
|
|
9595
|
+
leafPaint.scaleFixed = scaleFixed;
|
|
9474
9596
|
leafPaint.data = getPatternData(paint, box, image);
|
|
9475
9597
|
}
|
|
9476
9598
|
function getPatternData(paint, box, image) {
|
|
@@ -9479,7 +9601,7 @@ function getPatternData(paint, box, image) {
|
|
|
9479
9601
|
if (paint.mode === 'strench')
|
|
9480
9602
|
paint.mode = 'stretch';
|
|
9481
9603
|
let { width, height } = image;
|
|
9482
|
-
const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
|
|
9604
|
+
const { opacity, mode, align, offset, scale, size, rotation, skew, clipSize, repeat, filters } = paint;
|
|
9483
9605
|
const sameBox = box.width === width && box.height === height;
|
|
9484
9606
|
const data = { mode };
|
|
9485
9607
|
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
@@ -9513,8 +9635,8 @@ function getPatternData(paint, box, image) {
|
|
|
9513
9635
|
break;
|
|
9514
9636
|
case 'normal':
|
|
9515
9637
|
case 'clip':
|
|
9516
|
-
if (tempImage.x || tempImage.y || scaleX || rotation)
|
|
9517
|
-
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
|
|
9638
|
+
if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
|
|
9639
|
+
clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, paint.clipSize);
|
|
9518
9640
|
break;
|
|
9519
9641
|
case 'repeat':
|
|
9520
9642
|
if (!sameBox || scaleX || rotation)
|
|
@@ -9591,11 +9713,11 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
9591
9713
|
}
|
|
9592
9714
|
onLoadSuccess(ui, event);
|
|
9593
9715
|
}
|
|
9594
|
-
leafPaint.loadId =
|
|
9716
|
+
leafPaint.loadId = undefined;
|
|
9595
9717
|
}, (error) => {
|
|
9596
9718
|
ignoreRender(ui, false);
|
|
9597
9719
|
onLoadError(ui, event, error);
|
|
9598
|
-
leafPaint.loadId =
|
|
9720
|
+
leafPaint.loadId = undefined;
|
|
9599
9721
|
});
|
|
9600
9722
|
if (ui.placeholderColor) {
|
|
9601
9723
|
if (!ui.placeholderDelay)
|
|
@@ -9651,16 +9773,16 @@ function ignoreRender(ui, value) {
|
|
|
9651
9773
|
}
|
|
9652
9774
|
|
|
9653
9775
|
const { get: get$1, scale, copy: copy$1 } = MatrixHelper;
|
|
9654
|
-
const { ceil, abs
|
|
9776
|
+
const { ceil, abs } = Math;
|
|
9655
9777
|
function createPattern(ui, paint, pixelRatio) {
|
|
9656
|
-
let { scaleX, scaleY } =
|
|
9778
|
+
let { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
9657
9779
|
const id = scaleX + '-' + scaleY + '-' + pixelRatio;
|
|
9658
9780
|
if (paint.patternId !== id && !ui.destroyed) {
|
|
9659
|
-
scaleX = abs$1(scaleX);
|
|
9660
|
-
scaleY = abs$1(scaleY);
|
|
9661
9781
|
const { image, data } = paint;
|
|
9662
9782
|
let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
|
|
9663
9783
|
if (sx) {
|
|
9784
|
+
sx = abs(sx);
|
|
9785
|
+
sy = abs(sy);
|
|
9664
9786
|
imageMatrix = get$1();
|
|
9665
9787
|
copy$1(imageMatrix, transform);
|
|
9666
9788
|
scale(imageMatrix, 1 / sx, 1 / sy);
|
|
@@ -9713,9 +9835,8 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
9713
9835
|
}
|
|
9714
9836
|
}
|
|
9715
9837
|
|
|
9716
|
-
const { abs } = Math;
|
|
9717
9838
|
function checkImage(ui, canvas, paint, allowDraw) {
|
|
9718
|
-
const { scaleX, scaleY } =
|
|
9839
|
+
const { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
|
|
9719
9840
|
const { pixelRatio } = canvas, { data } = paint;
|
|
9720
9841
|
if (!data || (paint.patternId === scaleX + '-' + scaleY + '-' + pixelRatio && !Export.running)) {
|
|
9721
9842
|
return false;
|
|
@@ -9728,8 +9849,8 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
9728
9849
|
else {
|
|
9729
9850
|
if (!(paint.changeful || ResizeEvent.isResizing(ui) || Export.running)) {
|
|
9730
9851
|
let { width, height } = data;
|
|
9731
|
-
width *=
|
|
9732
|
-
height *=
|
|
9852
|
+
width *= scaleX * pixelRatio;
|
|
9853
|
+
height *= scaleY * pixelRatio;
|
|
9733
9854
|
if (data.scaleX) {
|
|
9734
9855
|
width *= data.scaleX;
|
|
9735
9856
|
height *= data.scaleY;
|
|
@@ -9739,6 +9860,10 @@ function checkImage(ui, canvas, paint, allowDraw) {
|
|
|
9739
9860
|
}
|
|
9740
9861
|
}
|
|
9741
9862
|
if (allowDraw) {
|
|
9863
|
+
if (ui.__.__isFastShadow) {
|
|
9864
|
+
canvas.fillStyle = paint.style || '#000';
|
|
9865
|
+
canvas.fill();
|
|
9866
|
+
}
|
|
9742
9867
|
drawImage(ui, canvas, paint, data);
|
|
9743
9868
|
return true;
|
|
9744
9869
|
}
|
|
@@ -9927,10 +10052,7 @@ function shadow(ui, current, shape) {
|
|
|
9927
10052
|
}
|
|
9928
10053
|
worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
|
|
9929
10054
|
}
|
|
9930
|
-
|
|
9931
|
-
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
9932
|
-
else
|
|
9933
|
-
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
10055
|
+
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
9934
10056
|
if (end && index < end)
|
|
9935
10057
|
other.clearWorld(copyBounds, true);
|
|
9936
10058
|
});
|
|
@@ -9989,10 +10111,7 @@ function innerShadow(ui, current, shape) {
|
|
|
9989
10111
|
copyBounds = bounds;
|
|
9990
10112
|
}
|
|
9991
10113
|
other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
|
|
9992
|
-
|
|
9993
|
-
current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
|
|
9994
|
-
else
|
|
9995
|
-
current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
|
|
10114
|
+
LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
|
|
9996
10115
|
if (end && index < end)
|
|
9997
10116
|
other.clearWorld(copyBounds, true);
|
|
9998
10117
|
});
|
|
@@ -10048,12 +10167,11 @@ Group.prototype.__renderMask = function (canvas, options) {
|
|
|
10048
10167
|
contentCanvas = getCanvas(canvas);
|
|
10049
10168
|
child.__render(maskCanvas, options);
|
|
10050
10169
|
}
|
|
10051
|
-
if (
|
|
10052
|
-
|
|
10053
|
-
}
|
|
10054
|
-
if (excludeRenderBounds(child, options))
|
|
10170
|
+
if (mask === 'clipping' || mask === 'clipping-path')
|
|
10171
|
+
excludeRenderBounds(child, options) || child.__render(canvas, options);
|
|
10055
10172
|
continue;
|
|
10056
|
-
|
|
10173
|
+
}
|
|
10174
|
+
excludeRenderBounds(child, options) || child.__render(contentCanvas || canvas, options);
|
|
10057
10175
|
}
|
|
10058
10176
|
maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
|
|
10059
10177
|
};
|
|
@@ -10635,4 +10753,4 @@ Object.assign(Effect, EffectModule);
|
|
|
10635
10753
|
|
|
10636
10754
|
useCanvas();
|
|
10637
10755
|
|
|
10638
|
-
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isEmptyData, isNull, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$2 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };
|
|
10756
|
+
export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isEmptyData, isNull, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$2 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };
|