leafer-ui 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.
@@ -43,7 +43,7 @@ const IncrementId = {
43
43
  };
44
44
  const I$2 = IncrementId;
45
45
 
46
- const { round: round$3, pow: pow$1, PI: PI$4 } = Math;
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$4 / 180;
143
- const PI2 = PI$4 * 2;
144
- const PI_2 = PI$4 / 2;
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$4, sqrt: sqrt$2, atan2: atan2$2, min: min$1, round: round$2, PI: PI$3 } = Math;
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$4(x2 - x1);
535
- const y = abs$4(y2 - y1);
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
- let fromAngle = atan2$2(fromY - originY, fromX - originX);
553
- let toAngle = atan2$2(toY - toOriginY, toX - toOriginX);
554
- const radian = toAngle - fromAngle;
555
- return radian < -PI$3 ? radian + PI2 : radian;
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
- Object.defineProperty(target, key, {
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$9, multiplyParent: multiplyParent$3 } = MatrixHelper, { round: round$1 } = Math;
2079
+ const { copy: copy$9, 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$3(matrix, parentMatrix, w);
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
- this.strokeCap = options.strokeCap === 'none' ? 'butt' : options.strokeCap;
2174
- this.strokeJoin = options.strokeJoin;
2175
- this.dashPattern = options.dashPattern;
2176
- this.dashOffset = options.dashOffset;
2177
- this.miterLimit = options.miterLimit;
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$3, PI: PI$2, sqrt: sqrt$1, pow } = Math;
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$3(BAx + BAy) < 1.e-12) || (abs$3(CBx + CBy) < 1.e-12)) {
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$3(totalRadian / PI_2));
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$2 } = Math;
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$2(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
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
- arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY);
3381
- smooth.push(Z);
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 = null;
3912
+ transform = undefined;
3887
3913
  }
3888
3914
  }
3889
3915
  catch (_a) { }
3890
3916
  if (paint)
3891
- paint.transform = transform;
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) && doStrokeType(this);
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$7, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
4289
+ const { copy: copy$7, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$3, divideParent, getLayout } = MatrixHelper;
4261
4290
  const matrix$1 = {}, { 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$7(matrix$1, t.worldTransform);
4391
- multiplyParent$2(matrix$1, transform);
4428
+ multiplyParent$3(matrix$1, transform);
4392
4429
  if (t.parent)
4393
4430
  divideParent(matrix$1, t.parent.worldTransform);
4394
4431
  L.setTransform(t, matrix$1, resize, transition);
4395
4432
  },
4396
4433
  transform(t, transform, resize, transition) {
4397
4434
  copy$7(matrix$1, t.localTransform);
4398
- multiplyParent$2(matrix$1, transform);
4435
+ multiplyParent$3(matrix$1, transform);
4399
4436
  L.setTransform(t, matrix$1, 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$1, translateInner, defaultWorld } = MatrixHelper;
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
- multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__, this.parent && this.parent.__);
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
- if (this.__worldFlipped) {
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
- if (excludeRenderBounds$1(children[i], options))
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
- if (excludeRenderBounds$1(children[i], options))
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$4, 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, _ignoreFill, _ignoreStroke) { }
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.6.7";
6291
+ const version = "1.8.0";
6237
6292
 
6238
6293
  const debug$5 = Debug.get('LeaferCanvas');
6239
6294
  class LeaferCanvas extends LeaferCanvasBase {
@@ -7262,6 +7317,11 @@ function zoomLayerType() {
7262
7317
  });
7263
7318
  };
7264
7319
  }
7320
+ function createAttr(defaultValue) {
7321
+ return (target, key) => {
7322
+ defineKey(target, key, createDescriptor(key, defaultValue));
7323
+ };
7324
+ }
7265
7325
 
