leafer-draw 1.6.7 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/web.js CHANGED
@@ -46,7 +46,7 @@ var LeaferUI = (function (exports) {
46
46
  };
47
47
  const I$1 = IncrementId;
48
48
 
49
- const { round: round$3, pow: pow$1, PI: PI$4 } = Math;
49
+ const { round: round$3, pow: pow$1, PI: PI$3 } = Math;
50
50
  const MathHelper = {
51
51
  within(value, min, max) {
52
52
  if (typeof min === 'object')
@@ -142,9 +142,9 @@ var LeaferUI = (function (exports) {
142
142
  function randInt(num) {
143
143
  return Math.round(Math.random() * num);
144
144
  }
145
- const OneRadian = PI$4 / 180;
146
- const PI2 = PI$4 * 2;
147
- const PI_2 = PI$4 / 2;
145
+ const OneRadian = PI$3 / 180;
146
+ const PI2 = PI$3 * 2;
147
+ const PI_2 = PI$3 / 2;
148
148
  function getPointData() { return { x: 0, y: 0 }; }
149
149
  function getBoundsData() { return { x: 0, y: 0, width: 0, height: 0 }; }
150
150
  function getMatrixData() { return { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 }; }
@@ -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, PI: PI$3 } = 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) {
@@ -552,10 +552,11 @@ var LeaferUI = (function (exports) {
552
552
  getRadianFrom(fromX, fromY, originX, originY, toX, toY, toOriginX, toOriginY) {
553
553
  if (toOriginX === undefined)
554
554
  toOriginX = originX, toOriginY = originY;
555
- let fromAngle = atan2$2(fromY - originY, fromX - originX);
556
- let toAngle = atan2$2(toY - toOriginY, toX - toOriginX);
557
- const radian = toAngle - fromAngle;
558
- return radian < -PI$3 ? radian + PI2 : radian;
555
+ const a = fromX - originX;
556
+ const b = fromY - originY;
557
+ const c = toX - toOriginX;
558
+ const d = toY - toOriginY;
559
+ return Math.atan2(a * d - b * c, a * c + b * d);
559
560
  },
560
561
  getAtan2(t, to) {
561
562
  return atan2$2(to.y - t.y, to.x - t.x);
@@ -765,7 +766,7 @@ var LeaferUI = (function (exports) {
765
766
  MatrixHelper.reset(this);
766
767
  }
767
768
  }
768
- const tempMatrix = new Matrix();
769
+ const tempMatrix$1 = new Matrix();
769
770
 
770
771
  const TwoPointBoundsHelper = {
771
772
  tempPointBounds: {},
@@ -862,6 +863,12 @@ var LeaferUI = (function (exports) {
862
863
  }
863
864
  if (!onlyBoxSize)
864
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;
865
872
  }
866
873
  };
867
874
  function get$4(around) {
@@ -1790,10 +1797,13 @@ var LeaferUI = (function (exports) {
1790
1797
  return (target, key) => {
1791
1798
  if (!realName)
1792
1799
  realName = key;
1793
- Object.defineProperty(target, key, {
1800
+ const property = {
1794
1801
  get() { return this.context[realName]; },
1795
1802
  set(value) { this.context[realName] = value; }
1796
- });
1803
+ };
1804
+ if (key === 'strokeCap')
1805
+ property.set = function (value) { this.context[realName] = value === 'none' ? 'butt' : value; };
1806
+ Object.defineProperty(target, key, property);
1797
1807
  };
1798
1808
  }
1799
1809
  const contextMethodNameList = [];
@@ -2069,15 +2079,15 @@ var LeaferUI = (function (exports) {
2069
2079
  contextMethod()
2070
2080
  ], Canvas.prototype, "strokeText", null);
2071
2081
 
2072
- const { copy: copy$8, multiplyParent: multiplyParent$3 } = MatrixHelper, { round: round$1 } = Math;
2082
+ const { copy: copy$8, multiplyParent: multiplyParent$4 } = MatrixHelper, { round: round$1 } = Math;
2073
2083
  const minSize = { width: 1, height: 1, pixelRatio: 1 };
2074
2084
  const canvasSizeAttrs = ['width', 'height', 'pixelRatio'];
2075
2085
  class LeaferCanvasBase extends Canvas {
2076
2086
  get width() { return this.size.width; }
2077
2087
  get height() { return this.size.height; }
2078
2088
  get pixelRatio() { return this.size.pixelRatio; }
2079
- get pixelWidth() { return this.width * this.pixelRatio; }
2080
- 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; }
2081
2091
  get pixelSnap() { return this.config.pixelSnap; }
2082
2092
  set pixelSnap(value) { this.config.pixelSnap = value; }
2083
2093
  get allowBackgroundColor() { return this.view && this.parentView; }
@@ -2142,7 +2152,7 @@ var LeaferUI = (function (exports) {
2142
2152
  setWorld(matrix, parentMatrix) {
2143
2153
  const { pixelRatio, pixelSnap } = this, w = this.worldTransform;
2144
2154
  if (parentMatrix)
2145
- multiplyParent$3(matrix, parentMatrix, w);
2155
+ multiplyParent$4(matrix, parentMatrix, w);
2146
2156
  w.a = matrix.a * pixelRatio;
2147
2157
  w.b = matrix.b * pixelRatio;
2148
2158
  w.c = matrix.c * pixelRatio;
@@ -2164,20 +2174,33 @@ var LeaferUI = (function (exports) {
2164
2174
  if (w)
2165
2175
  this.setTransform(w.a, w.b, w.c, w.d, w.e, w.f);
2166
2176
  }
2167
- setStroke(color, strokeWidth, options) {
2177
+ setStroke(color, strokeWidth, options, childOptions) {
2168
2178
  if (strokeWidth)
2169
2179
  this.strokeWidth = strokeWidth;
2170
2180
  if (color)
2171
2181
  this.strokeStyle = color;
2172
2182
  if (options)
2173
- this.setStrokeOptions(options);
2174
- }
2175
- setStrokeOptions(options) {
2176
- this.strokeCap = options.strokeCap === 'none' ? 'butt' : options.strokeCap;
2177
- this.strokeJoin = options.strokeJoin;
2178
- this.dashPattern = options.dashPattern;
2179
- this.dashOffset = options.dashOffset;
2180
- 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;
2181
2204
  }
2182
2205
  saveBlendMode(blendMode) {
2183
2206
  this.savedBlendMode = this.blendMode;
@@ -2411,7 +2434,7 @@ var LeaferUI = (function (exports) {
2411
2434
  }
2412
2435
  };
2413
2436
 
2414
- 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;
2415
2438
  const { setPoint: setPoint$1, addPoint: addPoint$1 } = TwoPointBoundsHelper;
2416
2439
  const { set, toNumberPoints } = PointHelper;
2417
2440
  const { M: M$5, L: L$6, C: C$4, Q: Q$4, Z: Z$5 } = PathCommandMap;
@@ -2486,7 +2509,7 @@ var LeaferUI = (function (exports) {
2486
2509
  let totalRadian = endRadian - startRadian;
2487
2510
  if (totalRadian < 0)
2488
2511
  totalRadian += PI2;
2489
- 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)) {
2490
2513
  if (data)
2491
2514
  data.push(L$6, x1, y1);
2492
2515
  if (setPointBounds) {
@@ -2528,7 +2551,7 @@ var LeaferUI = (function (exports) {
2528
2551
  totalRadian -= PI2;
2529
2552
  if (anticlockwise)
2530
2553
  totalRadian -= PI2;
2531
- const parts = ceil$1(abs$3(totalRadian / PI_2));
2554
+ const parts = ceil$1(abs$2(totalRadian / PI_2));
2532
2555
  const partRadian = totalRadian / parts;
2533
2556
  const partRadian4Sin = sin$3(partRadian / 4);
2534
2557
  const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$3(partRadian / 2);
@@ -2973,7 +2996,7 @@ var LeaferUI = (function (exports) {
2973
2996
 
2974
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;
2975
2998
  const { getMinDistanceFrom, getRadianFrom } = PointHelper;
2976
- const { tan, min, abs: abs$2 } = Math;
2999
+ const { tan, min, abs: abs$1 } = Math;
2977
3000
  const startPoint = {};
2978
3001
  const PathCommandDataHelper = {
2979
3002
  beginPath(data) {
@@ -3036,7 +3059,7 @@ var LeaferUI = (function (exports) {
3036
3059
  arcTo(data, x1, y1, x2, y2, radius, lastX, lastY) {
3037
3060
  if (lastX !== undefined) {
3038
3061
  const d = getMinDistanceFrom(lastX, lastY, x1, y1, x2, y2);
3039
- 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))));
3040
3063
  }
3041
3064
  data.push(U$2, x1, y1, x2, y2, radius);
3042
3065
  },
@@ -3342,7 +3365,7 @@ var LeaferUI = (function (exports) {
3342
3365
  const { arcTo } = PathCommandDataHelper;
3343
3366
  const PathCorner = {
3344
3367
  smooth(data, cornerRadius, _cornerSmoothing) {
3345
- let command, commandLen;
3368
+ let command, lastCommand, commandLen;
3346
3369
  let i = 0, x = 0, y = 0, startX = 0, startY = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0;
3347
3370
  const len = data.length;
3348
3371
  const smooth = [];
@@ -3380,8 +3403,10 @@ var LeaferUI = (function (exports) {
3380
3403
  lastY = y;
3381
3404
  break;
3382
3405
  case Z:
3383
- arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY);
3384
- smooth.push(Z);
3406
+ if (lastCommand !== Z) {
3407
+ arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY);
3408
+ smooth.push(Z);
3409
+ }
3385
3410
  i += 1;
3386
3411
  break;
3387
3412
  default:
@@ -3390,6 +3415,7 @@ var LeaferUI = (function (exports) {
3390
3415
  smooth.push(data[i + j]);
3391
3416
  i += commandLen;
3392
3417
  }
3418
+ lastCommand = command;
3393
3419
  }
3394
3420
  if (command !== Z) {
3395
3421
  smooth[1] = startX;
@@ -3886,12 +3912,12 @@ var LeaferUI = (function (exports) {
3886
3912
  try {
3887
3913
  if (transform && pattern.setTransform) {
3888
3914
  pattern.setTransform(transform);
3889
- transform = null;
3915
+ transform = undefined;
3890
3916
  }
3891
3917
  }
3892
3918
  catch (_a) { }
3893
3919
  if (paint)
3894
- paint.transform = transform;
3920
+ DataHelper.stintSet(paint, 'transform', transform);
3895
3921
  return pattern;
3896
3922
  }
3897
3923
  destroy() {
@@ -3909,6 +3935,13 @@ var LeaferUI = (function (exports) {
3909
3935
  function getDescriptor(object, name) {
3910
3936
  return Object.getOwnPropertyDescriptor(object, name);
3911
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
+ }
3912
3945
  function getNames(object) {
3913
3946
  return Object.getOwnPropertyNames(object);
3914
3947
  }
@@ -3996,10 +4029,14 @@ var LeaferUI = (function (exports) {
3996
4029
  }));
3997
4030
  }
3998
4031
  const pathType = boundsType;
3999
- function affectStrokeBoundsType(defaultValue) {
4032
+ function affectStrokeBoundsType(defaultValue, useStroke) {
4000
4033
  return decorateLeafAttr(defaultValue, (key) => attr({
4001
4034
  set(value) {
4002
- this.__setAttr(key, value) && doStrokeType(this);
4035
+ if (this.__setAttr(key, value)) {
4036
+ doStrokeType(this);
4037
+ if (useStroke)
4038
+ this.__.__useStroke = true;
4039
+ }
4003
4040
  }
4004
4041
  }));
4005
4042
  }
@@ -4137,15 +4174,7 @@ var LeaferUI = (function (exports) {
4137
4174
  const data = target.__DataProcessor.prototype;
4138
4175
  const computedKey = '_' + key;
4139
4176
  const setMethodName = getSetMethodName(key);
4140
- const property = {
4141
- get() {
4142
- const v = this[computedKey];
4143
- return v === undefined ? defaultValue : v;
4144
- },
4145
- set(value) {
4146
- this[computedKey] = value;
4147
- }
4148
- };
4177
+ const property = createDescriptor(key, defaultValue);
4149
4178
  if (defaultValue === undefined) {
4150
4179
  property.get = function () { return this[computedKey]; };
4151
4180
  }
@@ -4260,7 +4289,7 @@ var LeaferUI = (function (exports) {
4260
4289
  };
4261
4290
  }
4262
4291
 
4263
- const { copy: copy$6, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
4292
+ const { copy: copy$6, toInnerPoint: toInnerPoint$1, toOuterPoint: toOuterPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$3, divideParent, getLayout } = MatrixHelper;
4264
4293
  const matrix = {}, { round } = Math;
4265
4294
  const LeafHelper = {
4266
4295
  updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
@@ -4332,6 +4361,14 @@ var LeaferUI = (function (exports) {
4332
4361
  }
4333
4362
  return true;
4334
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
+ },
4335
4372
  moveWorld(t, x, y = 0, isInnerPoint, transition) {
4336
4373
  const local = typeof x === 'object' ? Object.assign({}, x) : { x, y };
4337
4374
  isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : (t.parent && toInnerPoint$1(t.parent.worldTransform, local, local, true));
@@ -4391,14 +4428,14 @@ var LeaferUI = (function (exports) {
4391
4428
  },
4392
4429
  transformWorld(t, transform, resize, transition) {
4393
4430
  copy$6(matrix, t.worldTransform);
4394
- multiplyParent$2(matrix, transform);
4431
+ multiplyParent$3(matrix, transform);
4395
4432
  if (t.parent)
4396
4433
  divideParent(matrix, t.parent.worldTransform);
4397
4434
  L.setTransform(t, matrix, resize, transition);
4398
4435
  },
4399
4436
  transform(t, transform, resize, transition) {
4400
4437
  copy$6(matrix, t.localTransform);
4401
- multiplyParent$2(matrix, transform);
4438
+ multiplyParent$3(matrix, transform);
4402
4439
  L.setTransform(t, matrix, resize, transition);
4403
4440
  },
4404
4441
  setTransform(t, transform, resize, transition) {
@@ -5260,17 +5297,18 @@ var LeaferUI = (function (exports) {
5260
5297
  }
5261
5298
  };
5262
5299
 
5263
- const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorld } = MatrixHelper;
5300
+ const { setLayout, multiplyParent: multiplyParent$2, translateInner, defaultWorld } = MatrixHelper;
5264
5301
  const { toPoint: toPoint$3, tempPoint } = AroundHelper;
5265
5302
  const LeafMatrix = {
5266
5303
  __updateWorldMatrix() {
5267
- 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.__);
5268
5306
  },
5269
5307
  __updateLocalMatrix() {
5270
5308
  if (this.__local) {
5271
5309
  const layout = this.__layout, local = this.__local, data = this.__;
5272
5310
  if (layout.affectScaleOrRotation) {
5273
- if ((layout.scaleChanged && (layout.resized = 'scale')) || layout.rotationChanged) {
5311
+ if ((layout.scaleChanged && (layout.resized || (layout.resized = 'scale'))) || layout.rotationChanged) {
5274
5312
  setLayout(local, data, null, null, layout.affectRotation);
5275
5313
  layout.scaleChanged = layout.rotationChanged = undefined;
5276
5314
  }
@@ -5425,6 +5463,8 @@ var LeaferUI = (function (exports) {
5425
5463
 
5426
5464
  const LeafRender = {
5427
5465
  __render(canvas, options) {
5466
+ if (options.shape)
5467
+ return this.__renderShape(canvas, options);
5428
5468
  if (this.__worldOpacity) {
5429
5469
  const data = this.__;
5430
5470
  canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
@@ -5434,12 +5474,7 @@ var LeaferUI = (function (exports) {
5434
5474
  return this.__renderEraser(canvas, options);
5435
5475
  const tempCanvas = canvas.getSameCanvas(true, true);
5436
5476
  this.__draw(tempCanvas, options, canvas);
5437
- if (this.__worldFlipped) {
5438
- canvas.copyWorldByReset(tempCanvas, this.__nowWorld, null, data.__blendMode, true);
5439
- }
5440
- else {
5441
- canvas.copyWorldToInner(tempCanvas, this.__nowWorld, this.__layout.renderBounds, data.__blendMode);
5442
- }
5477
+ LeafHelper.copyCanvasByWorld(this, canvas, tempCanvas, this.__nowWorld, data.__blendMode, true);
5443
5478
  tempCanvas.recycle(this.__nowWorld);
5444
5479
  }
5445
5480
  else {
@@ -5449,6 +5484,12 @@ var LeaferUI = (function (exports) {
5449
5484
  Debug.drawBounds(this, canvas, options);
5450
5485
  }
5451
5486
  },
5487
+ __renderShape(canvas, options) {
5488
+ if (this.__worldOpacity) {
5489
+ canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
5490
+ this.__drawShape(canvas, options);
5491
+ }
5492
+ },
5452
5493
  __clip(canvas, options) {
5453
5494
  if (this.__worldOpacity) {
5454
5495
  canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
@@ -5481,7 +5522,7 @@ var LeaferUI = (function (exports) {
5481
5522
  options.dimOpacity = data.dim === true ? 0.2 : data.dim;
5482
5523
  else if (data.dimskip)
5483
5524
  options.dimOpacity && (options.dimOpacity = 0);
5484
- if (data.__single) {
5525
+ if (data.__single && !this.isBranchLeaf) {
5485
5526
  if (data.eraser === 'path')
5486
5527
  return this.__renderEraser(canvas, options);
5487
5528
  const tempCanvas = canvas.getSameCanvas(false, true);
@@ -5503,9 +5544,7 @@ var LeaferUI = (function (exports) {
5503
5544
  else {
5504
5545
  const { children } = this;
5505
5546
  for (let i = 0, len = children.length; i < len; i++) {
5506
- if (excludeRenderBounds$1(children[i], options))
5507
- continue;
5508
- children[i].__render(canvas, options);
5547
+ excludeRenderBounds$1(children[i], options) || children[i].__render(canvas, options);
5509
5548
  }
5510
5549
  }
5511
5550
  },
@@ -5513,16 +5552,15 @@ var LeaferUI = (function (exports) {
5513
5552
  if (this.__worldOpacity) {
5514
5553
  const { children } = this;
5515
5554
  for (let i = 0, len = children.length; i < len; i++) {
5516
- if (excludeRenderBounds$1(children[i], options))
5517
- continue;
5518
- children[i].__clip(canvas, options);
5555
+ excludeRenderBounds$1(children[i], options) || children[i].__clip(canvas, options);
5519
5556
  }
5520
5557
  }
5521
5558
  }
5522
5559
  };
5523
5560
 
5561
+ const tempScaleData$1 = {};
5524
5562
  const { LEAF, create } = IncrementId;
5525
- const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
5563
+ const { toInnerPoint, toOuterPoint, multiplyParent: multiplyParent$1 } = MatrixHelper;
5526
5564
  const { toOuterOf } = BoundsHelper;
5527
5565
  const { copy: copy$3, move } = PointHelper;
5528
5566
  const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
@@ -5704,7 +5742,7 @@ var LeaferUI = (function (exports) {
5704
5742
  if (!this.__cameraWorld)
5705
5743
  this.__cameraWorld = {};
5706
5744
  const cameraWorld = this.__cameraWorld, world = this.__world;
5707
- multiplyParent(world, options.matrix, cameraWorld, undefined, world);
5745
+ multiplyParent$1(world, options.matrix, cameraWorld, undefined, world);
5708
5746
  toOuterOf(this.__layout.renderBounds, cameraWorld, cameraWorld);
5709
5747
  cameraWorld.half !== world.half && (cameraWorld.half = world.half);
5710
5748
  return cameraWorld;
@@ -5713,6 +5751,22 @@ var LeaferUI = (function (exports) {
5713
5751
  return this.__world;
5714
5752
  }
5715
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
+ }
5716
5770
  getTransform(relative) {
5717
5771
  return this.__layout.getTransform(relative || 'local');
5718
5772
  }
@@ -5868,7 +5922,8 @@ var LeaferUI = (function (exports) {
5868
5922
  __drawFast(_canvas, _options) { }
5869
5923
  __draw(_canvas, _options, _originCanvas) { }
5870
5924
  __clip(_canvas, _options) { }
5871
- __renderShape(_canvas, _options, _ignoreFill, _ignoreStroke) { }
5925
+ __renderShape(_canvas, _options) { }
5926
+ __drawShape(_canvas, _options) { }
5872
5927
  __updateWorldOpacity() { }
5873
5928
  __updateChange() { }
5874
5929
  __drawPath(_canvas) { }
@@ -6236,7 +6291,7 @@ var LeaferUI = (function (exports) {
6236
6291
  }
6237
6292
  }
6238
6293
 
6239
- const version = "1.6.7";
6294
+ const version = "1.8.0";
6240
6295
 
6241
6296
  const debug$4 = Debug.get('LeaferCanvas');
6242
6297
  class LeaferCanvas extends LeaferCanvasBase {
@@ -7108,6 +7163,11 @@ var LeaferUI = (function (exports) {
7108
7163
  });
7109
7164
  };
7110
7165
  }
7166
+ function createAttr(defaultValue) {
7167
+ return (target, key) => {
7168
+ defineKey(target, key, createDescriptor(key, defaultValue));
7169
+ };
7170
+ }
7111
7171
 
7112
7172
  function hasTransparent$3(color) {
7113
7173
  if (!color || color.length === 7 || color.length === 4)
@@ -7165,26 +7225,9 @@ var LeaferUI = (function (exports) {
7165
7225
  const debug$1 = Debug.get('UIData');
7166
7226
  class UIData extends LeafData {
7167
7227
  get scale() { const { scaleX, scaleY } = this; return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX; }
7168
- get __strokeWidth() {
7169
- const { strokeWidth, strokeWidthFixed } = this;
7170
- if (strokeWidthFixed) {
7171
- const ui = this.__leaf;
7172
- let { scaleX } = ui.__nowWorld || ui.__world;
7173
- if (scaleX < 0)
7174
- scaleX = -scaleX;
7175
- return scaleX > 1 ? strokeWidth / scaleX : strokeWidth;
7176
- }
7177
- else
7178
- return strokeWidth;
7179
- }
7180
- get __hasStroke() { return this.stroke && this.strokeWidth; }
7181
- get __hasHalf() { const t = this; return (t.stroke && t.strokeAlign === 'center' && t.strokeWidth % 2) || undefined; }
7182
- get __hasMultiPaint() {
7183
- const t = this;
7184
- if ((t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect)
7185
- return true;
7186
- return t.fill && this.__hasStroke;
7187
- }
7228
+ get __strokeWidth() { return this.__getRealStrokeWidth(); }
7229
+ get __maxStrokeWidth() { const t = this; return t.__hasMultiStrokeStyle ? Math.max(t.__hasMultiStrokeStyle, t.strokeWidth) : t.strokeWidth; }
7230
+ get __hasMultiPaint() { const t = this; return (t.fill && this.__useStroke) || (t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect; }
7188
7231
  get __clipAfterFill() { const t = this; return (t.cornerRadius || t.innerShadow || t.__pathInputed); }
7189
7232
  get __hasSurface() { const t = this; return (t.fill || t.stroke); }
7190
7233
  get __autoWidth() { return !this._width; }
@@ -7266,6 +7309,21 @@ var LeaferUI = (function (exports) {
7266
7309
  Paint.compute('stroke', this.__leaf);
7267
7310
  this.__needComputePaint = undefined;
7268
7311
  }
7312
+ __getRealStrokeWidth(childStyle) {
7313
+ let { strokeWidth, strokeWidthFixed } = this;
7314
+ if (childStyle) {
7315
+ if (childStyle.strokeWidth)
7316
+ strokeWidth = childStyle.strokeWidth;
7317
+ if (childStyle.strokeWidthFixed !== undefined)
7318
+ strokeWidthFixed = childStyle.strokeWidthFixed;
7319
+ }
7320
+ if (strokeWidthFixed) {
7321
+ const scale = this.__leaf.getClampRenderScale();
7322
+ return scale > 1 ? strokeWidth / scale : strokeWidth;
7323
+ }
7324
+ else
7325
+ return strokeWidth;
7326
+ }
7269
7327
  __setPaint(attrName, value) {
7270
7328
  this.__setInput(attrName, value);
7271
7329
  const layout = this.__leaf.__layout;
@@ -7290,6 +7348,7 @@ var LeaferUI = (function (exports) {
7290
7348
  }
7291
7349
  else {
7292
7350
  stintSet$2(this, '__isAlphaPixelStroke', undefined);
7351
+ stintSet$2(this, '__hasMultiStrokeStyle', undefined);
7293
7352
  this._stroke = this.__isStrokes = undefined;
7294
7353
  }
7295
7354
  }
@@ -7311,8 +7370,8 @@ var LeaferUI = (function (exports) {
7311
7370
 
7312
7371
  class BoxData extends GroupData {
7313
7372
  get __boxStroke() { return !this.__pathInputed; }
7314
- get __drawAfterFill() { const t = this; return (t.overflow === 'hide' && (t.__clipAfterFill || t.innerShadow) && t.__leaf.children.length); }
7315
- get __clipAfterFill() { return this.__leaf.isOverflow || super.__clipAfterFill; }
7373
+ get __drawAfterFill() { const t = this; return t.__single || t.__clipAfterFill; }
7374
+ get __clipAfterFill() { const t = this; return t.overflow === 'hide' && t.__leaf.children.length && (t.__leaf.isOverflow || super.__clipAfterFill); }
7316
7375
  }
7317
7376
 
7318
7377
  class LeaferData extends GroupData {
@@ -7432,7 +7491,7 @@ var LeaferUI = (function (exports) {
7432
7491
  const UIBounds = {
7433
7492
  __updateStrokeSpread() {
7434
7493
  let width = 0, boxWidth = 0;
7435
- const data = this.__, { strokeAlign, strokeWidth } = data, box = this.__box;
7494
+ const data = this.__, { strokeAlign, __maxStrokeWidth: strokeWidth } = data, box = this.__box;
7436
7495
  if ((data.stroke || data.hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
7437
7496
  boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth;
7438
7497
  if (!data.__boxStroke) {
@@ -7452,13 +7511,15 @@ var LeaferUI = (function (exports) {
7452
7511
  },
7453
7512
  __updateRenderSpread() {
7454
7513
  let width = 0;
7455
- const { shadow, innerShadow, blur, backgroundBlur, filter } = this.__;
7514
+ const { shadow, innerShadow, blur, backgroundBlur, filter, renderSpread } = this.__;
7456
7515
  if (shadow)
7457
7516
  shadow.forEach(item => width = Math.max(width, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread > 0 ? item.spread : 0) + item.blur * 1.5));
7458
7517
  if (blur)
7459
7518
  width = Math.max(width, blur);
7460
7519
  if (filter)
7461
7520
  width += Filter.getSpread(filter);
7521
+ if (renderSpread)
7522
+ width += renderSpread;
7462
7523
  let shapeWidth = width = Math.ceil(width);
7463
7524
  if (innerShadow)
7464
7525
  innerShadow.forEach(item => shapeWidth = Math.max(shapeWidth, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread < 0 ? -item.spread : 0) + item.blur * 1.5));
@@ -7474,15 +7535,18 @@ var LeaferUI = (function (exports) {
7474
7535
  const UIRender = {
7475
7536
  __updateChange() {
7476
7537
  const data = this.__;
7538
+ if (data.__useStroke) {
7539
+ const useStroke = data.__useStroke = !!(data.stroke && data.strokeWidth);
7540
+ stintSet$1(this.__world, 'half', useStroke && data.strokeAlign === 'center' && data.strokeWidth % 2);
7541
+ stintSet$1(data, '__fillAfterStroke', useStroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
7542
+ }
7477
7543
  if (data.__useEffect) {
7478
7544
  const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
7479
- 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')));
7545
+ stintSet$1(data, '__isFastShadow', shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && fill && !data.__isTransparentFill && !(fill instanceof Array && fill.length > 1) && (this.useFastShadow || !stroke || (stroke && data.strokeAlign === 'inside')));
7480
7546
  data.__useEffect = !!(shadow || otherEffect);
7481
7547
  }
7482
- stintSet$1(this.__world, 'half', data.__hasHalf);
7483
- stintSet$1(data, '__fillAfterStroke', data.stroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
7484
7548
  data.__checkSingle();
7485
- stintSet$1(data, '__complex', data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
7549
+ stintSet$1(data, '__complex', (data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect));
7486
7550
  },
7487
7551
  __drawFast(canvas, options) {
7488
7552
  drawFast(this, canvas, options);
@@ -7540,18 +7604,15 @@ var LeaferUI = (function (exports) {
7540
7604
  this.__drawFast(canvas, options);
7541
7605
  }
7542
7606
  },
7543
- __renderShape(canvas, options, ignoreFill, ignoreStroke) {
7544
- if (this.__worldOpacity) {
7545
- canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
7546
- const { fill, stroke } = this.__;
7547
- this.__drawRenderPath(canvas);
7548
- if (fill && !ignoreFill)
7549
- this.__.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
7550
- if (this.__.__isCanvas)
7551
- this.__drawAfterFill(canvas, options);
7552
- if (stroke && !ignoreStroke)
7553
- this.__.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
7554
- }
7607
+ __drawShape(canvas, options) {
7608
+ this.__drawRenderPath(canvas);
7609
+ const data = this.__, { fill, stroke } = data;
7610
+ if (fill && !options.ignoreFill)
7611
+ data.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
7612
+ if (data.__isCanvas)
7613
+ this.__drawAfterFill(canvas, options);
7614
+ if (stroke && !options.ignoreStroke)
7615
+ data.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
7555
7616
  },
7556
7617
  __drawAfterFill(canvas, options) {
7557
7618
  if (this.__.__clipAfterFill) {
@@ -7588,17 +7649,17 @@ var LeaferUI = (function (exports) {
7588
7649
  if (__drawAfterFill)
7589
7650
  this.__drawAfterFill(canvas, options);
7590
7651
  if (stroke) {
7591
- const { strokeAlign, __strokeWidth } = this.__;
7592
- if (!__strokeWidth)
7652
+ const { strokeAlign, __strokeWidth: strokeWidth } = this.__;
7653
+ if (!strokeWidth)
7593
7654
  return;
7594
- canvas.setStroke(stroke, __strokeWidth, this.__);
7595
- const half = __strokeWidth / 2;
7655
+ canvas.setStroke(stroke, strokeWidth, this.__);
7656
+ const half = strokeWidth / 2;
7596
7657
  switch (strokeAlign) {
7597
7658
  case 'center':
7598
7659
  canvas.strokeRect(0, 0, width, height);
7599
7660
  break;
7600
7661
  case 'inside':
7601
- width -= __strokeWidth, height -= __strokeWidth;
7662
+ width -= strokeWidth, height -= strokeWidth;
7602
7663
  if (width < 0 || height < 0) {
7603
7664
  canvas.save();
7604
7665
  this.__clip(canvas, options);
@@ -7609,7 +7670,7 @@ var LeaferUI = (function (exports) {
7609
7670
  canvas.strokeRect(x + half, y + half, width, height);
7610
7671
  break;
7611
7672
  case 'outside':
7612
- canvas.strokeRect(x - half, y - half, width + __strokeWidth, height + __strokeWidth);
7673
+ canvas.strokeRect(x - half, y - half, width + strokeWidth, height + strokeWidth);
7613
7674
  break;
7614
7675
  }
7615
7676
  }
@@ -7622,6 +7683,8 @@ var LeaferUI = (function (exports) {
7622
7683
  get isFrame() { return false; }
7623
7684
  set scale(value) { MathHelper.assignScale(this, value); }
7624
7685
  get scale() { return this.__.scale; }
7686
+ get isAutoWidth() { const t = this.__; return t.__autoWidth || t.autoWidth; }
7687
+ get isAutoHeight() { const t = this.__; return t.__autoHeight || t.autoHeight; }
7625
7688
  get pen() {
7626
7689
  const { path } = this.__;
7627
7690
  pen.set(this.path = path || []);
@@ -7676,12 +7739,14 @@ var LeaferUI = (function (exports) {
7676
7739
  }
7677
7740
  }
7678
7741
  __updateRenderPath() {
7679
- if (this.__.path) {
7680
- const data = this.__;
7742
+ const data = this.__;
7743
+ if (data.path) {
7681
7744
  data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
7682
7745
  if (data.__useArrow)
7683
7746
  PathArrow.addArrows(this, !data.cornerRadius);
7684
7747
  }
7748
+ else
7749
+ data.__pathForRender && (data.__pathForRender = undefined);
7685
7750
  }
7686
7751
  __drawRenderPath(canvas) {
7687
7752
  canvas.beginPath();
@@ -7834,6 +7899,9 @@ var LeaferUI = (function (exports) {
7834
7899
  __decorate([
7835
7900
  naturalBoundsType(1)
7836
7901
  ], exports.UI.prototype, "pixelRatio", void 0);
7902
+ __decorate([
7903
+ affectRenderBoundsType(0)
7904
+ ], exports.UI.prototype, "renderSpread", void 0);
7837
7905
  __decorate([
7838
7906
  pathInputType()
7839
7907
  ], exports.UI.prototype, "path", void 0);
@@ -7892,13 +7960,13 @@ var LeaferUI = (function (exports) {
7892
7960
  surfaceType()
7893
7961
  ], exports.UI.prototype, "fill", void 0);
7894
7962
  __decorate([
7895
- strokeType()
7963
+ strokeType(undefined, true)
7896
7964
  ], exports.UI.prototype, "stroke", void 0);
7897
7965
  __decorate([
7898
7966
  strokeType('inside')
7899
7967
  ], exports.UI.prototype, "strokeAlign", void 0);
7900
7968
  __decorate([
7901
- strokeType(1)
7969
+ strokeType(1, true)
7902
7970
  ], exports.UI.prototype, "strokeWidth", void 0);
7903
7971
  __decorate([
7904
7972
  strokeType(false)
@@ -7990,7 +8058,8 @@ var LeaferUI = (function (exports) {
7990
8058
  }
7991
8059
  toJSON(options) {
7992
8060
  const data = super.toJSON(options);
7993
- data.children = this.children.map(child => child.toJSON(options));
8061
+ if (!this.childlessJSON)
8062
+ data.children = this.children.map(child => child.toJSON(options));
7994
8063
  return data;
7995
8064
  }
7996
8065
  pick(_hitPoint, _options) { return undefined; }
@@ -8325,7 +8394,7 @@ var LeaferUI = (function (exports) {
8325
8394
  list.push(item);
8326
8395
  this.requestRender();
8327
8396
  }
8328
- zoom(_zoomType, _padding, _fixedScale, _transition) {
8397
+ zoom(_zoomType, _optionsOrPadding, _scroll, _transition) {
8329
8398
  return Plugin.need('view');
8330
8399
  }
8331
8400
  getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
@@ -8370,7 +8439,7 @@ var LeaferUI = (function (exports) {
8370
8439
  Leafer_1.list.remove(this);
8371
8440
  try {
8372
8441
  this.stop();
8373
- this.emitEvent(new LeaferEvent(LeaferEvent.END, this));
8442
+ this.emitLeafer(LeaferEvent.END);
8374
8443
  this.__removeListenEvents();
8375
8444
  this.__controllers.forEach(item => !(this.parent && item === this.interaction) && item.destroy());
8376
8445
  this.__controllers.length = 0;
@@ -8437,8 +8506,8 @@ var LeaferUI = (function (exports) {
8437
8506
  __updateRenderSpread() { return this.__updateRectRenderSpread() || -1; }
8438
8507
  __updateRectBoxBounds() { }
8439
8508
  __updateBoxBounds(_secondLayout) {
8440
- const data = this.__;
8441
8509
  if (this.children.length && !this.pathInputed) {
8510
+ const data = this.__;
8442
8511
  if (data.__autoSide) {
8443
8512
  if (data.__hasSurface)
8444
8513
  this.__extraUpdate();
@@ -8465,20 +8534,26 @@ var LeaferUI = (function (exports) {
8465
8534
  __updateStrokeBounds() { }
8466
8535
  __updateRenderBounds() {
8467
8536
  let isOverflow;
8468
- const { renderBounds } = this.__layout;
8469
8537
  if (this.children.length) {
8538
+ const data = this.__, { renderBounds, boxBounds } = this.__layout;
8470
8539
  super.__updateRenderBounds();
8471
8540
  copy$2(childrenRenderBounds, renderBounds);
8472
8541
  this.__updateRectRenderBounds();
8473
- isOverflow = !includes$1(renderBounds, childrenRenderBounds);
8474
- if (isOverflow && this.__.overflow !== 'hide')
8542
+ if (data.scrollY || data.scrollX) {
8543
+ childrenRenderBounds.x += data.scrollX;
8544
+ childrenRenderBounds.y += data.scrollY;
8545
+ }
8546
+ isOverflow = !includes$1(boxBounds, childrenRenderBounds);
8547
+ if (isOverflow && data.overflow !== 'hide')
8475
8548
  add(renderBounds, childrenRenderBounds);
8476
8549
  }
8477
8550
  else
8478
8551
  this.__updateRectRenderBounds();
8479
8552
  DataHelper.stintSet(this, 'isOverflow', isOverflow);
8553
+ this.__updateScrollBar();
8480
8554
  }
8481
8555
  __updateRectRenderBounds() { }
8556
+ __updateScrollBar() { }
8482
8557
  __updateRectChange() { }
8483
8558
  __updateChange() {
8484
8559
  super.__updateChange();
@@ -8495,10 +8570,12 @@ var LeaferUI = (function (exports) {
8495
8570
  if (this.children.length)
8496
8571
  this.__renderGroup(canvas, options);
8497
8572
  }
8573
+ if (this.scrollBar)
8574
+ this.scrollBar.__render(canvas, options);
8498
8575
  }
8499
8576
  __drawContent(canvas, options) {
8500
8577
  this.__renderGroup(canvas, options);
8501
- if (this.__.__hasStroke) {
8578
+ if (this.__.__useStroke || this.__.__useEffect) {
8502
8579
  canvas.setWorld(this.__nowWorld);
8503
8580
  this.__drawRenderPath(canvas);
8504
8581
  }
@@ -8718,8 +8795,8 @@ var LeaferUI = (function (exports) {
8718
8795
  for (let i = 1; i < sides; i++) {
8719
8796
  lineTo$1(path, rx + rx * sin$1((i * 2 * PI$1) / sides), ry - ry * cos$1((i * 2 * PI$1) / sides));
8720
8797
  }
8798
+ closePath$1(path);
8721
8799
  }
8722
- closePath$1(path);
8723
8800
  }
8724
8801
  __updateRenderPath() { }
8725
8802
  __updateBoxBounds() { }
@@ -8957,6 +9034,11 @@ var LeaferUI = (function (exports) {
8957
9034
  return;
8958
9035
  super.__draw(canvas, options, originCanvas);
8959
9036
  }
9037
+ __drawShape(canvas, options) {
9038
+ if (options.shape)
9039
+ this.__box && this.__box.__drawShape(canvas, options);
9040
+ super.__drawShape(canvas, options);
9041
+ }
8960
9042
  destroy() {
8961
9043
  if (this.boxStyle)
8962
9044
  this.boxStyle = null;
@@ -9152,9 +9234,14 @@ var LeaferUI = (function (exports) {
9152
9234
  }
9153
9235
  }
9154
9236
  canvas.fillStyle = item.style;
9155
- if (item.transform) {
9237
+ if (item.transform || item.scaleFixed) {
9156
9238
  canvas.save();
9157
- canvas.transform(item.transform);
9239
+ if (item.transform)
9240
+ canvas.transform(item.transform);
9241
+ if (item.scaleFixed) {
9242
+ const { scaleX, scaleY } = ui.getRenderScaleData(true);
9243
+ canvas.scale(1 / scaleX, 1 / scaleY);
9244
+ }
9158
9245
  if (item.blendMode)
9159
9246
  canvas.blendMode = item.blendMode;
9160
9247
  fillPathOrText(ui, canvas);
@@ -9190,8 +9277,13 @@ var LeaferUI = (function (exports) {
9190
9277
  }
9191
9278
  function drawCenter$1(stroke, strokeWidthScale, ui, canvas) {
9192
9279
  const data = ui.__;
9193
- canvas.setStroke(!data.__isStrokes && stroke, data.strokeWidth * strokeWidthScale, data);
9194
- data.__isStrokes ? drawStrokesStyle(stroke, true, ui, canvas) : drawTextStroke(ui, canvas);
9280
+ if (typeof stroke === 'object') {
9281
+ drawStrokesStyle(stroke, strokeWidthScale, true, ui, canvas);
9282
+ }
9283
+ else {
9284
+ canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
9285
+ drawTextStroke(ui, canvas);
9286
+ }
9195
9287
  }
9196
9288
  function drawAlign(stroke, align, ui, canvas) {
9197
9289
  const out = canvas.getSameCanvas(true, true);
@@ -9200,15 +9292,9 @@ var LeaferUI = (function (exports) {
9200
9292
  out.blendMode = align === 'outside' ? 'destination-out' : 'destination-in';
9201
9293
  fillText(ui, out);
9202
9294
  out.blendMode = 'normal';
9203
- copyWorld(canvas, out, ui);
9295
+ LeafHelper.copyCanvasByWorld(ui, canvas, out);
9204
9296
  out.recycle(ui.__nowWorld);
9205
9297
  }
9206
- function copyWorld(canvas, out, ui) {
9207
- if (ui.__worldFlipped || Platform.fullImageShadow)
9208
- canvas.copyWorldByReset(out, ui.__nowWorld);
9209
- else
9210
- canvas.copyWorldToInner(out, ui.__nowWorld, ui.__layout.renderBounds);
9211
- }
9212
9298
  function drawTextStroke(ui, canvas) {
9213
9299
  let row, data = ui.__.__textDrawData;
9214
9300
  const { rows, decorationY } = data;
@@ -9224,14 +9310,21 @@ var LeaferUI = (function (exports) {
9224
9310
  rows.forEach(row => decorationY.forEach(value => canvas.strokeRect(row.x, row.y + value, row.width, decorationHeight)));
9225
9311
  }
9226
9312
  }
9227
- function drawStrokesStyle(strokes, isText, ui, canvas) {
9313
+ function drawStrokesStyle(strokes, strokeWidthScale, isText, ui, canvas) {
9228
9314
  let item;
9315
+ const data = ui.__, { __hasMultiStrokeStyle } = data;
9316
+ __hasMultiStrokeStyle || canvas.setStroke(undefined, data.__strokeWidth * strokeWidthScale, data);
9229
9317
  for (let i = 0, len = strokes.length; i < len; i++) {
9230
9318
  item = strokes[i];
9231
9319
  if (item.image && PaintImage.checkImage(ui, canvas, item, false))
9232
9320
  continue;
9233
9321
  if (item.style) {
9234
- canvas.strokeStyle = item.style;
9322
+ if (__hasMultiStrokeStyle) {
9323
+ const { strokeStyle } = item;
9324
+ strokeStyle ? canvas.setStroke(item.style, data.__getRealStrokeWidth(strokeStyle) * strokeWidthScale, data, strokeStyle) : canvas.setStroke(item.style, data.__strokeWidth * strokeWidthScale, data);
9325
+ }
9326
+ else
9327
+ canvas.strokeStyle = item.style;
9235
9328
  if (item.blendMode) {
9236
9329
  canvas.saveBlendMode(item.blendMode);
9237
9330
  isText ? drawTextStroke(ui, canvas) : canvas.stroke();
@@ -9270,8 +9363,13 @@ var LeaferUI = (function (exports) {
9270
9363
  }
9271
9364
  function drawCenter(stroke, strokeWidthScale, ui, canvas) {
9272
9365
  const data = ui.__;
9273
- canvas.setStroke(!data.__isStrokes && stroke, data.__strokeWidth * strokeWidthScale, data);
9274
- data.__isStrokes ? drawStrokesStyle(stroke, false, ui, canvas) : canvas.stroke();
9366
+ if (typeof stroke === 'object') {
9367
+ drawStrokesStyle(stroke, strokeWidthScale, false, ui, canvas);
9368
+ }
9369
+ else {
9370
+ canvas.setStroke(stroke, data.__strokeWidth * strokeWidthScale, data);
9371
+ canvas.stroke();
9372
+ }
9275
9373
  if (data.__useArrow)
9276
9374
  Paint.strokeArrow(stroke, ui, canvas);
9277
9375
  }
@@ -9293,7 +9391,7 @@ var LeaferUI = (function (exports) {
9293
9391
  drawCenter(stroke, 2, ui, out);
9294
9392
  out.clipUI(data);
9295
9393
  out.clearWorld(renderBounds);
9296
- copyWorld(canvas, out, ui);
9394
+ LeafHelper.copyCanvasByWorld(ui, canvas, out);
9297
9395
  out.recycle(ui.__nowWorld);
9298
9396
  }
9299
9397
  }
@@ -9348,8 +9446,16 @@ var LeaferUI = (function (exports) {
9348
9446
  if (!(paints instanceof Array))
9349
9447
  paints = [paints];
9350
9448
  recycleMap = PaintImage.recycleImage(attrName, data);
9449
+ let maxChildStrokeWidth;
9351
9450
  for (let i = 0, len = paints.length, item; i < len; i++) {
9352
- (item = getLeafPaint(attrName, paints[i], ui)) && leafPaints.push(item);
9451
+ if (item = getLeafPaint(attrName, paints[i], ui)) {
9452
+ leafPaints.push(item);
9453
+ if (item.strokeStyle) {
9454
+ maxChildStrokeWidth || (maxChildStrokeWidth = 1);
9455
+ if (item.strokeStyle.strokeWidth)
9456
+ maxChildStrokeWidth = Math.max(maxChildStrokeWidth, item.strokeStyle.strokeWidth);
9457
+ }
9458
+ }
9353
9459
  }
9354
9460
  data['_' + attrName] = leafPaints.length ? leafPaints : undefined;
9355
9461
  if (leafPaints.length) {
@@ -9366,6 +9472,7 @@ var LeaferUI = (function (exports) {
9366
9472
  else {
9367
9473
  stintSet(data, '__isAlphaPixelStroke', isAlphaPixel);
9368
9474
  stintSet(data, '__isTransparentStroke', isTransparent);
9475
+ stintSet(data, '__hasMultiStrokeStyle', maxChildStrokeWidth);
9369
9476
  }
9370
9477
  }
9371
9478
  function getLeafPaint(attrName, paint, ui) {
@@ -9397,6 +9504,11 @@ var LeaferUI = (function (exports) {
9397
9504
  if (data) {
9398
9505
  if (typeof data.style === 'string' && hasTransparent$1(data.style))
9399
9506
  data.isTransparent = true;
9507
+ if (paint.style) {
9508
+ if (paint.style.strokeWidth === 0)
9509
+ return undefined;
9510
+ data.strokeStyle = paint.style;
9511
+ }
9400
9512
  if (paint.blendMode)
9401
9513
  data.blendMode = paint.blendMode;
9402
9514
  }
@@ -9416,8 +9528,8 @@ var LeaferUI = (function (exports) {
9416
9528
  shape
9417
9529
  };
9418
9530
 
9419
- let origin = {};
9420
- const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, scale: scaleHelper, rotate } = MatrixHelper;
9531
+ let origin = {}, tempMatrix = getMatrixData();
9532
+ const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, multiplyParent, scale: scaleHelper, rotate, skew: skewHelper } = MatrixHelper;
9421
9533
  function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
9422
9534
  const transform = get$3();
9423
9535
  translate$1(transform, box.x + x, box.y + y);
@@ -9426,13 +9538,19 @@ var LeaferUI = (function (exports) {
9426
9538
  rotateOfOuter$1(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
9427
9539
  data.transform = transform;
9428
9540
  }
9429
- function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
9541
+ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew, clipSize) {
9430
9542
  const transform = get$3();
9431
- translate$1(transform, box.x + x, box.y + y);
9432
- if (scaleX)
9433
- scaleHelper(transform, scaleX, scaleY);
9434
9543
  if (rotation)
9435
9544
  rotate(transform, rotation);
9545
+ if (skew)
9546
+ skewHelper(transform, skew.x, skew.y);
9547
+ if (scaleX)
9548
+ scaleHelper(transform, scaleX, scaleY);
9549
+ translate$1(transform, box.x + x, box.y + y);
9550
+ if (clipSize) {
9551
+ tempMatrix.a = box.width / clipSize.width, tempMatrix.d = box.height / clipSize.height;
9552
+ multiplyParent(transform, tempMatrix);
9553
+ }
9436
9554
  data.transform = transform;
9437
9555
  }
9438
9556
  function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
@@ -9469,11 +9587,15 @@ var LeaferUI = (function (exports) {
9469
9587
  const tempScaleData = {};
9470
9588
  const tempImage = {};
9471
9589
  function createData(leafPaint, image, paint, box) {
9472
- const { changeful, sync } = paint;
9590
+ const { changeful, sync, editing, scaleFixed } = paint;
9473
9591
  if (changeful)
9474
9592
  leafPaint.changeful = changeful;
9475
9593
  if (sync)
9476
9594
  leafPaint.sync = sync;
9595
+ if (editing)
9596
+ leafPaint.editing = editing;
9597
+ if (scaleFixed)
9598
+ leafPaint.scaleFixed = scaleFixed;
9477
9599
  leafPaint.data = getPatternData(paint, box, image);
9478
9600
  }
9479
9601
  function getPatternData(paint, box, image) {
@@ -9482,7 +9604,7 @@ var LeaferUI = (function (exports) {
9482
9604
  if (paint.mode === 'strench')
9483
9605
  paint.mode = 'stretch';
9484
9606
  let { width, height } = image;
9485
- const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
9607
+ const { opacity, mode, align, offset, scale, size, rotation, skew, clipSize, repeat, filters } = paint;
9486
9608
  const sameBox = box.width === width && box.height === height;
9487
9609
  const data = { mode };
9488
9610
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
@@ -9516,8 +9638,8 @@ var LeaferUI = (function (exports) {
9516
9638
  break;
9517
9639
  case 'normal':
9518
9640
  case 'clip':
9519
- if (tempImage.x || tempImage.y || scaleX || rotation)
9520
- clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
9641
+ if (tempImage.x || tempImage.y || scaleX || clipSize || rotation || skew)
9642
+ clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew, paint.clipSize);
9521
9643
  break;
9522
9644
  case 'repeat':
9523
9645
  if (!sameBox || scaleX || rotation)
@@ -9594,11 +9716,11 @@ var LeaferUI = (function (exports) {
9594
9716
  }
9595
9717
  onLoadSuccess(ui, event);
9596
9718
  }
9597
- leafPaint.loadId = null;
9719
+ leafPaint.loadId = undefined;
9598
9720
  }, (error) => {
9599
9721
  ignoreRender(ui, false);
9600
9722
  onLoadError(ui, event, error);
9601
- leafPaint.loadId = null;
9723
+ leafPaint.loadId = undefined;
9602
9724
  });
9603
9725
  if (ui.placeholderColor) {
9604
9726
  if (!ui.placeholderDelay)
@@ -9654,16 +9776,16 @@ var LeaferUI = (function (exports) {
9654
9776
  }
9655
9777
 
9656
9778
  const { get: get$1, scale, copy: copy$1 } = MatrixHelper;
9657
- const { ceil, abs: abs$1 } = Math;
9779
+ const { ceil, abs } = Math;
9658
9780
  function createPattern(ui, paint, pixelRatio) {
9659
- let { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
9781
+ let { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
9660
9782
  const id = scaleX + '-' + scaleY + '-' + pixelRatio;
9661
9783
  if (paint.patternId !== id && !ui.destroyed) {
9662
- scaleX = abs$1(scaleX);
9663
- scaleY = abs$1(scaleY);
9664
9784
  const { image, data } = paint;
9665
9785
  let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
9666
9786
  if (sx) {
9787
+ sx = abs(sx);
9788
+ sy = abs(sy);
9667
9789
  imageMatrix = get$1();
9668
9790
  copy$1(imageMatrix, transform);
9669
9791
  scale(imageMatrix, 1 / sx, 1 / sy);
@@ -9716,9 +9838,8 @@ var LeaferUI = (function (exports) {
9716
9838
  }
9717
9839
  }
9718
9840
 
9719
- const { abs } = Math;
9720
9841
  function checkImage(ui, canvas, paint, allowDraw) {
9721
- const { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
9842
+ const { scaleX, scaleY } = ui.getRenderScaleData(true, paint.scaleFixed);
9722
9843
  const { pixelRatio } = canvas, { data } = paint;
9723
9844
  if (!data || (paint.patternId === scaleX + '-' + scaleY + '-' + pixelRatio && !Export.running)) {
9724
9845
  return false;
@@ -9731,8 +9852,8 @@ var LeaferUI = (function (exports) {
9731
9852
  else {
9732
9853
  if (!(paint.changeful || ResizeEvent.isResizing(ui) || Export.running)) {
9733
9854
  let { width, height } = data;
9734
- width *= abs(scaleX) * pixelRatio;
9735
- height *= abs(scaleY) * pixelRatio;
9855
+ width *= scaleX * pixelRatio;
9856
+ height *= scaleY * pixelRatio;
9736
9857
  if (data.scaleX) {
9737
9858
  width *= data.scaleX;
9738
9859
  height *= data.scaleY;
@@ -9742,6 +9863,10 @@ var LeaferUI = (function (exports) {
9742
9863
  }
9743
9864
  }
9744
9865
  if (allowDraw) {
9866
+ if (ui.__.__isFastShadow) {
9867
+ canvas.fillStyle = paint.style || '#000';
9868
+ canvas.fill();
9869
+ }
9745
9870
  drawImage(ui, canvas, paint, data);
9746
9871
  return true;
9747
9872
  }
@@ -9930,10 +10055,7 @@ var LeaferUI = (function (exports) {
9930
10055
  }
9931
10056
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, 'destination-out') : other.copyWorld(shape.canvas, shapeBounds, bounds, 'destination-out');
9932
10057
  }
9933
- if (ui.__worldFlipped)
9934
- current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
9935
- else
9936
- current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
10058
+ LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
9937
10059
  if (end && index < end)
9938
10060
  other.clearWorld(copyBounds, true);
9939
10061
  });
@@ -9992,10 +10114,7 @@ var LeaferUI = (function (exports) {
9992
10114
  copyBounds = bounds;
9993
10115
  }
9994
10116
  other.fillWorld(copyBounds, ColorConvert.string(item.color), 'source-in');
9995
- if (ui.__worldFlipped)
9996
- current.copyWorldByReset(other, copyBounds, nowWorld, item.blendMode);
9997
- else
9998
- current.copyWorldToInner(other, copyBounds, __layout.renderBounds, item.blendMode);
10117
+ LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
9999
10118
  if (end && index < end)
10000
10119
  other.clearWorld(copyBounds, true);
10001
10120
  });
@@ -10051,12 +10170,11 @@ var LeaferUI = (function (exports) {
10051
10170
  contentCanvas = getCanvas(canvas);
10052
10171
  child.__render(maskCanvas, options);
10053
10172
  }
10054
- if (!(mask === 'clipping' || mask === 'clipping-path'))
10055
- continue;
10056
- }
10057
- if (excludeRenderBounds(child, options))
10173
+ if (mask === 'clipping' || mask === 'clipping-path')
10174
+ excludeRenderBounds(child, options) || child.__render(canvas, options);
10058
10175
  continue;
10059
- child.__render(contentCanvas || canvas, options);
10176
+ }
10177
+ excludeRenderBounds(child, options) || child.__render(contentCanvas || canvas, options);
10060
10178
  }
10061
10179
  maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
10062
10180
  };
@@ -10751,6 +10869,8 @@ var LeaferUI = (function (exports) {
10751
10869
  exports.boundsType = boundsType;
10752
10870
  exports.canvasPatch = canvasPatch;
10753
10871
  exports.canvasSizeAttrs = canvasSizeAttrs;
10872
+ exports.createAttr = createAttr;
10873
+ exports.createDescriptor = createDescriptor;
10754
10874
  exports.cursorType = cursorType;
10755
10875
  exports.dataProcessor = dataProcessor;
10756
10876
  exports.dataType = dataType;
@@ -10789,7 +10909,7 @@ var LeaferUI = (function (exports) {
10789
10909
  exports.strokeType = strokeType;
10790
10910
  exports.surfaceType = surfaceType;
10791
10911
  exports.tempBounds = tempBounds$1;
10792
- exports.tempMatrix = tempMatrix;
10912
+ exports.tempMatrix = tempMatrix$1;
10793
10913
  exports.tempPoint = tempPoint$2;
10794
10914
  exports.useCanvas = useCanvas;
10795
10915
  exports.useModule = useModule;