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.
@@ -43,7 +43,7 @@ const IncrementId = {
43
43
  };
44
44
  const I$2 = IncrementId;
45
45
 
46
- const { round: round$3, pow: pow$1, PI: PI$4 } = Math;
46
+ const { round: round$3, pow: pow$1, PI: PI$3 } = Math;
47
47
  const MathHelper = {
48
48
  within(value, min, max) {
49
49
  if (typeof min === 'object')
@@ -139,9 +139,9 @@ const MathHelper = {
139
139
  function randInt(num) {
140
140
  return Math.round(Math.random() * num);
141
141
  }
142
- const OneRadian = PI$4 / 180;
143
- const PI2 = PI$4 * 2;
144
- const PI_2 = PI$4 / 2;
142
+ const OneRadian = PI$3 / 180;
143
+ const PI2 = PI$3 * 2;
144
+ const PI_2 = PI$3 / 2;
145
145
  function getPointData() { return { x: 0, y: 0 }; }
146
146
  function getBoundsData() { return { x: 0, y: 0, width: 0, height: 0 }; }
147
147
  function getMatrixData() { return { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 }; }
@@ -436,7 +436,7 @@ const MatrixHelper = {
436
436
  const M$6 = MatrixHelper;
437
437
 
438
438
  const { toInnerPoint: toInnerPoint$2, toOuterPoint: toOuterPoint$3 } = MatrixHelper;
439
- const { sin: sin$4, cos: cos$4, abs: abs$4, sqrt: sqrt$2, atan2: atan2$2, min: min$1, round: round$2, PI: PI$3 } = Math;
439
+ const { sin: sin$4, cos: cos$4, abs: abs$4, sqrt: sqrt$2, atan2: atan2$2, min: min$1, round: round$2 } = Math;
440
440
  const PointHelper = {
441
441
  defaultPoint: getPointData(),
442
442
  tempPoint: {},
@@ -549,10 +549,11 @@ const PointHelper = {
549
549
  getRadianFrom(fromX, fromY, originX, originY, toX, toY, toOriginX, toOriginY) {
550
550
  if (toOriginX === undefined)
551
551
  toOriginX = originX, toOriginY = originY;
552
- let fromAngle = atan2$2(fromY - originY, fromX - originX);
553
- let toAngle = atan2$2(toY - toOriginY, toX - toOriginX);
554
- const radian = toAngle - fromAngle;
555
- return radian < -PI$3 ? radian + PI2 : radian;
552
+ const a = fromX - originX;
553
+ const b = fromY - originY;
554
+ const c = toX - toOriginX;
555
+ const d = toY - toOriginY;
556
+ return Math.atan2(a * d - b * c, a * c + b * d);
556
557
  },
557
558
  getAtan2(t, to) {
558
559
  return atan2$2(to.y - t.y, to.x - t.x);
@@ -3339,7 +3340,7 @@ const { getCenterX, getCenterY } = PointHelper;
3339
3340
  const { arcTo } = PathCommandDataHelper;
3340
3341
  const PathCorner = {
3341
3342
  smooth(data, cornerRadius, _cornerSmoothing) {
3342
- let command, commandLen;
3343
+ let command, lastCommand, commandLen;
3343
3344
  let i = 0, x = 0, y = 0, startX = 0, startY = 0, secondX = 0, secondY = 0, lastX = 0, lastY = 0;
3344
3345
  const len = data.length;
3345
3346
  const smooth = [];
@@ -3377,8 +3378,10 @@ const PathCorner = {
3377
3378
  lastY = y;
3378
3379
  break;
3379
3380
  case Z:
3380
- arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY);
3381
- smooth.push(Z);
3381
+ if (lastCommand !== Z) {
3382
+ arcTo(smooth, startX, startY, secondX, secondY, cornerRadius, lastX, lastY);
3383
+ smooth.push(Z);
3384
+ }
3382
3385
  i += 1;
3383
3386
  break;
3384
3387
  default:
@@ -3387,6 +3390,7 @@ const PathCorner = {
3387
3390
  smooth.push(data[i + j]);
3388
3391
  i += commandLen;
3389
3392
  }
3393
+ lastCommand = command;
3390
3394
  }
3391
3395
  if (command !== Z) {
3392
3396
  smooth[1] = startX;
@@ -3883,12 +3887,12 @@ class LeaferImage {
3883
3887
  try {
3884
3888
  if (transform && pattern.setTransform) {
3885
3889
  pattern.setTransform(transform);
3886
- transform = null;
3890
+ transform = undefined;
3887
3891
  }
3888
3892
  }
3889
3893
  catch (_a) { }
3890
3894
  if (paint)
3891
- paint.transform = transform;
3895
+ DataHelper.stintSet(paint, 'transform', transform);
3892
3896
  return pattern;
3893
3897
  }
3894
3898
  destroy() {
@@ -3993,10 +3997,14 @@ function pathInputType(defaultValue) {
3993
3997
  }));
3994
3998
  }
3995
3999
  const pathType = boundsType;
3996
- function affectStrokeBoundsType(defaultValue) {
4000
+ function affectStrokeBoundsType(defaultValue, useStroke) {
3997
4001
  return decorateLeafAttr(defaultValue, (key) => attr({
3998
4002
  set(value) {
3999
- this.__setAttr(key, value) && doStrokeType(this);
4003
+ if (this.__setAttr(key, value)) {
4004
+ doStrokeType(this);
4005
+ if (useStroke)
4006
+ this.__.__useStroke = true;
4007
+ }
4000
4008
  }
4001
4009
  }));
4002
4010
  }
@@ -5422,6 +5430,8 @@ const LeafBounds = {
5422
5430
 
5423
5431
  const LeafRender = {
5424
5432
  __render(canvas, options) {
5433
+ if (options.shape)
5434
+ return this.__renderShape(canvas, options);
5425
5435
  if (this.__worldOpacity) {
5426
5436
  const data = this.__;
5427
5437
  canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
@@ -5431,12 +5441,10 @@ const LeafRender = {
5431
5441
  return this.__renderEraser(canvas, options);
5432
5442
  const tempCanvas = canvas.getSameCanvas(true, true);
5433
5443
  this.__draw(tempCanvas, options, canvas);
5434
- if (this.__worldFlipped) {
5444
+ if (this.__worldFlipped)
5435
5445
  canvas.copyWorldByReset(tempCanvas, this.__nowWorld, null, data.__blendMode, true);
5436
- }
5437
- else {
5446
+ else
5438
5447
  canvas.copyWorldToInner(tempCanvas, this.__nowWorld, this.__layout.renderBounds, data.__blendMode);
5439
- }
5440
5448
  tempCanvas.recycle(this.__nowWorld);
5441
5449
  }
5442
5450
  else {
@@ -5446,6 +5454,12 @@ const LeafRender = {
5446
5454
  Debug.drawBounds(this, canvas, options);
5447
5455
  }
5448
5456
  },
5457
+ __renderShape(canvas, options) {
5458
+ if (this.__worldOpacity) {
5459
+ canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
5460
+ this.__drawShape(canvas, options);
5461
+ }
5462
+ },
5449
5463
  __clip(canvas, options) {
5450
5464
  if (this.__worldOpacity) {
5451
5465
  canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
@@ -5865,7 +5879,8 @@ let Leaf = class Leaf {
5865
5879
  __drawFast(_canvas, _options) { }
5866
5880
  __draw(_canvas, _options, _originCanvas) { }
5867
5881
  __clip(_canvas, _options) { }
5868
- __renderShape(_canvas, _options, _ignoreFill, _ignoreStroke) { }
5882
+ __renderShape(_canvas, _options) { }
5883
+ __drawShape(_canvas, _options) { }
5869
5884
  __updateWorldOpacity() { }
5870
5885
  __updateChange() { }
5871
5886
  __drawPath(_canvas) { }
@@ -6233,7 +6248,7 @@ class LeafLevelList {
6233
6248
  }
6234
6249
  }
6235
6250
 
6236
- const version = "1.6.7";
6251
+ const version = "1.7.0";
6237
6252
 
6238
6253
  const debug$5 = Debug.get('LeaferCanvas');
6239
6254
  class LeaferCanvas extends LeaferCanvasBase {
@@ -7331,13 +7346,9 @@ class UIData extends LeafData {
7331
7346
  else
7332
7347
  return strokeWidth;
7333
7348
  }
7334
- get __hasStroke() { return this.stroke && this.strokeWidth; }
7335
- get __hasHalf() { const t = this; return (t.stroke && t.strokeAlign === 'center' && t.strokeWidth % 2) || undefined; }
7336
7349
  get __hasMultiPaint() {
7337
7350
  const t = this;
7338
- if ((t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect)
7339
- return true;
7340
- return t.fill && this.__hasStroke;
7351
+ return (t.fill && this.__useStroke) || (t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect;
7341
7352
  }
7342
7353
  get __clipAfterFill() { const t = this; return (t.cornerRadius || t.innerShadow || t.__pathInputed); }
7343
7354
  get __hasSurface() { const t = this; return (t.fill || t.stroke); }
@@ -7628,15 +7639,18 @@ const { stintSet: stintSet$1 } = DataHelper;
7628
7639
  const UIRender = {
7629
7640
  __updateChange() {
7630
7641
  const data = this.__;
7642
+ if (data.__useStroke) {
7643
+ const useStroke = data.__useStroke = !!(data.stroke && data.strokeWidth);
7644
+ stintSet$1(this.__world, 'half', useStroke && data.strokeAlign === 'center' && data.strokeWidth % 2);
7645
+ stintSet$1(data, '__fillAfterStroke', useStroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
7646
+ }
7631
7647
  if (data.__useEffect) {
7632
7648
  const { shadow, fill, stroke } = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
7633
7649
  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')));
7634
7650
  data.__useEffect = !!(shadow || otherEffect);
7635
7651
  }
7636
- stintSet$1(this.__world, 'half', data.__hasHalf);
7637
- stintSet$1(data, '__fillAfterStroke', data.stroke && data.strokeAlign === 'outside' && data.fill && !data.__isTransparentFill);
7638
7652
  data.__checkSingle();
7639
- stintSet$1(data, '__complex', data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect);
7653
+ stintSet$1(data, '__complex', (data.__isFills || data.__isStrokes || data.cornerRadius || data.__useEffect));
7640
7654
  },
7641
7655
  __drawFast(canvas, options) {
7642
7656
  drawFast(this, canvas, options);
@@ -7694,18 +7708,15 @@ const UIRender = {
7694
7708
  this.__drawFast(canvas, options);
7695
7709
  }
7696
7710
  },
7697
- __renderShape(canvas, options, ignoreFill, ignoreStroke) {
7698
- if (this.__worldOpacity) {
7699
- canvas.setWorld(this.__nowWorld = this.__getNowWorld(options));
7700
- const { fill, stroke } = this.__;
7701
- this.__drawRenderPath(canvas);
7702
- if (fill && !ignoreFill)
7703
- this.__.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
7704
- if (this.__.__isCanvas)
7705
- this.__drawAfterFill(canvas, options);
7706
- if (stroke && !ignoreStroke)
7707
- this.__.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
7708
- }
7711
+ __drawShape(canvas, options) {
7712
+ this.__drawRenderPath(canvas);
7713
+ const data = this.__, { fill, stroke } = data;
7714
+ if (fill && !options.ignoreFill)
7715
+ data.__isAlphaPixelFill ? Paint.fills(fill, this, canvas) : Paint.fill('#000000', this, canvas);
7716
+ if (data.__isCanvas)
7717
+ this.__drawAfterFill(canvas, options);
7718
+ if (stroke && !options.ignoreStroke)
7719
+ data.__isAlphaPixelStroke ? Paint.strokes(stroke, this, canvas) : Paint.stroke('#000000', this, canvas);
7709
7720
  },
7710
7721
  __drawAfterFill(canvas, options) {
7711
7722
  if (this.__.__clipAfterFill) {
@@ -7830,12 +7841,14 @@ let UI = UI_1 = class UI extends Leaf {
7830
7841
  }
7831
7842
  }
7832
7843
  __updateRenderPath() {
7833
- if (this.__.path) {
7834
- const data = this.__;
7844
+ const data = this.__;
7845
+ if (data.path) {
7835
7846
  data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
7836
7847
  if (data.__useArrow)
7837
7848
  PathArrow.addArrows(this, !data.cornerRadius);
7838
7849
  }
7850
+ else
7851
+ data.__pathForRender && (data.__pathForRender = undefined);
7839
7852
  }
7840
7853
  __drawRenderPath(canvas) {
7841
7854
  canvas.beginPath();
@@ -8046,13 +8059,13 @@ __decorate([
8046
8059
  surfaceType()
8047
8060
  ], UI.prototype, "fill", void 0);
8048
8061
  __decorate([
8049
- strokeType()
8062
+ strokeType(undefined, true)
8050
8063
  ], UI.prototype, "stroke", void 0);
8051
8064
  __decorate([
8052
8065
  strokeType('inside')
8053
8066
  ], UI.prototype, "strokeAlign", void 0);
8054
8067
  __decorate([
8055
- strokeType(1)
8068
+ strokeType(1, true)
8056
8069
  ], UI.prototype, "strokeWidth", void 0);
8057
8070
  __decorate([
8058
8071
  strokeType(false)
@@ -8479,7 +8492,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8479
8492
  list.push(item);
8480
8493
  this.requestRender();
8481
8494
  }
8482
- zoom(_zoomType, _padding, _fixedScale, _transition) {
8495
+ zoom(_zoomType, _optionsOrPadding, _scroll, _transition) {
8483
8496
  return Plugin.need('view');
8484
8497
  }
8485
8498
  getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
@@ -8524,7 +8537,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8524
8537
  Leafer_1.list.remove(this);
8525
8538
  try {
8526
8539
  this.stop();
8527
- this.emitEvent(new LeaferEvent(LeaferEvent.END, this));
8540
+ this.emitLeafer(LeaferEvent.END);
8528
8541
  this.__removeListenEvents();
8529
8542
  this.__controllers.forEach(item => !(this.parent && item === this.interaction) && item.destroy());
8530
8543
  this.__controllers.length = 0;
@@ -8652,7 +8665,7 @@ let Box = class Box extends Group {
8652
8665
  }
8653
8666
  __drawContent(canvas, options) {
8654
8667
  this.__renderGroup(canvas, options);
8655
- if (this.__.__hasStroke) {
8668
+ if (this.__.__useStroke) {
8656
8669
  canvas.setWorld(this.__nowWorld);
8657
8670
  this.__drawRenderPath(canvas);
8658
8671
  }
@@ -8872,8 +8885,8 @@ let Polygon = class Polygon extends UI {
8872
8885
  for (let i = 1; i < sides; i++) {
8873
8886
  lineTo$1(path, rx + rx * sin$1((i * 2 * PI$1) / sides), ry - ry * cos$1((i * 2 * PI$1) / sides));
8874
8887
  }
8888
+ closePath$1(path);
8875
8889
  }
8876
- closePath$1(path);
8877
8890
  }
8878
8891
  __updateRenderPath() { }
8879
8892
  __updateBoxBounds() { }
@@ -9111,6 +9124,11 @@ let Text = class Text extends UI {
9111
9124
  return;
9112
9125
  super.__draw(canvas, options, originCanvas);
9113
9126
  }
9127
+ __drawShape(canvas, options) {
9128
+ if (options.shape)
9129
+ this.__box && this.__box.__drawShape(canvas, options);
9130
+ super.__drawShape(canvas, options);
9131
+ }
9114
9132
  destroy() {
9115
9133
  if (this.boxStyle)
9116
9134
  this.boxStyle = null;
@@ -9932,6 +9950,7 @@ const config = {
9932
9950
  delta: { x: 80 / 4, y: 8.0 },
9933
9951
  },
9934
9952
  pointer: {
9953
+ type: 'pointer',
9935
9954
  snap: true,
9936
9955
  hitRadius: 5,
9937
9956
  tapTime: 120,
@@ -10475,7 +10494,7 @@ ui$1.__updateHitCanvas = function () {
10475
10494
  h.resize({ width, height, pixelRatio: 1 });
10476
10495
  h.clear();
10477
10496
  ImageManager.patternLocked = true;
10478
- this.__renderShape(h, { matrix: matrix.setWith(this.__world).scaleWith(1 / scale).invertWith().translate(-x, -y) }, !isHitPixelFill, !isHitPixelStroke);
10497
+ this.__renderShape(h, { matrix: matrix.setWith(this.__world).scaleWith(1 / scale).invertWith().translate(-x, -y), ignoreFill: !isHitPixelFill, ignoreStroke: !isHitPixelStroke });
10479
10498
  ImageManager.patternLocked = false;
10480
10499
  h.resetTransform();
10481
10500
  data.__isHitPixel = true;
@@ -10612,6 +10631,9 @@ const KeyEventHelper = {
10612
10631
 
10613
10632
  const { pathCanDrag } = InteractionHelper;
10614
10633
  class Interaction extends InteractionBase {
10634
+ get notPointer() { const { p } = this; return p.type !== 'pointer' || p.touch || this.useMultiTouch; }
10635
+ get notTouch() { const { p } = this; return p.type === 'mouse' || this.usePointer; }
10636
+ get notMouse() { return this.usePointer || this.useTouch; }
10615
10637
  __listenEvents() {
10616
10638
  super.__listenEvents();
10617
10639
  const view = this.view = this.canvas.view;
@@ -10697,13 +10719,13 @@ class Interaction extends InteractionBase {
10697
10719
  }
10698
10720
  onPointerDown(e) {
10699
10721
  this.preventDefaultPointer(e);
10700
- if (this.config.pointer.touch || this.useMultiTouch)
10722
+ if (this.notPointer)
10701
10723
  return;
10702
10724
  this.usePointer || (this.usePointer = true);
10703
10725
  this.pointerDown(PointerEventHelper.convert(e, this.getLocal(e)));
10704
10726
  }
10705
10727
  onPointerMove(e, isLeave) {
10706
- if (this.config.pointer.touch || this.useMultiTouch || this.preventWindowPointer(e))
10728
+ if (this.notPointer || this.preventWindowPointer(e))
10707
10729
  return;
10708
10730
  this.usePointer || (this.usePointer = true);
10709
10731
  const data = PointerEventHelper.convert(e, this.getLocal(e, true));
@@ -10715,7 +10737,7 @@ class Interaction extends InteractionBase {
10715
10737
  onPointerUp(e) {
10716
10738
  if (this.downData)
10717
10739
  this.preventDefaultPointer(e);
10718
- if (this.config.pointer.touch || this.useMultiTouch || this.preventWindowPointer(e))
10740
+ if (this.notPointer || this.preventWindowPointer(e))
10719
10741
  return;
10720
10742
  this.pointerUp(PointerEventHelper.convert(e, this.getLocal(e)));
10721
10743
  }
@@ -10726,24 +10748,24 @@ class Interaction extends InteractionBase {
10726
10748
  }
10727
10749
  onMouseDown(e) {
10728
10750
  this.preventDefaultPointer(e);
10729
- if (this.useTouch || this.usePointer)
10751
+ if (this.notMouse)
10730
10752
  return;
10731
10753
  this.pointerDown(PointerEventHelper.convertMouse(e, this.getLocal(e)));
10732
10754
  }
10733
10755
  onMouseMove(e) {
10734
- if (this.useTouch || this.usePointer || this.preventWindowPointer(e))
10756
+ if (this.notMouse || this.preventWindowPointer(e))
10735
10757
  return;
10736
10758
  this.pointerMove(PointerEventHelper.convertMouse(e, this.getLocal(e, true)));
10737
10759
  }
10738
10760
  onMouseUp(e) {
10739
10761
  if (this.downData)
10740
10762
  this.preventDefaultPointer(e);
10741
- if (this.useTouch || this.usePointer || this.preventWindowPointer(e))
10763
+ if (this.notMouse || this.preventWindowPointer(e))
10742
10764
  return;
10743
10765
  this.pointerUp(PointerEventHelper.convertMouse(e, this.getLocal(e)));
10744
10766
  }
10745
10767
  onMouseCancel() {
10746
- if (this.useTouch || this.usePointer)
10768
+ if (this.notMouse)
10747
10769
  return;
10748
10770
  this.pointerCancel();
10749
10771
  }
@@ -10754,7 +10776,7 @@ class Interaction extends InteractionBase {
10754
10776
  if (preventDefault === true || (preventDefault === 'auto' && pathCanDrag(this.findPath(local))))
10755
10777
  e.preventDefault();
10756
10778
  this.multiTouchStart(e);
10757
- if (this.usePointer)
10779
+ if (this.notTouch)
10758
10780
  return;
10759
10781
  if (this.touchTimer) {
10760
10782
  window.clearTimeout(this.touchTimer);
@@ -10765,14 +10787,14 @@ class Interaction extends InteractionBase {
10765
10787
  }
10766
10788
  onTouchMove(e) {
10767
10789
  this.multiTouchMove(e);
10768
- if (this.usePointer || this.preventWindowPointer(e))
10790
+ if (this.notTouch || this.preventWindowPointer(e))
10769
10791
  return;
10770
10792
  const touch = PointerEventHelper.getTouch(e);
10771
10793
  this.pointerMove(PointerEventHelper.convertTouch(e, this.getLocal(touch)));
10772
10794
  }
10773
10795
  onTouchEnd(e) {
10774
10796
  this.multiTouchEnd();
10775
- if (this.usePointer || this.preventWindowPointer(e))
10797
+ if (this.notTouch || this.preventWindowPointer(e))
10776
10798
  return;
10777
10799
  if (this.touchTimer)
10778
10800
  clearTimeout(this.touchTimer);
@@ -10783,7 +10805,7 @@ class Interaction extends InteractionBase {
10783
10805
  this.pointerUp(PointerEventHelper.convertTouch(e, this.getLocal(touch)));
10784
10806
  }
10785
10807
  onTouchCancel() {
10786
- if (this.usePointer)
10808
+ if (this.notTouch)
10787
10809
  return;
10788
10810
  this.pointerCancel();
10789
10811
  }
@@ -11188,7 +11210,7 @@ const PaintModule = {
11188
11210
  };
11189
11211
 
11190
11212
  let origin = {};
11191
- const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, scale: scaleHelper, rotate } = MatrixHelper;
11213
+ const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, scale: scaleHelper, rotate, skew: skewHelper } = MatrixHelper;
11192
11214
  function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
11193
11215
  const transform = get$3();
11194
11216
  translate$1(transform, box.x + x, box.y + y);
@@ -11197,13 +11219,15 @@ function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
11197
11219
  rotateOfOuter$1(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
11198
11220
  data.transform = transform;
11199
11221
  }
11200
- function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
11222
+ function clipMode(data, box, x, y, scaleX, scaleY, rotation, skew) {
11201
11223
  const transform = get$3();
11202
- translate$1(transform, box.x + x, box.y + y);
11203
- if (scaleX)
11204
- scaleHelper(transform, scaleX, scaleY);
11205
11224
  if (rotation)
11206
11225
  rotate(transform, rotation);
11226
+ if (skew)
11227
+ skewHelper(transform, skew.x, skew.y);
11228
+ if (scaleX)
11229
+ scaleHelper(transform, scaleX, scaleY);
11230
+ translate$1(transform, box.x + x, box.y + y);
11207
11231
  data.transform = transform;
11208
11232
  }
11209
11233
  function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
@@ -11240,11 +11264,13 @@ const tempBox = new Bounds();
11240
11264
  const tempScaleData = {};
11241
11265
  const tempImage = {};
11242
11266
  function createData(leafPaint, image, paint, box) {
11243
- const { changeful, sync } = paint;
11267
+ const { changeful, sync, editing } = paint;
11244
11268
  if (changeful)
11245
11269
  leafPaint.changeful = changeful;
11246
11270
  if (sync)
11247
11271
  leafPaint.sync = sync;
11272
+ if (editing)
11273
+ leafPaint.editing = editing;
11248
11274
  leafPaint.data = getPatternData(paint, box, image);
11249
11275
  }
11250
11276
  function getPatternData(paint, box, image) {
@@ -11253,7 +11279,7 @@ function getPatternData(paint, box, image) {
11253
11279
  if (paint.mode === 'strench')
11254
11280
  paint.mode = 'stretch';
11255
11281
  let { width, height } = image;
11256
- const { opacity, mode, align, offset, scale, size, rotation, repeat, filters } = paint;
11282
+ const { opacity, mode, align, offset, scale, size, rotation, skew, repeat, filters } = paint;
11257
11283
  const sameBox = box.width === width && box.height === height;
11258
11284
  const data = { mode };
11259
11285
  const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
@@ -11287,8 +11313,8 @@ function getPatternData(paint, box, image) {
11287
11313
  break;
11288
11314
  case 'normal':
11289
11315
  case 'clip':
11290
- if (tempImage.x || tempImage.y || scaleX || rotation)
11291
- clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation);
11316
+ if (tempImage.x || tempImage.y || scaleX || rotation || skew)
11317
+ clipMode(data, box, tempImage.x, tempImage.y, scaleX, scaleY, rotation, skew);
11292
11318
  break;
11293
11319
  case 'repeat':
11294
11320
  if (!sameBox || scaleX || rotation)
@@ -11365,11 +11391,11 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
11365
11391
  }
11366
11392
  onLoadSuccess(ui, event);
11367
11393
  }
11368
- leafPaint.loadId = null;
11394
+ leafPaint.loadId = undefined;
11369
11395
  }, (error) => {
11370
11396
  ignoreRender(ui, false);
11371
11397
  onLoadError(ui, event, error);
11372
- leafPaint.loadId = null;
11398
+ leafPaint.loadId = undefined;
11373
11399
  });
11374
11400
  if (ui.placeholderColor) {
11375
11401
  if (!ui.placeholderDelay)
@@ -11435,6 +11461,8 @@ function createPattern(ui, paint, pixelRatio) {
11435
11461
  const { image, data } = paint;
11436
11462
  let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, transform, repeat } = data;
11437
11463
  if (sx) {
11464
+ sx = abs$1(sx);
11465
+ sy = abs$1(sy);
11438
11466
  imageMatrix = get$1();
11439
11467
  copy$1(imageMatrix, transform);
11440
11468
  scale(imageMatrix, 1 / sx, 1 / sy);