7266
7326
  function hasTransparent$3(color) {
7267
7327
  if (!color || color.length === 7 || color.length === 4)
@@ -7319,26 +7379,9 @@ const emptyPaint = {};
7319
7379
  const debug$2 = Debug.get('UIData');
7320
7380
  class UIData extends LeafData {
7321
7381
  get scale() { const { scaleX, scaleY } = this; return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX; }
7322
- get __strokeWidth() {
7323
- const { strokeWidth, strokeWidthFixed } = this;
7324
- if (strokeWidthFixed) {
7325
- const ui = this.__leaf;
7326
- let { scaleX } = ui.__nowWorld || ui.__world;
7327
- if (scaleX < 0)
7328
- scaleX = -scaleX;
7329
- return scaleX > 1 ? strokeWidth / scaleX : strokeWidth;
7330
- }
7331
- else
7332
- return strokeWidth;
7333
- }
7334
- get __hasStroke() { return this.stroke && this.strokeWidth; }
7335
- get __hasHalf() { const t = this; return (t.stroke && t.strokeAlign === 'center' && t.strokeWidth % 2) || undefined; }
7336
- get __hasMultiPaint() {
7337
- const t = this;
7338
- if ((t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect)
7339
- return true;
7340
- return t.fill && this.__hasStroke;
7341
- }
7382
+ get __strokeWidth() { return this.__getRealStrokeWidth(); }
7383
+ get __maxStrokeWidth() { const t = this; return t.__hasMultiStrokeStyle ? Math.max(t.__hasMultiStrokeStyle, t.strokeWidth) : t.strokeWidth; }
7384
+ get __hasMultiPaint() { const t = this; return (t.fill && this.__useStroke) || (t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect; }
7342
7385
  get __clipAfterFill() { const t = this; return (t.cornerRadius || t.innerShadow || t.__pathInputed); }
7343
7386
  get __hasSurface() { const t = this; return (t.fill || t.stroke); }
7344
7387
  get __autoWidth() { return !this._width; }
@@ -7420,6 +7463,21 @@ class UIData extends LeafData {
7420
7463
  Paint.compute('stroke', this.__leaf);
7421
7464
  this.__needComputePaint = undefined;
7422
7465
  }
7466
+ __getRealStrokeWidth(childStyle) {
7467
+ let { strokeWidth, strokeWidthFixed } = this;
7468
+ if (childStyle) {
7469
+ if (childStyle.strokeWidth)
7470
+ strokeWidth = childStyle.strokeWidth;
7471
+ if (childStyle.strokeWidthFixed !== undefined)
7472
+ strokeWidthFixed = childStyle.strokeWidthFixed;
7473
+ }
7474
+ if (strokeWidthFixed) {
7475
+ const scale = this.__leaf.getClampRenderScale();
7476
+ return scale > 1 ? strokeWidth / scale : strokeWidth;
7477
+ }
7478
+ else
7479
+ return strokeWidth;
7480
+ }
7423
7481
  __setPaint(attrName, value) {
7424
7482
  this.__setInput(attrName, value);
7425
7483
  const layout = this.__leaf.__layout;
@@ -7444,6 +7502,7 @@ class UIData extends LeafData {
7444
7502
  }
7445
7503
  else {
7446
7504
  stintSet$2(this, '__isAlphaPixelStroke', undefined);
7505
+ stintSet$2(this, '__hasMultiStrokeStyle', undefined);
7447
7506
  this._stroke = this.__isStrokes = undefined;
7448
7507
  }
7449
7508
  }
@@ -7465,8 +7524,8 @@ class GroupData extends UIData {
7465
7524
 
7466
7525
  class BoxData extends GroupData {
7467
7526
  get __boxStroke() { return !this.__pathInputed; }
7468
- get __drawAfterFill() { const t = this; return (t.overflow === 'hide' && (t.__clipAfterFill || t.innerShadow) && t.__leaf.children.length); }
7469
- get __clipAfterFill() { return this.__leaf.isOverflow || super.__clipAfterFill; }
7527
+ get __drawAfterFill() { const t = this; return t.__single || t.__clipAfterFill; }
7528
+ get __clipAfterFill() { const t = this; return t.overflow === 'hide' && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill); }
7470
7529
  }
7471
7530
 
7472
7531
  class LeaferData extends GroupData {
@@ -7586,7 +7645,7 @@ class CanvasData extends RectData {
7586
7645
  const UIBounds = {
7587
7646
  __updateStrokeSpread() {
7588
7647
  let width = 0, boxWidth = 0;
7589
- const data = this.__, { strokeAlign, strokeWidth } = data, box = this.__box;
7648
+ const data = this.__, { strokeAlign, __maxStrokeWidth: strokeWidth } = data, box = this.__box;
7590
7649
  if ((data.stroke || data.hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
7591
7650
  boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth;
7592
7651
  if (!data.__boxStroke) {
@@ -7606,13 +7665,15 @@ const UIBounds = {
7606
7665
  },
7607
7666
  __updateRenderSpread() {
7608
7667
  let width = 0;
7609
- const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
7668
+ const { shadow, innerShadow, blur, backgroundBlur, filter, renderSpread } = this.__;
7610
7669
  if (shadow)
7611
7670
  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));
7612
7671
  if (blur)
7613
7672
  width = Math.max(width, blur);
7614
7673
  if (filter)
7615
7674
  width += Filter.getSpread(filter);
7675
+ if (renderSpread)
7676
+ width += renderSpread;
7616
7677
  let shapeWidth = width = Math.ceil(width);
7617
7678
  if (innerShadow)
7618
7679
  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));
@@ -7628,15 +7689,18 @@ const { stintSet: stintSet$1 } = DataHelper;
7628
7689
  const UIRender = {
7629
7690
  __updateChange() {
7630
7691
  const data = this.__;
7692
+ if (data.__useStroke) {
7693
+ const useStroke = data.__useStroke = !!(data.stroke && data.strokeWidth);
7694
+ stintSet$1(this.__world, 'half', useStroke && data.strokeAlign === 'center' && data.strokeWidth % 2);
7695
+ stintSet$1(data, '__fillAfterStroke', useStroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
7696
+ }
7631
7697
  if (data.__useEffect) {
7632
7698
  const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
7633
- stintSet$1(data, '__isFastShadow', shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !(shadow[0].box && data.__isTransparentFill) && fill && !(fill instanceof Array && fill.length > 1) && (this.useFastShadow || !stroke || (stroke && data.strokeAlign === 'inside')));
7699
+ 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')));
7634
7700
  data.__useEffect = !!(shadow || otherEffect);
7635
7701
  }
7636
- stintSet$1(this.__world, 'half', data.__hasHalf);
7637
- stintSet$1(data, '__fillAfterStroke', data.stroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
7638
7702
  data.__checkSingle();
7639
- stintSet$1(data, '__complex', data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
7703
+ stintSet$1(data, '__complex', (data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect));
7640
7704
  },
7641
7705
  __drawFast(canvas, options) {
7642
7706
  drawFast(this, canvas, options);
@@ -7694,18 +7758,15 @@ const UIRender = {
7694
7758
  this.__drawFast(canvas, options);
7695
7759
  }
7696
7760
  },
7697
- __renderShape(canvas, options, ignoreFill, ignoreStroke) {
7698
- if (this.__worldOpacity) {
7699
- canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
7700
- const { fill, stroke } = this.__;
7701
- this.__drawRenderPath(canvas);
7702
- if (fill && !ignoreFill)
7703
- this.__.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
7704
- if (this.__.__isCanvas)
7705
- this.__drawAfterFill(canvas, options);
7706
- if (stroke && !ignoreStroke)
7707
- this.__.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
7708
- }
7761
+ __drawShape(canvas, options) {
7762
+ this.__drawRenderPath(canvas);
7763
+ const data = this.__, { fill, stroke } = data;
7764
+ if (fill && !options.ignoreFill)
7765
+ data.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
7766
+ if (data.__isCanvas)
7767
+ this.__drawAfterFill(canvas, options);
7768
+ if (stroke && !options.ignoreStroke)
7769
+ data.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
7709
7770
  },
7710
7771
  __drawAfterFill(canvas, options) {
7711
7772
  if (this.__.__clipAfterFill) {
@@ -7742,17 +7803,17 @@ const RectRender = {
7742
7803
  if (__drawAfterFill)
7743
7804
  this.__drawAfterFill(canvas, options);
7744
7805
  if (stroke) {
7745
- const { strokeAlign, __strokeWidth } = this.__;
7746
- if (!__strokeWidth)
7806
+ const { strokeAlign, __strokeWidth: strokeWidth } = this.__;
7807
+ if (!strokeWidth)
7747
7808
  return;
7748
- canvas.setStroke(stroke, __strokeWidth, this.__);
7749
- const half = __strokeWidth / 2;
7809
+ canvas.setStroke(stroke, strokeWidth, this.__);
7810
+ const half = strokeWidth / 2;
7750
7811
  switch (strokeAlign) {
7751
7812
  case 'center':
7752
7813
  canvas.strokeRect(0, 0, width, height);
7753
7814
  break;
7754
7815
  case 'inside':
7755
- width -= __strokeWidth, height -= __strokeWidth;
7816
+ width -= strokeWidth, height -= strokeWidth;
7756
7817
  if (width < 0 || height < 0) {
7757
7818
  canvas.save();
7758
7819
  this.__clip(canvas, options);
@@ -7763,7 +7824,7 @@ const RectRender = {
7763
7824
  canvas.strokeRect(x + half, y + half, width, height);
7764
7825
  break;
7765
7826
  case 'outside':
7766
- canvas.strokeRect(x - half, y - half, width + __strokeWidth, height + __strokeWidth);
7827
+ canvas.strokeRect(x - half, y - half, width + strokeWidth, height + strokeWidth);
7767
7828
  break;
7768
7829
  }
7769
7830
  }
@@ -7776,6 +7837,8 @@ let UI = UI_1 = class UI extends Leaf {
7776
7837
  get isFrame() { return false; }
7777
7838
  set scale(value) { MathHelper.assignScale(this, value); }
7778
7839
  get scale() { return this.__.scale; }
7840
+ get isAutoWidth() { const t = this.__; return t.__autoWidth || t.autoWidth; }
7841
+ get isAutoHeight() { const t = this.__; return t.__autoHeight || t.autoHeight; }
7779
7842
  get pen() {
7780
7843
  const { path } = this.__;
7781
7844
  pen.set(this.path = path || []);
@@ -7830,12 +7893,14 @@ let UI = UI_1 = class UI extends Leaf {
7830
7893
  }
7831
7894
  }
7832
7895
  __updateRenderPath() {
7833
- if (this.__.path) {
7834
- const data = this.__;
7896
+ const data = this.__;
7897
+ if (data.path) {
7835
7898
  data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
7836
7899
  if (data.__useArrow)
7837
7900
  PathArrow.addArrows(this, !data.cornerRadius);
7838
7901
  }
7902
+ else
7903
+ data.__pathForRender && (data.__pathForRender = undefined);
7839
7904
  }
7840
7905
  __drawRenderPath(canvas) {
7841
7906
  canvas.beginPath();
@@ -7988,6 +8053,9 @@ __decorate([
7988
8053
  __decorate([
7989
8054
  naturalBoundsType(1)
7990
8055
  ], UI.prototype, "pixelRatio", void 0);
8056
+ __decorate([
8057
+ affectRenderBoundsType(0)
8058
+ ], UI.prototype, "renderSpread", void 0);
7991
8059
  __decorate([
7992
8060
  pathInputType()
7993
8061
  ], UI.prototype, "path", void 0);
@@ -8046,13 +8114,13 @@ __decorate([
8046
8114
  surfaceType()
8047
8115
  ], UI.prototype, "fill", void 0);
8048
8116
  __decorate([
8049
- strokeType()
8117
+ strokeType(undefined, true)
8050
8118
  ], UI.prototype, "stroke", void 0);
8051
8119
  __decorate([
8052
8120
  strokeType('inside')
8053
8121
  ], UI.prototype, "strokeAlign", void 0);
8054
8122
  __decorate([
8055
- strokeType(1)
8123
+ strokeType(1, true)
8056
8124
  ], UI.prototype, "strokeWidth", void 0);
8057
8125
  __decorate([
8058
8126
  strokeType(false)
@@ -8144,7 +8212,8 @@ let Group = class Group extends UI {
8144
8212
  }
8145
8213
  toJSON(options) {
8146
8214
  const data = super.toJSON(options);
8147
- data.children = this.children.map(child => child.toJSON(options));
8215
+ if (!this.childlessJSON)
8216
+ data.children = this.children.map(child => child.toJSON(options));
8148
8217
  return data;
8149
8218
  }
8150
8219
  pick(_hitPoint, _options) { return undefined; }
@@ -8479,7 +8548,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8479
8548
  list.push(item);
8480
8549
  this.requestRender();
8481
8550
  }
8482
- zoom(_zoomType, _padding, _fixedScale, _transition) {
8551
+ zoom(_zoomType, _optionsOrPadding, _scroll, _transition) {
8483
8552
  return Plugin.need('view');
8484
8553
  }
8485
8554
  getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
@@ -8524,7 +8593,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8524
8593
  Leafer_1.list.remove(this);
8525
8594
  try {
8526
8595
  this.stop();
8527
- this.emitEvent(new LeaferEvent(LeaferEvent.END, this));
8596
+ this.emitLeafer(LeaferEvent.END);
8528
8597
  this.__removeListenEvents();
8529
8598
  this.__controllers.forEach(item => !(this.parent && item === this.interaction) && item.destroy());
8530
8599
  this.__controllers.length = 0;
@@ -8591,8 +8660,8 @@ let Box = class Box extends Group {
8591
8660
  __updateRenderSpread() { return this.__updateRectRenderSpread() || -1; }
8592
8661
  __updateRectBoxBounds() { }
8593
8662
  __updateBoxBounds(_secondLayout) {
8594
- const data = this.__;
8595
8663
  if (this.children.length && !this.pathInputed) {
8664
+ const data = this.__;
8596
8665
  if (data.__autoSide) {
8597
8666
  if (data.__hasSurface)
8598
8667
  this.__extraUpdate();
@@ -8619,20 +8688,26 @@ let Box = class Box extends Group {
8619
8688
  __updateStrokeBounds() { }
8620
8689
  __updateRenderBounds() {
8621
8690
  let isOverflow;
8622
- const { renderBounds } = this.__layout;
8623
8691
  if (this.children.length) {
8692
+ const data = this.__, { renderBounds, boxBounds } = this.__layout;
8624
8693
  super.__updateRenderBounds();
8625
8694
  copy$3(childrenRenderBounds, renderBounds);
8626
8695
  this.__updateRectRenderBounds();
8627
- isOverflow = !includes$1(renderBounds, childrenRenderBounds);
8628
- if (isOverflow && this.__.overflow !== 'hide')
8696
+ if (data.scrollY || data.scrollX) {
8697
+ childrenRenderBounds.x += data.scrollX;
8698
+ childrenRenderBounds.y += data.scrollY;
8699
+ }
8700
+ isOverflow = !includes$1(boxBounds, childrenRenderBounds);
8701
+ if (isOverflow && data.overflow !== 'hide')
8629
8702
  add(renderBounds, childrenRenderBounds);
8630
8703
  }
8631
8704
  else
8632
8705
  this.__updateRectRenderBounds();
8633
8706
  DataHelper.stintSet(this, 'isOverflow', isOverflow);
8707
+ this.__updateScrollBar();
8634
8708
  }
8635
8709
  __updateRectRenderBounds() { }
8710
+ __updateScrollBar() { }
8636
8711
  __updateRectChange() { }
8637
8712
  __updateChange() {
8638
8713
  super.__updateChange();
@@ -8649,10 +8724,12 @@ let Box = class Box extends Group {
8649
8724
  if (this.children.length)
8650
8725
  this.__renderGroup(canvas, options);
8651
8726
  }
8727
+ if (this.scrollBar)
8728
+ this.scrollBar.__render(canvas, options);
8652
8729
  }
8653
8730
  __drawContent(canvas, options) {
8654
8731
  this.__renderGroup(canvas, options);
8655
- if (this.__.__hasStroke) {
8732
+ if (this.__.__useStroke || this.__.__useEffect) {
8656
8733
  canvas.setWorld(this.__nowWorld);
8657
8734
  this.__drawRenderPath(canvas);
8658
8735
  }
@@ -8872,8 +8949,8 @@ let Polygon = class Polygon extends UI {
8872
8949
  for (let i = 1; i < sides; i++) {
8873
8950
  lineTo$1(path, rx + rx * sin$1((i * 2 * PI$1) / sides), ry - ry * cos$1((i * 2 * PI$1) / sides));
8874
8951
  }
8952
+ closePath$1(path);
8875
8953
  }
8876
- closePath$1(path);
8877
8954
  }
8878
8955
  __updateRenderPath() { }
8879
8956
  __updateBoxBounds() { }
@@ -9111,6 +9188,11 @@ let Text = class Text extends UI {
9111
9188
  return;
9112
9189
  super.__draw(canvas, options, originCanvas);
9113
9190
  }
9191
+ __drawShape(canvas, options) {
9192
+ if (options.shape)
9193
+ this.__box && this.__box.__drawShape(canvas, options);
9194
+ super.__drawShape(canvas, options);
9195
+ }
9114
9196
  destroy() {
9115
9197
  if (this.boxStyle)
9116
9198
  this.boxStyle = null;
@@ -9932,6 +10014,7 @@ const config = {
9932
10014
  delta: { x: 80 / 4, y: 8.0 },
9933
10015
  },
9934
10016
  pointer: {
10017
+ type: 'pointer',
9935
10018
  snap: true,
9936
10019
  hitRadius: 5,
9937
10020
  tapTime: 120,
@@ -10449,18 +10532,20 @@ leaf.__hitWorld = function (point) {
10449
10532
  }
10450
10533
  return this.__hit(inner);
10451
10534
  };
10452
- leaf.__hitFill = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitFill(inner, this.__.windingRule); };
10453
- leaf.__hitStroke = function (inner, strokeWidth) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitStroke(inner, strokeWidth); };
10454
- leaf.__hitPixel = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitPixel(inner, this.__layout.renderBounds, this.__hitCanvas.hitScale); };
10455
- leaf.__drawHitPath = function (canvas) { if (canvas)
10456
- this.__drawRenderPath(canvas); };
10535
+ leaf.__hitFill = function (inner) { const h = this.__hitCanvas; return h && h.hitFill(inner, this.__.windingRule); };
10536
+ leaf.__hitStroke = function (inner, strokeWidth) { const h = this.__hitCanvas; return h && h.hitStroke(inner, strokeWidth); };
10537
+ leaf.__hitPixel = function (inner) { const h = this.__hitCanvas; return h && h.hitPixel(inner, this.__layout.renderBounds, h.hitScale); };
10538
+ leaf.__drawHitPath = function (canvas) { canvas && this.__drawRenderPath(canvas); };
10457
10539
 
10458
10540
  const matrix = new Matrix();
10459
10541
  const ui$1 = UI.prototype;
10460
10542
  ui$1.__updateHitCanvas = function () {
10461
10543
  if (this.__box)
10462
10544
  this.__box.__updateHitCanvas();
10463
- const data = this.__, { hitCanvasManager } = this.leafer || this.parent.leafer;
10545
+ const leafer = this.leafer || (this.parent && this.parent.leafer);
10546
+ if (!leafer)
10547
+ return;
10548
+ const data = this.__, { hitCanvasManager } = leafer;
10464
10549
  const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === 'pixel';
10465
10550
  const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === 'pixel';
10466
10551
  const isHitPixel = isHitPixelFill || isHitPixelStroke;
@@ -10475,7 +10560,7 @@ ui$1.__updateHitCanvas = function () {
10475
10560
  h.resize({ width, height, pixelRatio: 1 });
10476
10561
  h.clear();
10477
10562
  ImageManager.patternLocked = true;
10478
- this.__renderShape(h, { matrix: matrix.setWith(this.__world).scaleWith(1 / scale).invertWith().translate(-x, -y) }, !isHitPixelFill, !isHitPixelStroke);
10563
+ this.__renderShape(h, { matrix: matrix.setWith(this.__world).scaleWith(1 / scale).invertWith().translate(-x, -y), ignoreFill: !isHitPixelFill, ignoreStroke: !isHitPixelStroke });
10479
10564
  ImageManager.patternLocked = false;
10480
10565
  h.resetTransform();
10481
10566
  data.__isHitPixel = true;
@@ -10496,7 +10581,7 @@ ui$1.__hit = function (inner) {
10496
10581
  const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.__isAlphaPixelFill || data.__isCanvas)))) || hitFill === 'all';
10497
10582
  if (needHitFillPath && this.__hitFill(inner))
10498
10583
  return true;
10499
- const { hitStroke, __strokeWidth } = data;
10584
+ const { hitStroke, __maxStrokeWidth: strokeWidth } = data;
10500
10585
  const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.__isAlphaPixelStroke))) || hitStroke === 'all';
10501
10586
  if (!needHitFillPath && !needHitStrokePath)
10502
10587
  return false;
@@ -10505,16 +10590,16 @@ ui$1.__hit = function (inner) {
10505
10590
  if (needHitStrokePath) {
10506
10591
  switch (data.strokeAlign) {
10507
10592
  case 'inside':
10508
- hitWidth += __strokeWidth * 2;
10593
+ hitWidth += strokeWidth * 2;
10509
10594
  if (!needHitFillPath && this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
10510
10595
  return true;
10511
10596
  hitWidth = radiusWidth;
10512
10597
  break;
10513
10598
  case 'center':
10514
- hitWidth += __strokeWidth;
10599
+ hitWidth += strokeWidth;
10515
10600
  break;
10516
10601
  case 'outside':
10517
- hitWidth += __strokeWidth * 2;
10602
+ hitWidth += strokeWidth * 2;
10518
10603
  if (!needHitFillPath) {
10519
10604
  if (!this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
10520
10605
  return true;
@@ -10612,6 +10697,9 @@ const KeyEventHelper = {
10612
10697
 
10613
10698
  const { pathCanDrag } = InteractionHelper;
10614
10699
  class Interaction extends InteractionBase {
10700
+ get notPointer() { const { p } = this; return p.type !== 'pointer' || p.touch || this.useMultiTouch; }
10701
+ get notTouch() { const { p } = this; return p.type === 'mouse' || this.usePointer; }
10702
+ get notMouse() { return this.usePointer || this.useTouch; }
10615
10703
  __listenEvents() {
10616
10704
  super.__listenEvents();
10617
10705
  const view = this.view = this.canvas.view;
@@ -10697,13 +10785,13 @@ class Interaction extends InteractionBase {
10697
10785
  }
10698
10786
  onPointerDown(e) {
10699
10787
  this.preventDefaultPointer(e);
10700
- if (this.config.pointer.touch || this.useMultiTouch)
10788
+ if (this.notPointer)
10701
10789
  return;
10702
10790
  this.usePointer || (this.usePointer = true);
10703
10791
  this.pointerDown(PointerEventHelper.convert(e, this.getLocal(e)));
10704
10792
  }
10705
10793
  onPointerMove(e, isLeave) {
10706
- if (this.config.pointer.touch || this.useMultiTouch || this.preventWindowPointer(e))
10794
+ if (this.notPointer || this.preventWindowPointer(e))
10707
10795
  return;
10708
10796
  this.usePointer || (this.usePointer = true);
10709
10797
  const data = PointerEventHelper.convert(e, this.getLocal(e, true));
@@ -10715,7 +10803,7 @@ class Interaction extends InteractionBase {
10715
10803
  onPointerUp(e) {
10716
10804
  if (this.downData)
10717
10805
  this.preventDefaultPointer(e);
10718
- if (this.config.pointer.touch || this.useMultiTouch || this.preventWindowPointer(e))
10806
+ if (this.notPointer || this.preventWindowPointer(e))
10719
10807
  return;
10720
10808
  this.pointerUp(PointerEventHelper.convert(e, this.getLocal(e)));
10721
10809
  }
@@ -10726,24 +10814,24 @@ class Interaction extends InteractionBase {
10726
10814
  }
10727
10815
  onMouseDown(e) {
10728
10816
  this.preventDefaultPointer(e);
10729
- if (this.useTouch || this.usePointer)
10817
+ if (this.notMouse)
10730
10818
  return;
10731
10819
  this.pointerDown(PointerEventHelper.convertMouse(e, this.getLocal(e)));
10732
10820
  }
10733
10821
  onMouseMove(e) {
10734
- if (this.useTouch || this.usePointer || this.preventWindowPointer(e))
10822
+ if (this.notMouse || this.preventWindowPointer(e))
10735
10823
  return;
10736
10824
  this.pointerMove(PointerEventHelper.convertMouse(e, this.getLocal(e, true)));
10737
10825
  }
10738
10826
  onMouseUp(e) {
10739
10827
  if (this.downData)
10740
10828
  this.preventDefaultPointer(e);
10741
- if (this.useTouch || this.usePointer || this.preventWindowPointer(e))
10829
+ if (this.notMouse || this.preventWindowPointer(e))
10742
10830
  return;
10743
10831
  this.pointerUp(PointerEventHelper.convertMouse(e, this.getLocal(e)));
10744
10832
  }
10745
10833
  onMouseCancel() {
10746
- if (this.useTouch || this.usePointer)
10834
+ if (this.notMouse)
10747
10835
  return;
10748
10836
  this.pointerCancel();
10749
10837
  }
@@ -10754,7 +10842,7 @@ class Interaction extends InteractionBase {
10754
10842
  if (preventDefault === true || (preventDefault === 'auto' && pathCanDrag(this.findPath(local))))
10755
10843
  e.preventDefault();
10756
10844
  this.multiTouchStart(e);
10757
- if (this.usePointer)
10845
+ if (this.notTouch)
10758
10846
  return;
10759
10847
  if (this.touchTimer) {
10760
10848
  window.clearTimeout(this.touchTimer);
@@ -10765,14 +10853,14 @@ class Interaction extends InteractionBase {
10765
10853
  }
10766
10854
  onTouchMove(e) {
10767
10855
  this.multiTouchMove(e);
10768
- if (this.usePointer || this.preventWindowPointer(e))
10856
+ if (this.notTouch || this.preventWindowPointer(e))
10769
10857
  return;
10770
10858
  const touch = PointerEventHelper.getTouch(e);
10771
10859
  this.pointerMove(PointerEventHelper.convertTouch(e, this.getLocal(touch)));
10772
10860
  }
10773
10861
  onTouchEnd(e) {
10774
10862
  this.multiTouchEnd();
10775
- if (this.usePointer || this.preventWindowPointer(e))
10863
+ if (this.notTouch || this.preventWindowPointer(e))
10776
10864
  return;
10777
10865
  if (this.touchTimer)
10778
10866
  clearTimeout(this.touchTimer);
@@ -10783,7 +10871,7 @@ class Interaction extends InteractionBase {
10783
10871
  this.pointerUp(PointerEventHelper.convertTouch(e, this.getLocal(touch)));
10784
10872
  }
10785
10873
  onTouchCancel() {
10786
- if (this.usePointer)
10874
+ if (this.notTouch)
10787
10875
  return;
10788
10876
  this.pointerCancel();
10789
10877
  }
@@ -10923,9 +11011,14 @@ function fills(fills, ui, canvas) {
10923
11011
  }
10924
11012
  }
10925
11013
  canvas.fillStyle = item.style;
10926
- if (item.transform) {
11014
+ if (item.transform || item.scaleFixed) {
10927
11015
  canvas.save();
10928
- canvas.transform(item.transform);
11016
+ if (item.transform)
11017
+ canvas.transform(item.transform);
11018
+ if (item.scaleFixed) {
11019
+ const { scaleX, scaleY } = ui.getRenderScaleData(true);
11020
+ canvas.scale(1 / scaleX, 1 / scaleY);
11021
+ }
10929
11022
  if (item.blendMode)
10930
11023
  canvas.blendMode = item.blendMode;
10931
11024
  fillPathOrText(ui, canvas);
@@ -10961,8 +11054,13 @@ function strokeText(stroke, ui, canvas) {
10961
11054
  }
10962
11055
  function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
10963
11056
  const data = ui.__;
10964
- canvas.setStroke(!data.__isStrokes && stroke, data.strokeWidth * strokeWidthScale, data);
10965
- data.__isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
11057
+ if (typeof stroke === 'object') {
11058
+ drawStrokesStyle(stroke, strokeWidthScale, true, ui, canvas);
11059
+ }
11060
+ else {
11061
+ canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
11062
+ drawTextStroke(ui, canvas);
11063
+ }
10966
11064
  }
10967
11065
  function drawAlign(stroke, align, ui, canvas) {
10968
11066
  const out = canvas.getSameCanvas(true, true);
@@ -10971,15 +11069,9 @@ function drawAlign(stroke, align, ui, canvas) {
10971
11069
  out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
10972
11070
  fillText(ui, out);
10973
11071
  out.blendMode = 'normal';
10974
- copyWorld(canvas, out, ui);
11072
+ LeafHelper.copyCanvasByWorld(ui, canvas, out);
10975
11073
  out.recycle(ui.__nowWorld);
10976
11074
  }
10977
- function copyWorld(canvas, out, ui) {
10978
- if (ui.__worldFlipped || Platform.fullImageShadow)
10979
- canvas.copyWorldByReset(out, ui.__nowWorld);
10980
- else
10981
- canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
10982
- }
10983
11075
  function drawTextStroke(ui, canvas) {
10984
11076
  let row, data = ui.__.__textDrawData;
10985
11077
  const { rows, decorationY } = data;
@@ -10995,14 +11087,21 @@ function drawTextStroke(ui, canvas) {
10995
11087
  rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
10996
11088
  }
10997
11089
  }
10998
- function drawStrokesStyle(strokes, isText, ui, canvas) {
11090
+ function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas) {
10999
11091
  let item;
11092
+ const data = ui.__, { __hasMultiStrokeStyle } = data;
11093
+ __hasMultiStrokeStyle || canvas.setStroke(undefined, data.__strokeWidth * strokeWidthScale, data);
11000
11094
  for (let i = 0, len = strokes.length; i < len; i++) {
11001
11095
  item = strokes[i];
11002
11096
  if (item.image && PaintImage.checkImage(ui, canvas, item, false))
11003
11097
  continue;
11004
11098
  if (item.style) {
11005
- canvas.strokeStyle = item.style;
11099
+ if (__hasMultiStrokeStyle) {
11100
+ const { strokeStyle } = item;
11101
+ strokeStyle ? canvas.setStroke(item.style, data.__getRealStrokeWidth(strokeStyle) * strokeWidthScale, data, strokeStyle) : canvas.setStroke(item.style, data.__strokeWidth * strokeWidthScale, data);
11102
+ }
11103
+ else
11104
+ canvas.strokeStyle = item.style;
11006
11105
  if (item.blendMode) {
11007
11106
  canvas.saveBlendMode(item.blendMode);
11008
11107
  isText ? drawTextStroke(ui, canvas) : canvas.stroke();
@@ -11041,8 +11140,13 @@ function strokes(strokes, ui, canvas) {
11041
11140
  }
11042
11141
  function drawCenter(stroke, strokeWidthScale, ui, canvas) {
11043
11142
  const data = ui.__;
11044
- canvas.setStroke(!data.__isStrokes && stroke, data.__strokeWidth * strokeWidthScale, data);
11045
- data.__isStrokes ? drawStrokesStyle(stroke, false, ui, canvas) : canvas.stroke();
11143
+ if (typeof stroke === 'object') {
11144
+ drawStrokesStyle(stroke, strokeWidthScale, false, ui, canvas);
11145
+ }
11146
+ else {
11147
+ canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
11148
+ canvas.stroke();
11149
+ }
11046
11150
  if (data.__useArrow)
11047
11151
  Paint.strokeArrow(stroke, ui, canvas);
11048
11152
  }
@@ -11064,7 +11168,7 @@ function drawOutside(stroke, ui, canvas) {
11064
11168
  drawCenter(stroke, 2, ui, out);
11065
11169
  out.clipUI(data);
11066
11170
  out.clearWorld(renderBounds);
11067
- copyWorld(canvas, out, ui);
11171
+ LeafHelper.copyCanvasByWorld(ui, canvas, out);
11068
11172
  out.recycle(ui.__nowWorld);
11069
11173
  }
11070
11174
  }
@@ -11119,8 +11223,16 @@ function compute(attrName, ui) {
11119
11223
  if (!(paints instanceof Array))
11120
11224
  paints = [paints];
11121
11225
  recycleMap = PaintImage.recycleImage(attrName, data);
11226
+ let maxChildStrokeWidth;
11122
11227
  for (let i = 0, len = paints.length, item; i < len; i++) {
11123
- (item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item);
11228
+ if (item = getLeafPaint(attrName, paints[i], ui)) {
11229
+ leafPaints.push(item);
11230
+ if (item.strokeStyle) {
11231
+ maxChildStrokeWidth || (maxChildStrokeWidth = 1);
11232
+ if (item.strokeStyle.strokeWidth)
11233
+ maxChildStrokeWidth = Math.max(maxChildStrokeWidth, item.strokeStyle.strokeWidth);
11234
+ }
11235
+ }
11124
11236
  }
11125
11237
  data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
11126
11238
  if (leafPaints.length) {
@@ -11137,6 +11249,7 @@ function compute(attrName, ui) {
11137
11249
  else {
11138
11250
  stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
11139
11251
  stintSet(data, '__isTransparentStroke', isTransparent);
11252
+ stintSet(data, '__hasMultiStrokeStyle', maxChildStrokeWidth);
11140
11253
  }
11141
11254
  }
11142
11255
  function getLeafPaint(attrName, paint, ui) {
@@ -11168,6 +11281,11 @@ function getLeafPaint(attrName, paint, ui) {
11168
11281
  if (data) {
11169
11282
  if (typeof data.style === 'string' && hasTransparent$1(data.style))
11170
11283
  data.isTransparent = true;
11284
+ if (paint.style) {
11285
+ if (paint.style.strokeWidth === 0)
11286
+ return undefined;
11287
+ data.strokeStyle = paint.style;
11288
+ }
11171
11289
  if (paint.blendMode)
11172
11290
  data.blendMode = paint.blendMode;
11173
11291
  }
@@ -11187,8 +11305,8 @@ const PaintModule = {
11187
11305
  shape
11188
11306
  };
11189
11307
 
11190
- let origin = {};
11191
- const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, scale: scaleHelper, rotate } = MatrixHelper;
11308
+ let origin = {}, tempMatrix = getMatrixData();
11309
+ const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent, scale: scaleHelper, rotate, skew: skewHelper } = MatrixHelper;
11192
11310
  function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
11193
11311
  const transform = get$3();
11194
11312
  translate$1(transform, box.x + x, box.y + y);
@@ -11197,13 +11315,19 @@ function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
11197
11315
  rotateOfOuter$1(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
11198
11316
  data.transform = transform;
11199
11317
  }
11200
- function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
11318
+ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipSize) {
11201
11319
  const transform = get$3();
11202
- translate$1(transform, box.x + x, box.y + y);
11203
- if (scaleX)
11204
- scaleHelper(transform, scaleX, scaleY);
11205
11320
  if (rotation)
11206
11321
  rotate(transform, rotation);
11322
+ if (skew)
11323
+ skewHelper(transform, skew.x, skew.y);
11324
+ if (scaleX)
11325
+ scaleHelper(transform, scaleX, scaleY);
11326
+ translate$1(transform, box.x + x, box.y + y);
11327
+ if (clipSize) {
11328
+ tempMatrix.a = box.width / clipSize.width, tempMatrix.d = box.height / clipSize.height;
11329
+ multiplyParent(transform, tempMatrix);
11330
+ }
11207
11331
  data.transform = transform;
11208
11332
  }
11209
11333
  function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
@@ -11240,11 +11364,15 @@ const tempBox = new Bounds();
11240
11364
  const tempScaleData = {};
11241
11365
  const tempImage = {};
11242
11366
  function createData(leafPaint, image, paint, box) {
11243
- const { changeful, sync } = paint;
11367
+ const { changeful, sync, editing, scaleFixed } = paint;
11244
11368
  if (changeful)
11245
11369
  leafPaint.changeful = changeful;
11246
11370
  if (sync)
11247
11371
  leafPaint.sync = sync;
11372
+ if (editing)
11373
+ leafPaint.editing = editing;
11374
+ if (scaleFixed)
11375
+ leafPaint.scaleFixed = scaleFixed;
11248
11376
  leafPaint.data = getPatternData(paint, box, image);
11249
11377
  }
11250
11378
  function getPatternData(paint, box, image) {
@@ -11253,7 +11381,7 @@ function getPatternData(paint, box, image) {
11253
11381
  if (paint.mode === 'strench')
11254
11382
  paint.mode = 'stretch';
11255
11383
  let { width, height } = image;
11256
- const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
11384
+ const { opacity, mode, align, offset, scale, size, rotation, skew, clipSize, repeat, filters } = paint;
11257
11385
  const sameBox = box.width === width && box.height === height;
11258
11386
  const data = { mode };
11259
11387
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
@@ -11287,8 +11415,8 @@ function getPatternData(paint, box, image) {
11287
11415
  break;
11288
11416
  case 'normal':
11289
11417
  case 'clip':
11290
- if (tempImage.x || tempImage.y || scaleX || rotation)
11291
- clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
11418
+ if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
11419
+ clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, paint.clipSize);
11292
11420
  break;
11293
11421
  case 'repeat':
11294
11422
  if (!sameBox || scaleX || rotation)
@@ -11365,11 +11493,11 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
11365
11493
  }
11366
11494
  onLoadSuccess(ui, event);
11367
11495
  }
11368
- leafPaint.loadId = null;
11496
+ leafPaint.loadId = undefined;
11369
11497
  }, (error) => {
11370
11498
  ignoreRender(ui, false);
11371
11499
  onLoadError(ui, event, error);
11372
- leafPaint.loadId = null;
11500
+ leafPaint.loadId = undefined;
11373
11501
  });
11374
11502
  if (ui.placeholderColor) {
11375
11503
  if (!ui.placeholderDelay)
@@ -11425,16 +11553,16 @@ function ignoreRender(ui, value) {
11425
11553
  }
11426
11554
 
11427
11555
  const { get: get$1, scale, copy: copy$1 } = MatrixHelper;
11428
- const { ceil, abs: abs$1 } = Math;
11556
+ const { ceil, abs } = Math;
11429
11557
  function createPattern(ui, paint, pixelRatio) {
11430
- let { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
11558
+ let { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
11431
11559
  const id = scaleX + '-' + scaleY + '-' + pixelRatio;
11432
11560
  if (paint.patternId !== id && !ui.destroyed) {
11433
- scaleX = abs$1(scaleX);
11434
- scaleY = abs$1(scaleY);
11435
11561
  const { image, data } = paint;
11436
11562
  let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
11437
11563
  if (sx) {
11564
+ sx = abs(sx);
11565
+ sy = abs(sy);
11438
11566
  imageMatrix = get$1();
11439
11567
  copy$1(imageMatrix, transform);
11440
11568
  scale(imageMatrix, 1 / sx, 1 / sy);
@@ -11487,9 +11615,8 @@ function createPattern(ui, paint, pixelRatio) {
11487
11615
  }
11488
11616
  }
11489
11617
 
11490
- const { abs } = Math;
11491
11618
  function checkImage(ui, canvas, paint, allowDraw) {
11492
- const { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
11619
+ const { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
11493
11620
  const { pixelRatio } = canvas, { data } = paint;
11494
11621
  if (!data || (paint.patternId === scaleX + '-' + scaleY + '-' + pixelRatio && !Export.running)) {
11495
11622
  return false;
@@ -11502,8 +11629,8 @@ function checkImage(ui, canvas, paint, allowDraw) {
11502
11629
  else {
11503
11630
  if (!(paint.changeful || ResizeEvent.isResizing(ui) || Export.running)) {
11504
11631
  let { width, height } = data;
11505
- width *= abs(scaleX) * pixelRatio;
11506
- height *= abs(scaleY) * pixelRatio;
11632
+ width *= scaleX * pixelRatio;
11633
+ height *= scaleY * pixelRatio;
11507
11634
  if (data.scaleX) {
11508
11635
  width *= data.scaleX;
11509
11636
  height *= data.scaleY;
@@ -11513,6 +11640,10 @@ function checkImage(ui, canvas, paint, allowDraw) {
11513
11640
  }
11514
11641
  }
11515
11642
  if (allowDraw) {
11643
+ if (ui.__.__isFastShadow) {
11644
+ canvas.fillStyle = paint.style || '#000';
11645
+ canvas.fill();
11646
+ }
11516
11647
  drawImage(ui, canvas, paint, data);
11517
11648
  return true;
11518
11649
  }
@@ -11701,10 +11832,7 @@ function shadow(ui, current, shape) {
11701
11832
  }
11702
11833
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
11703
11834
  }
11704
- if (ui.__worldFlipped)
11705
- current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
11706
- else
11707
- current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
11835
+ LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
11708
11836
  if (end && index < end)
11709
11837
  other.clearWorld(copyBounds, true);
11710
11838
  });
@@ -11763,10 +11891,7 @@ function innerShadow(ui, current, shape) {
11763
11891
  copyBounds = bounds;
11764
11892
  }
11765
11893
  other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
11766
- if (ui.__worldFlipped)
11767
- current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
11768
- else
11769
- current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
11894
+ LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
11770
11895
  if (end && index < end)
11771
11896
  other.clearWorld(copyBounds, true);
11772
11897
  });
@@ -11822,12 +11947,11 @@ Group.prototype.__renderMask = function (canvas, options) {
11822
11947
  contentCanvas = getCanvas(canvas);
11823
11948
  child.__render(maskCanvas, options);
11824
11949
  }
11825
- if (!(mask === 'clipping' || mask === 'clipping-path'))
11826
- continue;
11827
- }
11828
- if (excludeRenderBounds(child, options))
11950
+ if (mask === 'clipping' || mask === 'clipping-path')
11951
+ excludeRenderBounds(child, options) || child.__render(canvas, options);
11829
11952
  continue;
11830
- child.__render(contentCanvas || canvas, options);
11953
+ }
11954
+ excludeRenderBounds(child, options) || child.__render(contentCanvas || canvas, options);
11831
11955
  }
11832
11956
  maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
11833
11957
  };
@@ -12414,4 +12538,4 @@ Object.assign(Creator, {
12414
12538
  });
12415
12539
  useCanvas();
12416
12540
 
12417
- export { AlignHelper, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent$1 as DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, 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, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent$1 as PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, 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 };
12541
+ export { AlignHelper, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent$1 as DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, 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, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent$1 as PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, 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 };