leafer-ui 1.7.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/web.js CHANGED
@@ -439,7 +439,7 @@ var LeaferUI = (function (exports) {
439
439
  const M$6 = MatrixHelper;
440
440
 
441
441
  const { toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3 } = MatrixHelper;
442
- const { sin: sin$4, cos: cos$4, abs: abs$4, sqrt: sqrt$2, atan2: atan2$2, min: min$1, round: round$2 } = Math;
442
+ const { sin: sin$4, cos: cos$4, abs: abs$3, sqrt: sqrt$2, atan2: atan2$2, min: min$1, round: round$2 } = Math;
443
443
  const PointHelper = {
444
444
  defaultPoint: getPointData(),
445
445
  tempPoint: {},
@@ -534,8 +534,8 @@ var LeaferUI = (function (exports) {
534
534
  return getDistanceFrom(t.x, t.y, point.x, point.y);
535
535
  },
536
536
  getDistanceFrom(x1, y1, x2, y2) {
537
- const x = abs$4(x2 - x1);
538
- const y = abs$4(y2 - y1);
537
+ const x = abs$3(x2 - x1);
538
+ const y = abs$3(y2 - y1);
539
539
  return sqrt$2(x * x + y * y);
540
540
  },
541
541
  getMinDistanceFrom(x1, y1, x2, y2, x3, y3) {
@@ -766,7 +766,7 @@ var LeaferUI = (function (exports) {
766
766
  MatrixHelper.reset(this);
767
767
  }
768
768
  }
769
- const tempMatrix = new Matrix();
769
+ const tempMatrix$1 = new Matrix();
770
770
 
771
771
  const TwoPointBoundsHelper = {
772
772
  tempPointBounds: {},
@@ -863,6 +863,12 @@ var LeaferUI = (function (exports) {
863
863
  }
864
864
  if (!onlyBoxSize)
865
865
  to.x += box.x, to.y += box.y;
866
+ },
867
+ getPoint(around, box, to) {
868
+ if (!to)
869
+ to = {};
870
+ AroundHelper.toPoint(around, box, to, true);
871
+ return to;
866
872
  }
867
873
  };
868
874
  function get$4(around) {
@@ -1791,10 +1797,13 @@ var LeaferUI = (function (exports) {
1791
1797
  return (target, key) => {
1792
1798
  if (!realName)
1793
1799
  realName = key;
1794
- Object.defineProperty(target, key, {
1800
+ const property = {
1795
1801
  get() { return this.context[realName]; },
1796
1802
  set(value) { this.context[realName] = value; }
1797
- });
1803
+ };
1804
+ if (key === 'strokeCap')
1805
+ property.set = function (value) { this.context[realName] = value === 'none' ? 'butt' : value; };
1806
+ Object.defineProperty(target, key, property);
1798
1807
  };
1799
1808
  }
1800
1809
  const contextMethodNameList = [];
@@ -2070,15 +2079,15 @@ var LeaferUI = (function (exports) {
2070
2079
  contextMethod()
2071
2080
  ], Canvas.prototype, "strokeText", null);
2072
2081
 
2073
- const { copy: copy$9, multiplyParent: multiplyParent$3 } = MatrixHelper, { round: round$1 } = Math;
2082
+ const { copy: copy$9, multiplyParent: multiplyParent$4 } = MatrixHelper, { round: round$1 } = Math;
2074
2083
  const minSize = { width: 1, height: 1, pixelRatio: 1 };
2075
2084
  const canvasSizeAttrs = ['width', 'height', 'pixelRatio'];
2076
2085
  class LeaferCanvasBase extends Canvas {
2077
2086
  get width() { return this.size.width; }
2078
2087
  get height() { return this.size.height; }
2079
2088
  get pixelRatio() { return this.size.pixelRatio; }
2080
- get pixelWidth() { return this.width * this.pixelRatio; }
2081
- get pixelHeight() { return this.height * this.pixelRatio; }
2089
+ get pixelWidth() { return this.width * this.pixelRatio || 0; }
2090
+ get pixelHeight() { return this.height * this.pixelRatio || 0; }
2082
2091
  get pixelSnap() { return this.config.pixelSnap; }
2083
2092
  set pixelSnap(value) { this.config.pixelSnap = value; }
2084
2093
  get allowBackgroundColor() { return this.view && this.parentView; }
@@ -2143,7 +2152,7 @@ var LeaferUI = (function (exports) {
2143
2152
  setWorld(matrix, parentMatrix) {
2144
2153
  const { pixelRatio, pixelSnap } = this, w = this.worldTransform;
2145
2154
  if (parentMatrix)
2146
- multiplyParent$3(matrix, parentMatrix, w);
2155
+ multiplyParent$4(matrix, parentMatrix, w);
2147
2156
  w.a = matrix.a * pixelRatio;
2148
2157
  w.b = matrix.b * pixelRatio;
2149
2158
  w.c = matrix.c * pixelRatio;
@@ -2165,20 +2174,33 @@ var LeaferUI = (function (exports) {
2165
2174
  if (w)
2166
2175
  this.setTransform(w.a, w.b, w.c, w.d, w.e, w.f);
2167
2176
  }
2168
- setStroke(color, strokeWidth, options) {
2177
+ setStroke(color, strokeWidth, options, childOptions) {
2169
2178
  if (strokeWidth)
2170
2179
  this.strokeWidth = strokeWidth;
2171
2180
  if (color)
2172
2181
  this.strokeStyle = color;
2173
2182
  if (options)
2174
- this.setStrokeOptions(options);
2175
- }
2176
- setStrokeOptions(options) {
2177
- this.strokeCap = options.strokeCap === 'none' ? 'butt' : options.strokeCap;
2178
- this.strokeJoin = options.strokeJoin;
2179
- this.dashPattern = options.dashPattern;
2180
- this.dashOffset = options.dashOffset;
2181
- this.miterLimit = options.miterLimit;
2183
+ this.setStrokeOptions(options, childOptions);
2184
+ }
2185
+ setStrokeOptions(options, childOptions) {
2186
+ let { strokeCap, strokeJoin, dashPattern, dashOffset, miterLimit } = options;
2187
+ if (childOptions) {
2188
+ if (childOptions.strokeCap)
2189
+ strokeCap = childOptions.strokeCap;
2190
+ if (childOptions.strokeJoin)
2191
+ strokeJoin = childOptions.strokeJoin;
2192
+ if (childOptions.dashPattern !== undefined)
2193
+ dashPattern = childOptions.dashPattern;
2194
+ if (childOptions.dashOffset !== undefined)
2195
+ dashOffset = childOptions.dashOffset;
2196
+ if (childOptions.miterLimit)
2197
+ miterLimit = childOptions.miterLimit;
2198
+ }
2199
+ this.strokeCap = strokeCap;
2200
+ this.strokeJoin = strokeJoin;
2201
+ this.dashPattern = dashPattern;
2202
+ this.dashOffset = dashOffset;
2203
+ this.miterLimit = miterLimit;
2182
2204
  }
2183
2205
  saveBlendMode(blendMode) {
2184
2206
  this.savedBlendMode = this.blendMode;
@@ -2412,7 +2434,7 @@ var LeaferUI = (function (exports) {
2412
2434
  }
2413
2435
  };
2414
2436
 
2415
- const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$3, PI: PI$2, sqrt: sqrt$1, pow } = Math;
2437
+ const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$2, PI: PI$2, sqrt: sqrt$1, pow } = Math;
2416
2438
  const { setPoint: setPoint$1, addPoint: addPoint$1 } = TwoPointBoundsHelper;
2417
2439
  const { set, toNumberPoints } = PointHelper;
2418
2440
  const { M: M$5, L: L$6, C: C$4, Q: Q$4, Z: Z$5 } = PathCommandMap;
@@ -2487,7 +2509,7 @@ var LeaferUI = (function (exports) {
2487
2509
  let totalRadian = endRadian - startRadian;
2488
2510
  if (totalRadian < 0)
2489
2511
  totalRadian += PI2;
2490
- if (totalRadian === PI$2 || (abs$3(BAx + BAy) < 1.e-12) || (abs$3(CBx + CBy) < 1.e-12)) {
2512
+ if (totalRadian === PI$2 || (abs$2(BAx + BAy) < 1.e-12) || (abs$2(CBx + CBy) < 1.e-12)) {
2491
2513
  if (data)
2492
2514
  data.push(L$6, x1, y1);
2493
2515
  if (setPointBounds) {
@@ -2529,7 +2551,7 @@ var LeaferUI = (function (exports) {
2529
2551
  totalRadian -= PI2;
2530
2552
  if (anticlockwise)
2531
2553
  totalRadian -= PI2;
2532
- const parts = ceil$1(abs$3(totalRadian / PI_2));
2554
+ const parts = ceil$1(abs$2(totalRadian / PI_2));
2533
2555
  const partRadian = totalRadian / parts;
2534
2556
  const partRadian4Sin = sin$3(partRadian / 4);
2535
2557
  const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$3(partRadian / 2);
@@ -2974,7 +2996,7 @@ var LeaferUI = (function (exports) {
2974
2996
 
2975
2997
  const { M: M$3, L: L$4, C: C$2, Q: Q$2, Z: Z$3, N: N$2, D: D$2, X: X$2, G: G$2, F: F$3, O: O$2, P: P$2, U: U$2 } = PathCommandMap;
2976
2998
  const { getMinDistanceFrom, getRadianFrom } = PointHelper;
2977
- const { tan, min, abs: abs$2 } = Math;
2999
+ const { tan, min, abs: abs$1 } = Math;
2978
3000
  const startPoint = {};
2979
3001
  const PathCommandDataHelper = {
2980
3002
  beginPath(data) {
@@ -3037,7 +3059,7 @@ var LeaferUI = (function (exports) {
3037
3059
  arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
3038
3060
  if (lastX !== undefined) {
3039
3061
  const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
3040
- radius = min(radius, min(d / 2, d / 2 * abs$2(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3062
+ radius = min(radius, min(d / 2, d / 2 * abs$1(tan(getRadianFrom(lastX, lastY, x1, y1, x2, y2) / 2))));
3041
3063
  }
3042
3064
  data.push(U$2, x1, y1, x2, y2, radius);
3043
3065
  },
@@ -3913,6 +3935,13 @@ var LeaferUI = (function (exports) {
3913
3935
  function getDescriptor(object, name) {
3914
3936
  return Object.getOwnPropertyDescriptor(object, name);
3915
3937
  }
3938
+ function createDescriptor(key, defaultValue) {
3939
+ const privateKey = '_' + key;
3940
+ return {
3941
+ get() { const v = this[privateKey]; return v === undefined ? defaultValue : v; },
3942
+ set(value) { this[privateKey] = value; }
3943
+ };
3944
+ }
3916
3945
  function getNames(object) {
3917
3946
  return Object.getOwnPropertyNames(object);
3918
3947
  }
@@ -4145,15 +4174,7 @@ var LeaferUI = (function (exports) {
4145
4174
  const data = target.__DataProcessor.prototype;
4146
4175
  const computedKey = '_' + key;
4147
4176
  const setMethodName = getSetMethodName(key);
4148
- const property = {
4149
- get() {
4150
- const v = this[computedKey];
4151
- return v === undefined ? defaultValue : v;
4152
- },
4153
- set(value) {
4154
- this[computedKey] = value;
4155
- }
4156
- };
4177
+ const property = createDescriptor(key, defaultValue);
4157
4178
  if (defaultValue === undefined) {
4158
4179
  property.get = function () { return this[computedKey]; };
4159
4180
  }
@@ -4268,7 +4289,7 @@ var LeaferUI = (function (exports) {
4268
4289
  };
4269
4290
  }
4270
4291
 
4271
- const { copy: copy$7, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
4292
+ const { copy: copy$7, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$3, divideParent, getLayout } = MatrixHelper;
4272
4293
  const matrix$1 = {}, { round } = Math;
4273
4294
  const LeafHelper = {
4274
4295
  updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
@@ -4340,6 +4361,14 @@ var LeaferUI = (function (exports) {
4340
4361
  }
4341
4362
  return true;
4342
4363
  },
4364
+ copyCanvasByWorld(leaf, currentCanvas, fromCanvas, fromWorld, blendMode, onlyResetTransform) {
4365
+ if (!fromWorld)
4366
+ fromWorld = leaf.__nowWorld;
4367
+ if (leaf.__worldFlipped || Platform.fullImageShadow)
4368
+ currentCanvas.copyWorldByReset(fromCanvas, fromWorld, leaf.__nowWorld, blendMode, onlyResetTransform);
4369
+ else
4370
+ currentCanvas.copyWorldToInner(fromCanvas, fromWorld, leaf.__layout.renderBounds, blendMode);
4371
+ },
4343
4372
  moveWorld(t, x, y = 0, isInnerPoint, transition) {
4344
4373
  const local = typeof x === 'object' ? Object.assign({}, x) : { x, y };
4345
4374
  isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : (t.parent && toInnerPoint$1(t.parent.worldTransform, local, local, true));
@@ -4399,14 +4428,14 @@ var LeaferUI = (function (exports) {
4399
4428
  },
4400
4429
  transformWorld(t, transform, resize, transition) {
4401
4430
  copy$7(matrix$1, t.worldTransform);
4402
- multiplyParent$2(matrix$1, transform);
4431
+ multiplyParent$3(matrix$1, transform);
4403
4432
  if (t.parent)
4404
4433
  divideParent(matrix$1, t.parent.worldTransform);
4405
4434
  L.setTransform(t, matrix$1, resize, transition);
4406
4435
  },
4407
4436
  transform(t, transform, resize, transition) {
4408
4437
  copy$7(matrix$1, t.localTransform);
4409
- multiplyParent$2(matrix$1, transform);
4438
+ multiplyParent$3(matrix$1, transform);
4410
4439
  L.setTransform(t, matrix$1, resize, transition);
4411
4440
  },
4412
4441
  setTransform(t, transform, resize, transition) {
@@ -5268,17 +5297,18 @@ var LeaferUI = (function (exports) {
5268
5297
  }
5269
5298
  };
5270
5299
 
5271
- const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorld } = MatrixHelper;
5300
+ const { setLayout, multiplyParent: multiplyParent$2, translateInner, defaultWorld } = MatrixHelper;
5272
5301
  const { toPoint: toPoint$3, tempPoint } = AroundHelper;
5273
5302
  const LeafMatrix = {
5274
5303
  __updateWorldMatrix() {
5275
- multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__, this.parent && this.parent.__);
5304
+ const { parent, __layout } = this;
5305
+ multiplyParent$2(this.__local || __layout, parent ? parent.__world : defaultWorld, this.__world, !!__layout.affectScaleOrRotation, this.__, parent && (parent.scrollY || parent.scrollX) && parent.__);
5276
5306
  },
5277
5307
  __updateLocalMatrix() {
5278
5308
  if (this.__local) {
5279
5309
  const layout = this.__layout, local = this.__local, data = this.__;
5280
5310
  if (layout.affectScaleOrRotation) {
5281
- if ((layout.scaleChanged && (layout.resized = 'scale')) || layout.rotationChanged) {
5311
+ if ((layout.scaleChanged && (layout.resized || (layout.resized = 'scale'))) || layout.rotationChanged) {
5282
5312
  setLayout(local, data, null, null, layout.affectRotation);
5283
5313
  layout.scaleChanged = layout.rotationChanged = undefined;
5284
5314
  }
@@ -5444,10 +5474,7 @@ var LeaferUI = (function (exports) {
5444
5474
  return this.__renderEraser(canvas, options);
5445
5475
  const tempCanvas = canvas.getSameCanvas(true, true);
5446
5476
  this.__draw(tempCanvas, options, canvas);
5447
- if (this.__worldFlipped)
5448
- canvas.copyWorldByReset(tempCanvas, this.__nowWorld, null, data.__blendMode, true);
5449
- else
5450
- canvas.copyWorldToInner(tempCanvas, this.__nowWorld, this.__layout.renderBounds, data.__blendMode);
5477
+ LeafHelper.copyCanvasByWorld(this, canvas, tempCanvas, this.__nowWorld, data.__blendMode, true);
5451
5478
  tempCanvas.recycle(this.__nowWorld);
5452
5479
  }
5453
5480
  else {
@@ -5495,7 +5522,7 @@ var LeaferUI = (function (exports) {
5495
5522
  options.dimOpacity = data.dim === true ? 0.2 : data.dim;
5496
5523
  else if (data.dimskip)
5497
5524
  options.dimOpacity && (options.dimOpacity = 0);
5498
- if (data.__single) {
5525
+ if (data.__single && !this.isBranchLeaf) {
5499
5526
  if (data.eraser === 'path')
5500
5527
  return this.__renderEraser(canvas, options);
5501
5528
  const tempCanvas = canvas.getSameCanvas(false, true);
@@ -5517,9 +5544,7 @@ var LeaferUI = (function (exports) {
5517
5544
  else {
5518
5545
  const { children } = this;
5519
5546
  for (let i = 0, len = children.length; i < len; i++) {
5520
- if (excludeRenderBounds$1(children[i], options))
5521
- continue;
5522
- children[i].__render(canvas, options);
5547
+ excludeRenderBounds$1(children[i], options) || children[i].__render(canvas, options);
5523
5548
  }
5524
5549
  }
5525
5550
  },
@@ -5527,16 +5552,15 @@ var LeaferUI = (function (exports) {
5527
5552
  if (this.__worldOpacity) {
5528
5553
  const { children } = this;
5529
5554
  for (let i = 0, len = children.length; i < len; i++) {
5530
- if (excludeRenderBounds$1(children[i], options))
5531
- continue;
5532
- children[i].__clip(canvas, options);
5555
+ excludeRenderBounds$1(children[i], options) || children[i].__clip(canvas, options);
5533
5556
  }
5534
5557
  }
5535
5558
  }
5536
5559
  };
5537
5560
 
5561
+ const tempScaleData$1 = {};
5538
5562
  const { LEAF, create } = IncrementId;
5539
- const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
5563
+ const { toInnerPoint, toOuterPoint, multiplyParent: multiplyParent$1 } = MatrixHelper;
5540
5564
  const { toOuterOf } = BoundsHelper;
5541
5565
  const { copy: copy$4, move } = PointHelper;
5542
5566
  const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
@@ -5718,7 +5742,7 @@ var LeaferUI = (function (exports) {
5718
5742
  if (!this.__cameraWorld)
5719
5743
  this.__cameraWorld = {};
5720
5744
  const cameraWorld = this.__cameraWorld, world = this.__world;
5721
- multiplyParent(world, options.matrix, cameraWorld, undefined, world);
5745
+ multiplyParent$1(world, options.matrix, cameraWorld, undefined, world);
5722
5746
  toOuterOf(this.__layout.renderBounds, cameraWorld, cameraWorld);
5723
5747
  cameraWorld.half !== world.half && (cameraWorld.half = world.half);
5724
5748
  return cameraWorld;
@@ -5727,6 +5751,22 @@ var LeaferUI = (function (exports) {
5727
5751
  return this.__world;
5728
5752
  }
5729
5753
  }
5754
+ getClampRenderScale() {
5755
+ let { scaleX } = this.__nowWorld || this.__world;
5756
+ if (scaleX < 0)
5757
+ scaleX = -scaleX;
5758
+ return scaleX > 1 ? scaleX : 1;
5759
+ }
5760
+ getRenderScaleData(abs, scaleFixed) {
5761
+ const { scaleX, scaleY } = ImageManager.patternLocked ? this.__world : this.__nowWorld;
5762
+ if (scaleFixed)
5763
+ tempScaleData$1.scaleX = tempScaleData$1.scaleY = 1;
5764
+ else if (abs)
5765
+ tempScaleData$1.scaleX = scaleX < 0 ? -scaleX : scaleX, tempScaleData$1.scaleY = scaleY < 0 ? -scaleY : scaleY;
5766
+ else
5767
+ tempScaleData$1.scaleX = scaleX, tempScaleData$1.scaleY = scaleY;
5768
+ return tempScaleData$1;
5769
+ }
5730
5770
  getTransform(relative) {
5731
5771
  return this.__layout.getTransform(relative || 'local');
5732
5772
  }
@@ -6251,7 +6291,7 @@ var LeaferUI = (function (exports) {
6251
6291
  }
6252
6292
  }
6253
6293
 
6254
- const version = "1.7.0";
6294
+ const version = "1.8.0";
6255
6295
 
6256
6296
  const debug$5 = Debug.get('LeaferCanvas');
6257
6297
  class LeaferCanvas extends LeaferCanvasBase {
@@ -7280,6 +7320,11 @@ var LeaferUI = (function (exports) {
7280
7320
  });
7281
7321
  };
7282
7322
  }
7323
+ function createAttr(defaultValue) {
7324
+ return (target, key) => {
7325
+ defineKey(target, key, createDescriptor(key, defaultValue));
7326
+ };
7327
+ }
7283
7328
 
7284
7329
  function hasTransparent$3(color) {
7285
7330
  if (!color || color.length === 7 || color.length === 4)
@@ -7337,22 +7382,9 @@ var LeaferUI = (function (exports) {
7337
7382
  const debug$2 = Debug.get('UIData');
7338
7383
  class UIData extends LeafData {
7339
7384
  get scale() { const { scaleX, scaleY } = this; return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX; }
7340
- get __strokeWidth() {
7341
- const { strokeWidth, strokeWidthFixed } = this;
7342
- if (strokeWidthFixed) {
7343
- const ui = this.__leaf;
7344
- let { scaleX } = ui.__nowWorld || ui.__world;
7345
- if (scaleX < 0)
7346
- scaleX = -scaleX;
7347
- return scaleX > 1 ? strokeWidth / scaleX : strokeWidth;
7348
- }
7349
- else
7350
- return strokeWidth;
7351
- }
7352
- get __hasMultiPaint() {
7353
- const t = this;
7354
- return (t.fill && this.__useStroke) || (t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect;
7355
- }
7385
+ get __strokeWidth() { return this.__getRealStrokeWidth(); }
7386
+ get __maxStrokeWidth() { const t = this; return t.__hasMultiStrokeStyle ? Math.max(t.__hasMultiStrokeStyle, t.strokeWidth) : t.strokeWidth; }
7387
+ get __hasMultiPaint() { const t = this; return (t.fill && this.__useStroke) || (t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect; }
7356
7388
  get __clipAfterFill() { const t = this; return (t.cornerRadius || t.innerShadow || t.__pathInputed); }
7357
7389
  get __hasSurface() { const t = this; return (t.fill || t.stroke); }
7358
7390
  get __autoWidth() { return !this._width; }
@@ -7434,6 +7466,21 @@ var LeaferUI = (function (exports) {
7434
7466
  Paint.compute('stroke', this.__leaf);
7435
7467
  this.__needComputePaint = undefined;
7436
7468
  }
7469
+ __getRealStrokeWidth(childStyle) {
7470
+ let { strokeWidth, strokeWidthFixed } = this;
7471
+ if (childStyle) {
7472
+ if (childStyle.strokeWidth)
7473
+ strokeWidth = childStyle.strokeWidth;
7474
+ if (childStyle.strokeWidthFixed !== undefined)
7475
+ strokeWidthFixed = childStyle.strokeWidthFixed;
7476
+ }
7477
+ if (strokeWidthFixed) {
7478
+ const scale = this.__leaf.getClampRenderScale();
7479
+ return scale > 1 ? strokeWidth / scale : strokeWidth;
7480
+ }
7481
+ else
7482
+ return strokeWidth;
7483
+ }
7437
7484
  __setPaint(attrName, value) {
7438
7485
  this.__setInput(attrName, value);
7439
7486
  const layout = this.__leaf.__layout;
@@ -7458,6 +7505,7 @@ var LeaferUI = (function (exports) {
7458
7505
  }
7459
7506
  else {
7460
7507
  stintSet$2(this, '__isAlphaPixelStroke', undefined);
7508
+ stintSet$2(this, '__hasMultiStrokeStyle', undefined);
7461
7509
  this._stroke = this.__isStrokes = undefined;
7462
7510
  }
7463
7511
  }
@@ -7479,8 +7527,8 @@ var LeaferUI = (function (exports) {
7479
7527
 
7480
7528
  class BoxData extends GroupData {
7481
7529
  get __boxStroke() { return !this.__pathInputed; }
7482
- get __drawAfterFill() { const t = this; return (t.overflow === 'hide' && (t.__clipAfterFill || t.innerShadow) && t.__leaf.children.length); }
7483
- get __clipAfterFill() { return this.__leaf.isOverflow || super.__clipAfterFill; }
7530
+ get __drawAfterFill() { const t = this; return t.__single || t.__clipAfterFill; }
7531
+ get __clipAfterFill() { const t = this; return t.overflow === 'hide' && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill); }
7484
7532
  }
7485
7533
 
7486
7534
  class LeaferData extends GroupData {
@@ -7600,7 +7648,7 @@ var LeaferUI = (function (exports) {
7600
7648
  const UIBounds = {
7601
7649
  __updateStrokeSpread() {
7602
7650
  let width = 0, boxWidth = 0;
7603
- const data = this.__, { strokeAlign, strokeWidth } = data, box = this.__box;
7651
+ const data = this.__, { strokeAlign, __maxStrokeWidth: strokeWidth } = data, box = this.__box;
7604
7652
  if ((data.stroke || data.hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
7605
7653
  boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth;
7606
7654
  if (!data.__boxStroke) {
@@ -7620,13 +7668,15 @@ var LeaferUI = (function (exports) {
7620
7668
  },
7621
7669
  __updateRenderSpread() {
7622
7670
  let width = 0;
7623
- const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
7671
+ const { shadow, innerShadow, blur, backgroundBlur, filter, renderSpread } = this.__;
7624
7672
  if (shadow)
7625
7673
  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));
7626
7674
  if (blur)
7627
7675
  width = Math.max(width, blur);
7628
7676
  if (filter)
7629
7677
  width += Filter.getSpread(filter);
7678
+ if (renderSpread)
7679
+ width += renderSpread;
7630
7680
  let shapeWidth = width = Math.ceil(width);
7631
7681
  if (innerShadow)
7632
7682
  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));
@@ -7649,7 +7699,7 @@ var LeaferUI = (function (exports) {
7649
7699
  }
7650
7700
  if (data.__useEffect) {
7651
7701
  const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
7652
- 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')));
7702
+ 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')));
7653
7703
  data.__useEffect = !!(shadow || otherEffect);
7654
7704
  }
7655
7705
  data.__checkSingle();
@@ -7756,17 +7806,17 @@ var LeaferUI = (function (exports) {
7756
7806
  if (__drawAfterFill)
7757
7807
  this.__drawAfterFill(canvas, options);
7758
7808
  if (stroke) {
7759
- const { strokeAlign, __strokeWidth } = this.__;
7760
- if (!__strokeWidth)
7809
+ const { strokeAlign, __strokeWidth: strokeWidth } = this.__;
7810
+ if (!strokeWidth)
7761
7811
  return;
7762
- canvas.setStroke(stroke, __strokeWidth, this.__);
7763
- const half = __strokeWidth / 2;
7812
+ canvas.setStroke(stroke, strokeWidth, this.__);
7813
+ const half = strokeWidth / 2;
7764
7814
  switch (strokeAlign) {
7765
7815
  case 'center':
7766
7816
  canvas.strokeRect(0, 0, width, height);
7767
7817
  break;
7768
7818
  case 'inside':
7769
- width -= __strokeWidth, height -= __strokeWidth;
7819
+ width -= strokeWidth, height -= strokeWidth;
7770
7820
  if (width < 0 || height < 0) {
7771
7821
  canvas.save();
7772
7822
  this.__clip(canvas, options);
@@ -7777,7 +7827,7 @@ var LeaferUI = (function (exports) {
7777
7827
  canvas.strokeRect(x + half, y + half, width, height);
7778
7828
  break;
7779
7829
  case 'outside':
7780
- canvas.strokeRect(x - half, y - half, width + __strokeWidth, height + __strokeWidth);
7830
+ canvas.strokeRect(x - half, y - half, width + strokeWidth, height + strokeWidth);
7781
7831
  break;
7782
7832
  }
7783
7833
  }
@@ -7790,6 +7840,8 @@ var LeaferUI = (function (exports) {
7790
7840
  get isFrame() { return false; }
7791
7841
  set scale(value) { MathHelper.assignScale(this, value); }
7792
7842
  get scale() { return this.__.scale; }
7843
+ get isAutoWidth() { const t = this.__; return t.__autoWidth || t.autoWidth; }
7844
+ get isAutoHeight() { const t = this.__; return t.__autoHeight || t.autoHeight; }
7793
7845
  get pen() {
7794
7846
  const { path } = this.__;
7795
7847
  pen.set(this.path = path || []);
@@ -8004,6 +8056,9 @@ var LeaferUI = (function (exports) {
8004
8056
  __decorate([
8005
8057
  naturalBoundsType(1)
8006
8058
  ], exports.UI.prototype, "pixelRatio", void 0);
8059
+ __decorate([
8060
+ affectRenderBoundsType(0)
8061
+ ], exports.UI.prototype, "renderSpread", void 0);
8007
8062
  __decorate([
8008
8063
  pathInputType()
8009
8064
  ], exports.UI.prototype, "path", void 0);
@@ -8160,7 +8215,8 @@ var LeaferUI = (function (exports) {
8160
8215
  }
8161
8216
  toJSON(options) {
8162
8217
  const data = super.toJSON(options);
8163
- data.children = this.children.map(child => child.toJSON(options));
8218
+ if (!this.childlessJSON)
8219
+ data.children = this.children.map(child => child.toJSON(options));
8164
8220
  return data;
8165
8221
  }
8166
8222
  pick(_hitPoint, _options) { return undefined; }
@@ -8607,8 +8663,8 @@ var LeaferUI = (function (exports) {
8607
8663
  __updateRenderSpread() { return this.__updateRectRenderSpread() || -1; }
8608
8664
  __updateRectBoxBounds() { }
8609
8665
  __updateBoxBounds(_secondLayout) {
8610
- const data = this.__;
8611
8666
  if (this.children.length && !this.pathInputed) {
8667
+ const data = this.__;
8612
8668
  if (data.__autoSide) {
8613
8669
  if (data.__hasSurface)
8614
8670
  this.__extraUpdate();
@@ -8635,20 +8691,26 @@ var LeaferUI = (function (exports) {
8635
8691
  __updateStrokeBounds() { }
8636
8692
  __updateRenderBounds() {
8637
8693
  let isOverflow;
8638
- const { renderBounds } = this.__layout;
8639
8694
  if (this.children.length) {
8695
+ const data = this.__, { renderBounds, boxBounds } = this.__layout;
8640
8696
  super.__updateRenderBounds();
8641
8697
  copy$3(childrenRenderBounds, renderBounds);
8642
8698
  this.__updateRectRenderBounds();
8643
- isOverflow = !includes$1(renderBounds, childrenRenderBounds);
8644
- if (isOverflow && this.__.overflow !== 'hide')
8699
+ if (data.scrollY || data.scrollX) {
8700
+ childrenRenderBounds.x += data.scrollX;
8701
+ childrenRenderBounds.y += data.scrollY;
8702
+ }
8703
+ isOverflow = !includes$1(boxBounds, childrenRenderBounds);
8704
+ if (isOverflow && data.overflow !== 'hide')
8645
8705
  add(renderBounds, childrenRenderBounds);
8646
8706
  }
8647
8707
  else
8648
8708
  this.__updateRectRenderBounds();
8649
8709
  DataHelper.stintSet(this, 'isOverflow', isOverflow);
8710
+ this.__updateScrollBar();
8650
8711
  }
8651
8712
  __updateRectRenderBounds() { }
8713
+ __updateScrollBar() { }
8652
8714
  __updateRectChange() { }
8653
8715
  __updateChange() {
8654
8716
  super.__updateChange();
@@ -8665,10 +8727,12 @@ var LeaferUI = (function (exports) {
8665
8727
  if (this.children.length)
8666
8728
  this.__renderGroup(canvas, options);
8667
8729
  }
8730
+ if (this.scrollBar)
8731
+ this.scrollBar.__render(canvas, options);
8668
8732
  }
8669
8733
  __drawContent(canvas, options) {
8670
8734
  this.__renderGroup(canvas, options);
8671
- if (this.__.__useStroke) {
8735
+ if (this.__.__useStroke || this.__.__useEffect) {
8672
8736
  canvas.setWorld(this.__nowWorld);
8673
8737
  this.__drawRenderPath(canvas);
8674
8738
  }
@@ -10471,18 +10535,20 @@ var LeaferUI = (function (exports) {
10471
10535
  }
10472
10536
  return this.__hit(inner);
10473
10537
  };
10474
- leaf.__hitFill = function (inner) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitFill(inner, this.__.windingRule); };
10475
- leaf.__hitStroke = function (inner, strokeWidth) { var _a; return (_a = this.__hitCanvas) === null || _a === void 0 ? void 0 : _a.hitStroke(inner, strokeWidth); };
10476
- 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); };
10477
- leaf.__drawHitPath = function (canvas) { if (canvas)
10478
- this.__drawRenderPath(canvas); };
10538
+ leaf.__hitFill = function (inner) { const h = this.__hitCanvas; return h && h.hitFill(inner, this.__.windingRule); };
10539
+ leaf.__hitStroke = function (inner, strokeWidth) { const h = this.__hitCanvas; return h && h.hitStroke(inner, strokeWidth); };
10540
+ leaf.__hitPixel = function (inner) { const h = this.__hitCanvas; return h && h.hitPixel(inner, this.__layout.renderBounds, h.hitScale); };
10541
+ leaf.__drawHitPath = function (canvas) { canvas && this.__drawRenderPath(canvas); };
10479
10542
 
10480
10543
  const matrix = new Matrix();
10481
10544
  const ui$1 = exports.UI.prototype;
10482
10545
  ui$1.__updateHitCanvas = function () {
10483
10546
  if (this.__box)
10484
10547
  this.__box.__updateHitCanvas();
10485
- const data = this.__, { hitCanvasManager } = this.leafer || this.parent.leafer;
10548
+ const leafer = this.leafer || (this.parent && this.parent.leafer);
10549
+ if (!leafer)
10550
+ return;
10551
+ const data = this.__, { hitCanvasManager } = leafer;
10486
10552
  const isHitPixelFill = (data.__isAlphaPixelFill || data.__isCanvas) && data.hitFill === 'pixel';
10487
10553
  const isHitPixelStroke = data.__isAlphaPixelStroke && data.hitStroke === 'pixel';
10488
10554
  const isHitPixel = isHitPixelFill || isHitPixelStroke;
@@ -10518,7 +10584,7 @@ var LeaferUI = (function (exports) {
10518
10584
  const needHitFillPath = ((data.fill || data.__isCanvas) && (hitFill === 'path' || (hitFill === 'pixel' && !(data.__isAlphaPixelFill || data.__isCanvas)))) || hitFill === 'all';
10519
10585
  if (needHitFillPath && this.__hitFill(inner))
10520
10586
  return true;
10521
- const { hitStroke, __strokeWidth } = data;
10587
+ const { hitStroke, __maxStrokeWidth: strokeWidth } = data;
10522
10588
  const needHitStrokePath = (data.stroke && (hitStroke === 'path' || (hitStroke === 'pixel' && !data.__isAlphaPixelStroke))) || hitStroke === 'all';
10523
10589
  if (!needHitFillPath && !needHitStrokePath)
10524
10590
  return false;
@@ -10527,16 +10593,16 @@ var LeaferUI = (function (exports) {
10527
10593
  if (needHitStrokePath) {
10528
10594
  switch (data.strokeAlign) {
10529
10595
  case 'inside':
10530
- hitWidth += __strokeWidth * 2;
10596
+ hitWidth += strokeWidth * 2;
10531
10597
  if (!needHitFillPath && this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
10532
10598
  return true;
10533
10599
  hitWidth = radiusWidth;
10534
10600
  break;
10535
10601
  case 'center':
10536
- hitWidth += __strokeWidth;
10602
+ hitWidth += strokeWidth;
10537
10603
  break;
10538
10604
  case 'outside':
10539
- hitWidth += __strokeWidth * 2;
10605
+ hitWidth += strokeWidth * 2;
10540
10606
  if (!needHitFillPath) {
10541
10607
  if (!this.__hitFill(inner) && this.__hitStroke(inner, hitWidth))
10542
10608
  return true;
@@ -10948,9 +11014,14 @@ var LeaferUI = (function (exports) {
10948
11014
  }
10949
11015
  }
10950
11016
  canvas.fillStyle = item.style;
10951
- if (item.transform) {
11017
+ if (item.transform || item.scaleFixed) {
10952
11018
  canvas.save();
10953
- canvas.transform(item.transform);
11019
+ if (item.transform)
11020
+ canvas.transform(item.transform);
11021
+ if (item.scaleFixed) {
11022
+ const { scaleX, scaleY } = ui.getRenderScaleData(true);
11023
+ canvas.scale(1 / scaleX, 1 / scaleY);
11024
+ }
10954
11025
  if (item.blendMode)
10955
11026
  canvas.blendMode = item.blendMode;
10956
11027
  fillPathOrText(ui, canvas);
@@ -10986,8 +11057,13 @@ var LeaferUI = (function (exports) {
10986
11057
  }
10987
11058
  function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
10988
11059
  const data = ui.__;
10989
- canvas.setStroke(!data.__isStrokes && stroke, data.strokeWidth * strokeWidthScale, data);
10990
- data.__isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
11060
+ if (typeof stroke === 'object') {
11061
+ drawStrokesStyle(stroke, strokeWidthScale, true, ui, canvas);
11062
+ }
11063
+ else {
11064
+ canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
11065
+ drawTextStroke(ui, canvas);
11066
+ }
10991
11067
  }
10992
11068
  function drawAlign(stroke, align, ui, canvas) {
10993
11069
  const out = canvas.getSameCanvas(true, true);
@@ -10996,15 +11072,9 @@ var LeaferUI = (function (exports) {
10996
11072
  out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
10997
11073
  fillText(ui, out);
10998
11074
  out.blendMode = 'normal';
10999
- copyWorld(canvas, out, ui);
11075
+ LeafHelper.copyCanvasByWorld(ui, canvas, out);
11000
11076
  out.recycle(ui.__nowWorld);
11001
11077
  }
11002
- function copyWorld(canvas, out, ui) {
11003
- if (ui.__worldFlipped || Platform.fullImageShadow)
11004
- canvas.copyWorldByReset(out, ui.__nowWorld);
11005
- else
11006
- canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
11007
- }
11008
11078
  function drawTextStroke(ui, canvas) {
11009
11079
  let row, data = ui.__.__textDrawData;
11010
11080
  const { rows, decorationY } = data;
@@ -11020,14 +11090,21 @@ var LeaferUI = (function (exports) {
11020
11090
  rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
11021
11091
  }
11022
11092
  }
11023
- function drawStrokesStyle(strokes, isText, ui, canvas) {
11093
+ function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas) {
11024
11094
  let item;
11095
+ const data = ui.__, { __hasMultiStrokeStyle } = data;
11096
+ __hasMultiStrokeStyle || canvas.setStroke(undefined, data.__strokeWidth * strokeWidthScale, data);
11025
11097
  for (let i = 0, len = strokes.length; i < len; i++) {
11026
11098
  item = strokes[i];
11027
11099
  if (item.image && PaintImage.checkImage(ui, canvas, item, false))
11028
11100
  continue;
11029
11101
  if (item.style) {
11030
- canvas.strokeStyle = item.style;
11102
+ if (__hasMultiStrokeStyle) {
11103
+ const { strokeStyle } = item;
11104
+ strokeStyle ? canvas.setStroke(item.style, data.__getRealStrokeWidth(strokeStyle) * strokeWidthScale, data, strokeStyle) : canvas.setStroke(item.style, data.__strokeWidth * strokeWidthScale, data);
11105
+ }
11106
+ else
11107
+ canvas.strokeStyle = item.style;
11031
11108
  if (item.blendMode) {
11032
11109
  canvas.saveBlendMode(item.blendMode);
11033
11110
  isText ? drawTextStroke(ui, canvas) : canvas.stroke();
@@ -11066,8 +11143,13 @@ var LeaferUI = (function (exports) {
11066
11143
  }
11067
11144
  function drawCenter(stroke, strokeWidthScale, ui, canvas) {
11068
11145
  const data = ui.__;
11069
- canvas.setStroke(!data.__isStrokes && stroke, data.__strokeWidth * strokeWidthScale, data);
11070
- data.__isStrokes ? drawStrokesStyle(stroke, false, ui, canvas) : canvas.stroke();
11146
+ if (typeof stroke === 'object') {
11147
+ drawStrokesStyle(stroke, strokeWidthScale, false, ui, canvas);
11148
+ }
11149
+ else {
11150
+ canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
11151
+ canvas.stroke();
11152
+ }
11071
11153
  if (data.__useArrow)
11072
11154
  Paint.strokeArrow(stroke, ui, canvas);
11073
11155
  }
@@ -11089,7 +11171,7 @@ var LeaferUI = (function (exports) {
11089
11171
  drawCenter(stroke, 2, ui, out);
11090
11172
  out.clipUI(data);
11091
11173
  out.clearWorld(renderBounds);
11092
- copyWorld(canvas, out, ui);
11174
+ LeafHelper.copyCanvasByWorld(ui, canvas, out);
11093
11175
  out.recycle(ui.__nowWorld);
11094
11176
  }
11095
11177
  }
@@ -11144,8 +11226,16 @@ var LeaferUI = (function (exports) {
11144
11226
  if (!(paints instanceof Array))
11145
11227
  paints = [paints];
11146
11228
  recycleMap = PaintImage.recycleImage(attrName, data);
11229
+ let maxChildStrokeWidth;
11147
11230
  for (let i = 0, len = paints.length, item; i < len; i++) {
11148
- (item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item);
11231
+ if (item = getLeafPaint(attrName, paints[i], ui)) {
11232
+ leafPaints.push(item);
11233
+ if (item.strokeStyle) {
11234
+ maxChildStrokeWidth || (maxChildStrokeWidth = 1);
11235
+ if (item.strokeStyle.strokeWidth)
11236
+ maxChildStrokeWidth = Math.max(maxChildStrokeWidth, item.strokeStyle.strokeWidth);
11237
+ }
11238
+ }
11149
11239
  }
11150
11240
  data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
11151
11241
  if (leafPaints.length) {
@@ -11162,6 +11252,7 @@ var LeaferUI = (function (exports) {
11162
11252
  else {
11163
11253
  stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
11164
11254
  stintSet(data, '__isTransparentStroke', isTransparent);
11255
+ stintSet(data, '__hasMultiStrokeStyle', maxChildStrokeWidth);
11165
11256
  }
11166
11257
  }
11167
11258
  function getLeafPaint(attrName, paint, ui) {
@@ -11193,6 +11284,11 @@ var LeaferUI = (function (exports) {
11193
11284
  if (data) {
11194
11285
  if (typeof data.style === 'string' && hasTransparent$1(data.style))
11195
11286
  data.isTransparent = true;
11287
+ if (paint.style) {
11288
+ if (paint.style.strokeWidth === 0)
11289
+ return undefined;
11290
+ data.strokeStyle = paint.style;
11291
+ }
11196
11292
  if (paint.blendMode)
11197
11293
  data.blendMode = paint.blendMode;
11198
11294
  }
@@ -11212,8 +11308,8 @@ var LeaferUI = (function (exports) {
11212
11308
  shape
11213
11309
  };
11214
11310
 
11215
- let origin = {};
11216
- const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, scale: scaleHelper, rotate, skew: skewHelper } = MatrixHelper;
11311
+ let origin = {}, tempMatrix = getMatrixData();
11312
+ const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent, scale: scaleHelper, rotate, skew: skewHelper } = MatrixHelper;
11217
11313
  function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
11218
11314
  const transform = get$3();
11219
11315
  translate$1(transform, box.x + x, box.y + y);
@@ -11222,7 +11318,7 @@ var LeaferUI = (function (exports) {
11222
11318
  rotateOfOuter$1(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
11223
11319
  data.transform = transform;
11224
11320
  }
11225
- function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew) {
11321
+ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipSize) {
11226
11322
  const transform = get$3();
11227
11323
  if (rotation)
11228
11324
  rotate(transform, rotation);
@@ -11231,6 +11327,10 @@ var LeaferUI = (function (exports) {
11231
11327
  if (scaleX)
11232
11328
  scaleHelper(transform, scaleX, scaleY);
11233
11329
  translate$1(transform, box.x + x, box.y + y);
11330
+ if (clipSize) {
11331
+ tempMatrix.a = box.width / clipSize.width, tempMatrix.d = box.height / clipSize.height;
11332
+ multiplyParent(transform, tempMatrix);
11333
+ }
11234
11334
  data.transform = transform;
11235
11335
  }
11236
11336
  function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
@@ -11267,13 +11367,15 @@ var LeaferUI = (function (exports) {
11267
11367
  const tempScaleData = {};
11268
11368
  const tempImage = {};
11269
11369
  function createData(leafPaint, image, paint, box) {
11270
- const { changeful, sync, editing } = paint;
11370
+ const { changeful, sync, editing, scaleFixed } = paint;
11271
11371
  if (changeful)
11272
11372
  leafPaint.changeful = changeful;
11273
11373
  if (sync)
11274
11374
  leafPaint.sync = sync;
11275
11375
  if (editing)
11276
11376
  leafPaint.editing = editing;
11377
+ if (scaleFixed)
11378
+ leafPaint.scaleFixed = scaleFixed;
11277
11379
  leafPaint.data = getPatternData(paint, box, image);
11278
11380
  }
11279
11381
  function getPatternData(paint, box, image) {
@@ -11282,7 +11384,7 @@ var LeaferUI = (function (exports) {
11282
11384
  if (paint.mode === 'strench')
11283
11385
  paint.mode = 'stretch';
11284
11386
  let { width, height } = image;
11285
- const { opacity, mode, align, offset, scale, size, rotation, skew, repeat, filters } = paint;
11387
+ const { opacity, mode, align, offset, scale, size, rotation, skew, clipSize, repeat, filters } = paint;
11286
11388
  const sameBox = box.width === width && box.height === height;
11287
11389
  const data = { mode };
11288
11390
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
@@ -11316,8 +11418,8 @@ var LeaferUI = (function (exports) {
11316
11418
  break;
11317
11419
  case 'normal':
11318
11420
  case 'clip':
11319
- if (tempImage.x || tempImage.y || scaleX || rotation || skew)
11320
- clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew);
11421
+ if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
11422
+ clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, paint.clipSize);
11321
11423
  break;
11322
11424
  case 'repeat':
11323
11425
  if (!sameBox || scaleX || rotation)
@@ -11454,18 +11556,16 @@ var LeaferUI = (function (exports) {
11454
11556
  }
11455
11557
 
11456
11558
  const { get: get$1, scale, copy: copy$1 } = MatrixHelper;
11457
- const { ceil, abs: abs$1 } = Math;
11559
+ const { ceil, abs } = Math;
11458
11560
  function createPattern(ui, paint, pixelRatio) {
11459
- let { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
11561
+ let { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
11460
11562
  const id = scaleX + '-' + scaleY + '-' + pixelRatio;
11461
11563
  if (paint.patternId !== id && !ui.destroyed) {
11462
- scaleX = abs$1(scaleX);
11463
- scaleY = abs$1(scaleY);
11464
11564
  const { image, data } = paint;
11465
11565
  let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
11466
11566
  if (sx) {
11467
- sx = abs$1(sx);
11468
- sy = abs$1(sy);
11567
+ sx = abs(sx);
11568
+ sy = abs(sy);
11469
11569
  imageMatrix = get$1();
11470
11570
  copy$1(imageMatrix, transform);
11471
11571
  scale(imageMatrix, 1 / sx, 1 / sy);
@@ -11518,9 +11618,8 @@ var LeaferUI = (function (exports) {
11518
11618
  }
11519
11619
  }
11520
11620
 
11521
- const { abs } = Math;
11522
11621
  function checkImage(ui, canvas, paint, allowDraw) {
11523
- const { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
11622
+ const { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
11524
11623
  const { pixelRatio } = canvas, { data } = paint;
11525
11624
  if (!data || (paint.patternId === scaleX + '-' + scaleY + '-' + pixelRatio && !Export.running)) {
11526
11625
  return false;
@@ -11533,8 +11632,8 @@ var LeaferUI = (function (exports) {
11533
11632
  else {
11534
11633
  if (!(paint.changeful || ResizeEvent.isResizing(ui) || Export.running)) {
11535
11634
  let { width, height } = data;
11536
- width *= abs(scaleX) * pixelRatio;
11537
- height *= abs(scaleY) * pixelRatio;
11635
+ width *= scaleX * pixelRatio;
11636
+ height *= scaleY * pixelRatio;
11538
11637
  if (data.scaleX) {
11539
11638
  width *= data.scaleX;
11540
11639
  height *= data.scaleY;
@@ -11544,6 +11643,10 @@ var LeaferUI = (function (exports) {
11544
11643
  }
11545
11644
  }
11546
11645
  if (allowDraw) {
11646
+ if (ui.__.__isFastShadow) {
11647
+ canvas.fillStyle = paint.style || '#000';
11648
+ canvas.fill();
11649
+ }
11547
11650
  drawImage(ui, canvas, paint, data);
11548
11651
  return true;
11549
11652
  }
@@ -11732,10 +11835,7 @@ var LeaferUI = (function (exports) {
11732
11835
  }
11733
11836
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
11734
11837
  }
11735
- if (ui.__worldFlipped)
11736
- current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
11737
- else
11738
- current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
11838
+ LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
11739
11839
  if (end && index < end)
11740
11840
  other.clearWorld(copyBounds, true);
11741
11841
  });
@@ -11794,10 +11894,7 @@ var LeaferUI = (function (exports) {
11794
11894
  copyBounds = bounds;
11795
11895
  }
11796
11896
  other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
11797
- if (ui.__worldFlipped)
11798
- current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
11799
- else
11800
- current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
11897
+ LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
11801
11898
  if (end && index < end)
11802
11899
  other.clearWorld(copyBounds, true);
11803
11900
  });
@@ -11853,12 +11950,11 @@ var LeaferUI = (function (exports) {
11853
11950
  contentCanvas = getCanvas(canvas);
11854
11951
  child.__render(maskCanvas, options);
11855
11952
  }
11856
- if (!(mask === 'clipping' || mask === 'clipping-path'))
11857
- continue;
11858
- }
11859
- if (excludeRenderBounds(child, options))
11953
+ if (mask === 'clipping' || mask === 'clipping-path')
11954
+ excludeRenderBounds(child, options) || child.__render(canvas, options);
11860
11955
  continue;
11861
- child.__render(contentCanvas || canvas, options);
11956
+ }
11957
+ excludeRenderBounds(child, options) || child.__render(contentCanvas || canvas, options);
11862
11958
  }
11863
11959
  maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
11864
11960
  };
@@ -12571,6 +12667,8 @@ var LeaferUI = (function (exports) {
12571
12667
  exports.boundsType = boundsType;
12572
12668
  exports.canvasPatch = canvasPatch;
12573
12669
  exports.canvasSizeAttrs = canvasSizeAttrs;
12670
+ exports.createAttr = createAttr;
12671
+ exports.createDescriptor = createDescriptor;
12574
12672
  exports.cursorType = cursorType;
12575
12673
  exports.dataProcessor = dataProcessor;
12576
12674
  exports.dataType = dataType;
@@ -12609,7 +12707,7 @@ var LeaferUI = (function (exports) {
12609
12707
  exports.strokeType = strokeType;
12610
12708
  exports.surfaceType = surfaceType;
12611
12709
  exports.tempBounds = tempBounds$1;
12612
- exports.tempMatrix = tempMatrix;
12710
+ exports.tempMatrix = tempMatrix$1;
12613
12711
  exports.tempPoint = tempPoint$2;
12614
12712
  exports.useCanvas = useCanvas;
12615
12713
  exports.useModule = useModule;