leafer-ui 1.6.7 → 1.7.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$2 = 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$4, sqrt: sqrt$2, atan2: atan2$2, min: min$1, round: round$2 } = Math;
443
443
  const PointHelper = {
444
444
  defaultPoint: getPointData(),
445
445
  tempPoint: {},
@@ -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);
@@ -3342,7 +3343,7 @@ var LeaferUI = (function (exports) {
3342
3343
  const { arcTo } = PathCommandDataHelper;
3343
3344
  const PathCorner = {
3344
3345
  smooth(data, cornerRadius, _cornerSmoothing) {
3345
- let command, commandLen;
3346
+ let command, lastCommand, commandLen;
3346
3347
  let i = 0, x = 0, y = 0, startX = 0, startY = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0;
3347
3348
  const len = data.length;
3348
3349
  const smooth = [];
@@ -3380,8 +3381,10 @@ var LeaferUI = (function (exports) {
3380
3381
  lastY = y;
3381
3382
  break;
3382
3383
  case Z:
3383
- arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY);
3384
- smooth.push(Z);
3384
+ if (lastCommand !== Z) {
3385
+ arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY);
3386
+ smooth.push(Z);
3387
+ }
3385
3388
  i += 1;
3386
3389
  break;
3387
3390
  default:
@@ -3390,6 +3393,7 @@ var LeaferUI = (function (exports) {
3390
3393
  smooth.push(data[i + j]);
3391
3394
  i += commandLen;
3392
3395
  }
3396
+ lastCommand = command;
3393
3397
  }
3394
3398
  if (command !== Z) {
3395
3399
  smooth[1] = startX;
@@ -3886,12 +3890,12 @@ var LeaferUI = (function (exports) {
3886
3890
  try {
3887
3891
  if (transform && pattern.setTransform) {
3888
3892
  pattern.setTransform(transform);
3889
- transform = null;
3893
+ transform = undefined;
3890
3894
  }
3891
3895
  }
3892
3896
  catch (_a) { }
3893
3897
  if (paint)
3894
- paint.transform = transform;
3898
+ DataHelper.stintSet(paint, 'transform', transform);
3895
3899
  return pattern;
3896
3900
  }
3897
3901
  destroy() {
@@ -3996,10 +4000,14 @@ var LeaferUI = (function (exports) {
3996
4000
  }));
3997
4001
  }
3998
4002
  const pathType = boundsType;
3999
- function affectStrokeBoundsType(defaultValue) {
4003
+ function affectStrokeBoundsType(defaultValue, useStroke) {
4000
4004
  return decorateLeafAttr(defaultValue, (key) => attr({
4001
4005
  set(value) {
4002
- this.__setAttr(key, value) && doStrokeType(this);
4006
+ if (this.__setAttr(key, value)) {
4007
+ doStrokeType(this);
4008
+ if (useStroke)
4009
+ this.__.__useStroke = true;
4010
+ }
4003
4011
  }
4004
4012
  }));
4005
4013
  }
@@ -5425,6 +5433,8 @@ var LeaferUI = (function (exports) {
5425
5433
 
5426
5434
  const LeafRender = {
5427
5435
  __render(canvas, options) {
5436
+ if (options.shape)
5437
+ return this.__renderShape(canvas, options);
5428
5438
  if (this.__worldOpacity) {
5429
5439
  const data = this.__;
5430
5440
  canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
@@ -5434,12 +5444,10 @@ var LeaferUI = (function (exports) {
5434
5444
  return this.__renderEraser(canvas, options);
5435
5445
  const tempCanvas = canvas.getSameCanvas(true, true);
5436
5446
  this.__draw(tempCanvas, options, canvas);
5437
- if (this.__worldFlipped) {
5447
+ if (this.__worldFlipped)
5438
5448
  canvas.copyWorldByReset(tempCanvas, this.__nowWorld, null, data.__blendMode, true);
5439
- }
5440
- else {
5449
+ else
5441
5450
  canvas.copyWorldToInner(tempCanvas, this.__nowWorld, this.__layout.renderBounds, data.__blendMode);
5442
- }
5443
5451
  tempCanvas.recycle(this.__nowWorld);
5444
5452
  }
5445
5453
  else {
@@ -5449,6 +5457,12 @@ var LeaferUI = (function (exports) {
5449
5457
  Debug.drawBounds(this, canvas, options);
5450
5458
  }
5451
5459
  },
5460
+ __renderShape(canvas, options) {
5461
+ if (this.__worldOpacity) {
5462
+ canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
5463
+ this.__drawShape(canvas, options);
5464
+ }
5465
+ },
5452
5466
  __clip(canvas, options) {
5453
5467
  if (this.__worldOpacity) {
5454
5468
  canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
@@ -5868,7 +5882,8 @@ var LeaferUI = (function (exports) {
5868
5882
  __drawFast(_canvas, _options) { }
5869
5883
  __draw(_canvas, _options, _originCanvas) { }
5870
5884
  __clip(_canvas, _options) { }
5871
- __renderShape(_canvas, _options, _ignoreFill, _ignoreStroke) { }
5885
+ __renderShape(_canvas, _options) { }
5886
+ __drawShape(_canvas, _options) { }
5872
5887
  __updateWorldOpacity() { }
5873
5888
  __updateChange() { }
5874
5889
  __drawPath(_canvas) { }
@@ -6236,7 +6251,7 @@ var LeaferUI = (function (exports) {
6236
6251
  }
6237
6252
  }
6238
6253
 
6239
- const version = "1.6.7";
6254
+ const version = "1.7.0";
6240
6255
 
6241
6256
  const debug$5 = Debug.get('LeaferCanvas');
6242
6257
  class LeaferCanvas extends LeaferCanvasBase {
@@ -7334,13 +7349,9 @@ var LeaferUI = (function (exports) {
7334
7349
  else
7335
7350
  return strokeWidth;
7336
7351
  }
7337
- get __hasStroke() { return this.stroke && this.strokeWidth; }
7338
- get __hasHalf() { const t = this; return (t.stroke && t.strokeAlign === 'center' && t.strokeWidth % 2) || undefined; }
7339
7352
  get __hasMultiPaint() {
7340
7353
  const t = this;
7341
- if ((t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect)
7342
- return true;
7343
- return t.fill && this.__hasStroke;
7354
+ return (t.fill && this.__useStroke) || (t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect;
7344
7355
  }
7345
7356
  get __clipAfterFill() { const t = this; return (t.cornerRadius || t.innerShadow || t.__pathInputed); }
7346
7357
  get __hasSurface() { const t = this; return (t.fill || t.stroke); }
@@ -7631,15 +7642,18 @@ var LeaferUI = (function (exports) {
7631
7642
  const UIRender = {
7632
7643
  __updateChange() {
7633
7644
  const data = this.__;
7645
+ if (data.__useStroke) {
7646
+ const useStroke = data.__useStroke = !!(data.stroke && data.strokeWidth);
7647
+ stintSet$1(this.__world, 'half', useStroke && data.strokeAlign === 'center' && data.strokeWidth % 2);
7648
+ stintSet$1(data, '__fillAfterStroke', useStroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
7649
+ }
7634
7650
  if (data.__useEffect) {
7635
7651
  const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
7636
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')));
7637
7653
  data.__useEffect = !!(shadow || otherEffect);
7638
7654
  }
7639
- stintSet$1(this.__world, 'half', data.__hasHalf);
7640
- stintSet$1(data, '__fillAfterStroke', data.stroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
7641
7655
  data.__checkSingle();
7642
- stintSet$1(data, '__complex', data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
7656
+ stintSet$1(data, '__complex', (data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect));
7643
7657
  },
7644
7658
  __drawFast(canvas, options) {
7645
7659
  drawFast(this, canvas, options);
@@ -7697,18 +7711,15 @@ var LeaferUI = (function (exports) {
7697
7711
  this.__drawFast(canvas, options);
7698
7712
  }
7699
7713
  },
7700
- __renderShape(canvas, options, ignoreFill, ignoreStroke) {
7701
- if (this.__worldOpacity) {
7702
- canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
7703
- const { fill, stroke } = this.__;
7704
- this.__drawRenderPath(canvas);
7705
- if (fill && !ignoreFill)
7706
- this.__.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
7707
- if (this.__.__isCanvas)
7708
- this.__drawAfterFill(canvas, options);
7709
- if (stroke && !ignoreStroke)
7710
- this.__.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
7711
- }
7714
+ __drawShape(canvas, options) {
7715
+ this.__drawRenderPath(canvas);
7716
+ const data = this.__, { fill, stroke } = data;
7717
+ if (fill && !options.ignoreFill)
7718
+ data.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
7719
+ if (data.__isCanvas)
7720
+ this.__drawAfterFill(canvas, options);
7721
+ if (stroke && !options.ignoreStroke)
7722
+ data.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
7712
7723
  },
7713
7724
  __drawAfterFill(canvas, options) {
7714
7725
  if (this.__.__clipAfterFill) {
@@ -7833,12 +7844,14 @@ var LeaferUI = (function (exports) {
7833
7844
  }
7834
7845
  }
7835
7846
  __updateRenderPath() {
7836
- if (this.__.path) {
7837
- const data = this.__;
7847
+ const data = this.__;
7848
+ if (data.path) {
7838
7849
  data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
7839
7850
  if (data.__useArrow)
7840
7851
  PathArrow.addArrows(this, !data.cornerRadius);
7841
7852
  }
7853
+ else
7854
+ data.__pathForRender && (data.__pathForRender = undefined);
7842
7855
  }
7843
7856
  __drawRenderPath(canvas) {
7844
7857
  canvas.beginPath();
@@ -8049,13 +8062,13 @@ var LeaferUI = (function (exports) {
8049
8062
  surfaceType()
8050
8063
  ], exports.UI.prototype, "fill", void 0);
8051
8064
  __decorate([
8052
- strokeType()
8065
+ strokeType(undefined, true)
8053
8066
  ], exports.UI.prototype, "stroke", void 0);
8054
8067
  __decorate([
8055
8068
  strokeType('inside')
8056
8069
  ], exports.UI.prototype, "strokeAlign", void 0);
8057
8070
  __decorate([
8058
- strokeType(1)
8071
+ strokeType(1, true)
8059
8072
  ], exports.UI.prototype, "strokeWidth", void 0);
8060
8073
  __decorate([
8061
8074
  strokeType(false)
@@ -8482,7 +8495,7 @@ var LeaferUI = (function (exports) {
8482
8495
  list.push(item);
8483
8496
  this.requestRender();
8484
8497
  }
8485
- zoom(_zoomType, _padding, _fixedScale, _transition) {
8498
+ zoom(_zoomType, _optionsOrPadding, _scroll, _transition) {
8486
8499
  return Plugin.need('view');
8487
8500
  }
8488
8501
  getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
@@ -8527,7 +8540,7 @@ var LeaferUI = (function (exports) {
8527
8540
  Leafer_1.list.remove(this);
8528
8541
  try {
8529
8542
  this.stop();
8530
- this.emitEvent(new LeaferEvent(LeaferEvent.END, this));
8543
+ this.emitLeafer(LeaferEvent.END);
8531
8544
  this.__removeListenEvents();
8532
8545
  this.__controllers.forEach(item => !(this.parent && item === this.interaction) && item.destroy());
8533
8546
  this.__controllers.length = 0;
@@ -8655,7 +8668,7 @@ var LeaferUI = (function (exports) {
8655
8668
  }
8656
8669
  __drawContent(canvas, options) {
8657
8670
  this.__renderGroup(canvas, options);
8658
- if (this.__.__hasStroke) {
8671
+ if (this.__.__useStroke) {
8659
8672
  canvas.setWorld(this.__nowWorld);
8660
8673
  this.__drawRenderPath(canvas);
8661
8674
  }
@@ -8875,8 +8888,8 @@ var LeaferUI = (function (exports) {
8875
8888
  for (let i = 1; i < sides; i++) {
8876
8889
  lineTo$1(path, rx + rx * sin$1((i * 2 * PI$1) / sides), ry - ry * cos$1((i * 2 * PI$1) / sides));
8877
8890
  }
8891
+ closePath$1(path);
8878
8892
  }
8879
- closePath$1(path);
8880
8893
  }
8881
8894
  __updateRenderPath() { }
8882
8895
  __updateBoxBounds() { }
@@ -9114,6 +9127,11 @@ var LeaferUI = (function (exports) {
9114
9127
  return;
9115
9128
  super.__draw(canvas, options, originCanvas);
9116
9129
  }
9130
+ __drawShape(canvas, options) {
9131
+ if (options.shape)
9132
+ this.__box && this.__box.__drawShape(canvas, options);
9133
+ super.__drawShape(canvas, options);
9134
+ }
9117
9135
  destroy() {
9118
9136
  if (this.boxStyle)
9119
9137
  this.boxStyle = null;
@@ -9935,6 +9953,7 @@ var LeaferUI = (function (exports) {
9935
9953
  delta: { x: 80 / 4, y: 8.0 },
9936
9954
  },
9937
9955
  pointer: {
9956
+ type: 'pointer',
9938
9957
  snap: true,
9939
9958
  hitRadius: 5,
9940
9959
  tapTime: 120,
@@ -10478,7 +10497,7 @@ var LeaferUI = (function (exports) {
10478
10497
  h.resize({ width, height, pixelRatio: 1 });
10479
10498
  h.clear();
10480
10499
  ImageManager.patternLocked = true;
10481
- this.__renderShape(h, { matrix: matrix.setWith(this.__world).scaleWith(1 / scale).invertWith().translate(-x, -y) }, !isHitPixelFill, !isHitPixelStroke);
10500
+ this.__renderShape(h, { matrix: matrix.setWith(this.__world).scaleWith(1 / scale).invertWith().translate(-x, -y), ignoreFill: !isHitPixelFill, ignoreStroke: !isHitPixelStroke });
10482
10501
  ImageManager.patternLocked = false;
10483
10502
  h.resetTransform();
10484
10503
  data.__isHitPixel = true;
@@ -10615,6 +10634,9 @@ var LeaferUI = (function (exports) {
10615
10634
 
10616
10635
  const { pathCanDrag } = InteractionHelper;
10617
10636
  class Interaction extends InteractionBase {
10637
+ get notPointer() { const { p } = this; return p.type !== 'pointer' || p.touch || this.useMultiTouch; }
10638
+ get notTouch() { const { p } = this; return p.type === 'mouse' || this.usePointer; }
10639
+ get notMouse() { return this.usePointer || this.useTouch; }
10618
10640
  __listenEvents() {
10619
10641
  super.__listenEvents();
10620
10642
  const view = this.view = this.canvas.view;
@@ -10700,13 +10722,13 @@ var LeaferUI = (function (exports) {
10700
10722
  }
10701
10723
  onPointerDown(e) {
10702
10724
  this.preventDefaultPointer(e);
10703
- if (this.config.pointer.touch || this.useMultiTouch)
10725
+ if (this.notPointer)
10704
10726
  return;
10705
10727
  this.usePointer || (this.usePointer = true);
10706
10728
  this.pointerDown(PointerEventHelper.convert(e, this.getLocal(e)));
10707
10729
  }
10708
10730
  onPointerMove(e, isLeave) {
10709
- if (this.config.pointer.touch || this.useMultiTouch || this.preventWindowPointer(e))
10731
+ if (this.notPointer || this.preventWindowPointer(e))
10710
10732
  return;
10711
10733
  this.usePointer || (this.usePointer = true);
10712
10734
  const data = PointerEventHelper.convert(e, this.getLocal(e, true));
@@ -10718,7 +10740,7 @@ var LeaferUI = (function (exports) {
10718
10740
  onPointerUp(e) {
10719
10741
  if (this.downData)
10720
10742
  this.preventDefaultPointer(e);
10721
- if (this.config.pointer.touch || this.useMultiTouch || this.preventWindowPointer(e))
10743
+ if (this.notPointer || this.preventWindowPointer(e))
10722
10744
  return;
10723
10745
  this.pointerUp(PointerEventHelper.convert(e, this.getLocal(e)));
10724
10746
  }
@@ -10729,24 +10751,24 @@ var LeaferUI = (function (exports) {
10729
10751
  }
10730
10752
  onMouseDown(e) {
10731
10753
  this.preventDefaultPointer(e);
10732
- if (this.useTouch || this.usePointer)
10754
+ if (this.notMouse)
10733
10755
  return;
10734
10756
  this.pointerDown(PointerEventHelper.convertMouse(e, this.getLocal(e)));
10735
10757
  }
10736
10758
  onMouseMove(e) {
10737
- if (this.useTouch || this.usePointer || this.preventWindowPointer(e))
10759
+ if (this.notMouse || this.preventWindowPointer(e))
10738
10760
  return;
10739
10761
  this.pointerMove(PointerEventHelper.convertMouse(e, this.getLocal(e, true)));
10740
10762
  }
10741
10763
  onMouseUp(e) {
10742
10764
  if (this.downData)
10743
10765
  this.preventDefaultPointer(e);
10744
- if (this.useTouch || this.usePointer || this.preventWindowPointer(e))
10766
+ if (this.notMouse || this.preventWindowPointer(e))
10745
10767
  return;
10746
10768
  this.pointerUp(PointerEventHelper.convertMouse(e, this.getLocal(e)));
10747
10769
  }
10748
10770
  onMouseCancel() {
10749
- if (this.useTouch || this.usePointer)
10771
+ if (this.notMouse)
10750
10772
  return;
10751
10773
  this.pointerCancel();
10752
10774
  }
@@ -10757,7 +10779,7 @@ var LeaferUI = (function (exports) {
10757
10779
  if (preventDefault === true || (preventDefault === 'auto' && pathCanDrag(this.findPath(local))))
10758
10780
  e.preventDefault();
10759
10781
  this.multiTouchStart(e);
10760
- if (this.usePointer)
10782
+ if (this.notTouch)
10761
10783
  return;
10762
10784
  if (this.touchTimer) {
10763
10785
  window.clearTimeout(this.touchTimer);
@@ -10768,14 +10790,14 @@ var LeaferUI = (function (exports) {
10768
10790
  }
10769
10791
  onTouchMove(e) {
10770
10792
  this.multiTouchMove(e);
10771
- if (this.usePointer || this.preventWindowPointer(e))
10793
+ if (this.notTouch || this.preventWindowPointer(e))
10772
10794
  return;
10773
10795
  const touch = PointerEventHelper.getTouch(e);
10774
10796
  this.pointerMove(PointerEventHelper.convertTouch(e, this.getLocal(touch)));
10775
10797
  }
10776
10798
  onTouchEnd(e) {
10777
10799
  this.multiTouchEnd();
10778
- if (this.usePointer || this.preventWindowPointer(e))
10800
+ if (this.notTouch || this.preventWindowPointer(e))
10779
10801
  return;
10780
10802
  if (this.touchTimer)
10781
10803
  clearTimeout(this.touchTimer);
@@ -10786,7 +10808,7 @@ var LeaferUI = (function (exports) {
10786
10808
  this.pointerUp(PointerEventHelper.convertTouch(e, this.getLocal(touch)));
10787
10809
  }
10788
10810
  onTouchCancel() {
10789
- if (this.usePointer)
10811
+ if (this.notTouch)
10790
10812
  return;
10791
10813
  this.pointerCancel();
10792
10814
  }
@@ -11191,7 +11213,7 @@ var LeaferUI = (function (exports) {
11191
11213
  };
11192
11214
 
11193
11215
  let origin = {};
11194
- const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, scale: scaleHelper, rotate } = MatrixHelper;
11216
+ const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, scale: scaleHelper, rotate, skew: skewHelper } = MatrixHelper;
11195
11217
  function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
11196
11218
  const transform = get$3();
11197
11219
  translate$1(transform, box.x + x, box.y + y);
@@ -11200,13 +11222,15 @@ var LeaferUI = (function (exports) {
11200
11222
  rotateOfOuter$1(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
11201
11223
  data.transform = transform;
11202
11224
  }
11203
- function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
11225
+ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew) {
11204
11226
  const transform = get$3();
11205
- translate$1(transform, box.x + x, box.y + y);
11206
- if (scaleX)
11207
- scaleHelper(transform, scaleX, scaleY);
11208
11227
  if (rotation)
11209
11228
  rotate(transform, rotation);
11229
+ if (skew)
11230
+ skewHelper(transform, skew.x, skew.y);
11231
+ if (scaleX)
11232
+ scaleHelper(transform, scaleX, scaleY);
11233
+ translate$1(transform, box.x + x, box.y + y);
11210
11234
  data.transform = transform;
11211
11235
  }
11212
11236
  function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
@@ -11243,11 +11267,13 @@ var LeaferUI = (function (exports) {
11243
11267
  const tempScaleData = {};
11244
11268
  const tempImage = {};
11245
11269
  function createData(leafPaint, image, paint, box) {
11246
- const { changeful, sync } = paint;
11270
+ const { changeful, sync, editing } = paint;
11247
11271
  if (changeful)
11248
11272
  leafPaint.changeful = changeful;
11249
11273
  if (sync)
11250
11274
  leafPaint.sync = sync;
11275
+ if (editing)
11276
+ leafPaint.editing = editing;
11251
11277
  leafPaint.data = getPatternData(paint, box, image);
11252
11278
  }
11253
11279
  function getPatternData(paint, box, image) {
@@ -11256,7 +11282,7 @@ var LeaferUI = (function (exports) {
11256
11282
  if (paint.mode === 'strench')
11257
11283
  paint.mode = 'stretch';
11258
11284
  let { width, height } = image;
11259
- const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
11285
+ const { opacity, mode, align, offset, scale, size, rotation, skew, repeat, filters } = paint;
11260
11286
  const sameBox = box.width === width && box.height === height;
11261
11287
  const data = { mode };
11262
11288
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
@@ -11290,8 +11316,8 @@ var LeaferUI = (function (exports) {
11290
11316
  break;
11291
11317
  case 'normal':
11292
11318
  case 'clip':
11293
- if (tempImage.x || tempImage.y || scaleX || rotation)
11294
- clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
11319
+ if (tempImage.x || tempImage.y || scaleX || rotation || skew)
11320
+ clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew);
11295
11321
  break;
11296
11322
  case 'repeat':
11297
11323
  if (!sameBox || scaleX || rotation)
@@ -11368,11 +11394,11 @@ var LeaferUI = (function (exports) {
11368
11394
  }
11369
11395
  onLoadSuccess(ui, event);
11370
11396
  }
11371
- leafPaint.loadId = null;
11397
+ leafPaint.loadId = undefined;
11372
11398
  }, (error) => {
11373
11399
  ignoreRender(ui, false);
11374
11400
  onLoadError(ui, event, error);
11375
- leafPaint.loadId = null;
11401
+ leafPaint.loadId = undefined;
11376
11402
  });
11377
11403
  if (ui.placeholderColor) {
11378
11404
  if (!ui.placeholderDelay)
@@ -11438,6 +11464,8 @@ var LeaferUI = (function (exports) {
11438
11464
  const { image, data } = paint;
11439
11465
  let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
11440
11466
  if (sx) {
11467
+ sx = abs$1(sx);
11468
+ sy = abs$1(sy);
11441
11469
  imageMatrix = get$1();
11442
11470
  copy$1(imageMatrix, transform);
11443
11471
  scale(imageMatrix, 1 / sx, 1 / sy);