@leafer-draw/worker 1.9.4 → 1.9.5

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.
@@ -136,6 +136,9 @@ class LeafData {
136
136
  const {path: path} = this;
137
137
  return path && path.length === 6 && path[0] === 1;
138
138
  }
139
+ get __usePathBox() {
140
+ return this.__pathInputed;
141
+ }
139
142
  get __blendMode() {
140
143
  if (this.eraser && this.eraser !== "path") return "destination-out";
141
144
  const {blendMode: blendMode} = this;
@@ -1134,13 +1137,13 @@ const AlignHelper = {
1134
1137
  }
1135
1138
  };
1136
1139
 
1137
- const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$3} = TwoPointBoundsHelper;
1140
+ const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPoint$2, toBounds: toBounds$2} = TwoPointBoundsHelper;
1138
1141
 
1139
1142
  const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
1140
1143
 
1141
1144
  const {float: float, fourNumber: fourNumber} = MathHelper;
1142
1145
 
1143
- const {floor: floor$2, ceil: ceil$1} = Math;
1146
+ const {floor: floor$2, ceil: ceil$2} = Math;
1144
1147
 
1145
1148
  let right$1, bottom$1, boundsRight, boundsBottom;
1146
1149
 
@@ -1269,7 +1272,7 @@ const BoundsHelper = {
1269
1272
  point.x = t.x;
1270
1273
  toOuterPoint$2(matrix, point, toPoint$4);
1271
1274
  addPoint$2(tempPointBounds$1, toPoint$4.x, toPoint$4.y);
1272
- toBounds$3(tempPointBounds$1, to);
1275
+ toBounds$2(tempPointBounds$1, to);
1273
1276
  }
1274
1277
  },
1275
1278
  toInnerOf(t, matrix, to) {
@@ -1307,8 +1310,8 @@ const BoundsHelper = {
1307
1310
  const {x: x, y: y} = t;
1308
1311
  t.x = floor$2(t.x);
1309
1312
  t.y = floor$2(t.y);
1310
- t.width = x > t.x ? ceil$1(t.width + x - t.x) : ceil$1(t.width);
1311
- t.height = y > t.y ? ceil$1(t.height + y - t.y) : ceil$1(t.height);
1313
+ t.width = x > t.x ? ceil$2(t.width + x - t.x) : ceil$2(t.width);
1314
+ t.height = y > t.y ? ceil$2(t.height + y - t.y) : ceil$2(t.height);
1312
1315
  },
1313
1316
  unsign(t) {
1314
1317
  if (t.width < 0) {
@@ -1368,7 +1371,7 @@ const BoundsHelper = {
1368
1371
  },
1369
1372
  setPoints(t, points) {
1370
1373
  points.forEach((point, index) => index === 0 ? setPoint$2(tempPointBounds$1, point.x, point.y) : addPoint$2(tempPointBounds$1, point.x, point.y));
1371
- toBounds$3(tempPointBounds$1, t);
1374
+ toBounds$2(tempPointBounds$1, t);
1372
1375
  },
1373
1376
  setPoint(t, point) {
1374
1377
  B.set(t, point.x, point.y);
@@ -2221,15 +2224,15 @@ class LeaferCanvasBase extends Canvas$1 {
2221
2224
  DataHelper.copyAttrs(s, size, canvasSizeAttrs);
2222
2225
  canvasSizeAttrs.forEach(key => s[key] || (s[key] = 1));
2223
2226
  this.bounds = new Bounds(0, 0, this.width, this.height);
2224
- if (this.context && !this.unreal) {
2225
- this.updateViewSize();
2226
- this.smooth = this.config.smooth;
2227
- }
2227
+ this.updateViewSize();
2228
2228
  this.updateClientBounds();
2229
- if (this.context && !this.unreal && takeCanvas) {
2230
- this.clearWorld(takeCanvas.bounds);
2231
- this.copyWorld(takeCanvas);
2232
- takeCanvas.recycle();
2229
+ if (this.context) {
2230
+ this.smooth = this.config.smooth;
2231
+ if (!this.unreal && takeCanvas) {
2232
+ this.clearWorld(takeCanvas.bounds);
2233
+ this.copyWorld(takeCanvas);
2234
+ takeCanvas.recycle();
2235
+ }
2233
2236
  }
2234
2237
  }
2235
2238
  updateViewSize() {}
@@ -2543,7 +2546,7 @@ const RectHelper = {
2543
2546
  }
2544
2547
  };
2545
2548
 
2546
- const {sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil, abs: abs$2, PI: PI$2, sqrt: sqrt$1, pow: pow} = Math;
2549
+ const {sin: sin$3, cos: cos$3, hypot: hypot, atan2: atan2$1, ceil: ceil$1, abs: abs$2, PI: PI$2, sqrt: sqrt$1, pow: pow} = Math;
2547
2550
 
2548
2551
  const {setPoint: setPoint$1, addPoint: addPoint$1} = TwoPointBoundsHelper;
2549
2552
 
@@ -2614,9 +2617,11 @@ const BezierHelper = {
2614
2617
  const CBy = toY - y1;
2615
2618
  let startRadian = atan2$1(BAy, BAx);
2616
2619
  let endRadian = atan2$1(CBy, CBx);
2620
+ const lenBA = hypot(BAx, BAy);
2621
+ const lenCB = hypot(CBx, CBy);
2617
2622
  let totalRadian = endRadian - startRadian;
2618
2623
  if (totalRadian < 0) totalRadian += PI2;
2619
- if (totalRadian === PI$2 || abs$2(BAx + BAy) < 1e-12 || abs$2(CBx + CBy) < 1e-12) {
2624
+ if (lenBA < 1e-12 || lenCB < 1e-12 || totalRadian < 1e-12 || abs$2(totalRadian - PI$2) < 1e-12) {
2620
2625
  if (data) data.push(L$6, x1, y1);
2621
2626
  if (setPointBounds) {
2622
2627
  setPoint$1(setPointBounds, fromX, fromY);
@@ -2649,7 +2654,7 @@ const BezierHelper = {
2649
2654
  let totalRadian = endRadian - startRadian;
2650
2655
  if (totalRadian < 0) totalRadian += PI2; else if (totalRadian > PI2) totalRadian -= PI2;
2651
2656
  if (anticlockwise) totalRadian -= PI2;
2652
- const parts = ceil(abs$2(totalRadian / PI_2));
2657
+ const parts = ceil$1(abs$2(totalRadian / PI_2));
2653
2658
  const partRadian = totalRadian / parts;
2654
2659
  const partRadian4Sin = sin$3(partRadian / 4);
2655
2660
  const control = 8 / 3 * partRadian4Sin * partRadian4Sin / sin$3(partRadian / 2);
@@ -3208,11 +3213,7 @@ class PathCreator {
3208
3213
  this.set(path);
3209
3214
  }
3210
3215
  set(path) {
3211
- if (path) {
3212
- this.__path = isString(path) ? PathHelper.parse(path) : path;
3213
- } else {
3214
- this.__path = [];
3215
- }
3216
+ this.__path = path ? isString(path) ? PathHelper.parse(path) : path : [];
3216
3217
  return this;
3217
3218
  }
3218
3219
  beginPath() {
@@ -3380,7 +3381,7 @@ const {M: M$1, L: L$2, C: C, Q: Q, Z: Z$1, N: N, D: D$1, X: X, G: G, F: F$1, O:
3380
3381
 
3381
3382
  const {toTwoPointBounds: toTwoPointBounds, toTwoPointBoundsByQuadraticCurve: toTwoPointBoundsByQuadraticCurve, arcTo: arcTo$1, arc: arc, ellipse: ellipse$1} = BezierHelper;
3382
3383
 
3383
- const {addPointBounds: addPointBounds, copy: copy$6, addPoint: addPoint, setPoint: setPoint, addBounds: addBounds, toBounds: toBounds$2} = TwoPointBoundsHelper;
3384
+ const {addPointBounds: addPointBounds, copy: copy$6, addPoint: addPoint, setPoint: setPoint, addBounds: addBounds, toBounds: toBounds$1} = TwoPointBoundsHelper;
3384
3385
 
3385
3386
  const debug$9 = Debug.get("PathBounds");
3386
3387
 
@@ -3395,7 +3396,7 @@ const setEndPoint = {};
3395
3396
  const PathBounds = {
3396
3397
  toBounds(data, setBounds) {
3397
3398
  PathBounds.toTwoPointBounds(data, setPointBounds);
3398
- toBounds$2(setPointBounds, setBounds);
3399
+ toBounds$1(setPointBounds, setBounds);
3399
3400
  },
3400
3401
  toTwoPointBounds(data, setPointBounds) {
3401
3402
  if (!data || !data.length) return setPoint(setPointBounds, 0, 0);
@@ -3582,14 +3583,18 @@ const PathCorner = {
3582
3583
  }
3583
3584
  };
3584
3585
 
3585
- PathHelper.creator = new PathCreator;
3586
+ function path(path) {
3587
+ return new PathCreator(path);
3588
+ }
3589
+
3590
+ const pen = path();
3591
+
3592
+ PathHelper.creator = path();
3586
3593
 
3587
3594
  PathHelper.parse = PathConvert.parse;
3588
3595
 
3589
3596
  PathHelper.convertToCanvasData = PathConvert.toCanvasData;
3590
3597
 
3591
- const pen = new PathCreator;
3592
-
3593
3598
  const {drawRoundRect: drawRoundRect} = RectHelper;
3594
3599
 
3595
3600
  function roundRect(drawer) {
@@ -3954,7 +3959,7 @@ const ImageManager = {
3954
3959
  return FileHelper.alphaPixelTypes.some(item => I.isFormat(item, config));
3955
3960
  },
3956
3961
  isFormat(format, config) {
3957
- if (config.format === format) return true;
3962
+ if (config.format) return config.format === format;
3958
3963
  const {url: url} = config;
3959
3964
  if (url.startsWith("data:")) {
3960
3965
  if (url.startsWith("data:" + FileHelper.mineType(format))) return true;
@@ -4048,7 +4053,7 @@ class LeaferImage {
4048
4053
  getFull(_filters) {
4049
4054
  return this.view;
4050
4055
  }
4051
- getCanvas(width, height, opacity, _filters, xGap, yGap) {
4056
+ getCanvas(width, height, opacity, _filters, xGap, yGap, smooth) {
4052
4057
  width || (width = this.width);
4053
4058
  height || (height = this.height);
4054
4059
  if (this.cache) {
@@ -4064,6 +4069,7 @@ class LeaferImage {
4064
4069
  const canvas = Platform.origin.createCanvas(max$1(floor$1(width + (xGap || 0)), 1), max$1(floor$1(height + (yGap || 0)), 1));
4065
4070
  const ctx = canvas.getContext("2d");
4066
4071
  if (opacity) ctx.globalAlpha = opacity;
4072
+ ctx.imageSmoothingEnabled = smooth === false ? false : true;
4067
4073
  ctx.drawImage(this.view, 0, 0, width, height);
4068
4074
  this.cache = this.use > 1 ? {
4069
4075
  data: canvas,
@@ -4715,8 +4721,9 @@ const L = LeafHelper;
4715
4721
 
4716
4722
  const {updateAllMatrix: updateAllMatrix$3, updateMatrix: updateMatrix$2, updateAllWorldOpacity: updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1} = L;
4717
4723
 
4718
- function getTempLocal(t, world) {
4719
- return t.parent ? PointHelper.tempToInnerOf(world, t.parent.scrollWorldTransform) : world;
4724
+ function getTempLocal(t, worldPoint) {
4725
+ t.updateLayout();
4726
+ return t.parent ? PointHelper.tempToInnerOf(worldPoint, t.parent.scrollWorldTransform) : worldPoint;
4720
4727
  }
4721
4728
 
4722
4729
  const LeafBoundsHelper = {
@@ -5734,7 +5741,7 @@ const {updateBounds: updateBounds$1} = BranchHelper;
5734
5741
 
5735
5742
  const {toOuterOf: toOuterOf$1, copyAndSpread: copyAndSpread$1, copy: copy$3} = BoundsHelper;
5736
5743
 
5737
- const {toBounds: toBounds$1} = PathBounds;
5744
+ const {toBounds: toBounds} = PathBounds;
5738
5745
 
5739
5746
  const LeafBounds = {
5740
5747
  __updateWorldBounds() {
@@ -5806,8 +5813,8 @@ const LeafBounds = {
5806
5813
  __updateBoxBounds(_secondLayout, _bounds) {
5807
5814
  const b = this.__layout.boxBounds;
5808
5815
  const data = this.__;
5809
- if (data.__pathInputed) {
5810
- toBounds$1(data.path, b);
5816
+ if (data.__usePathBox) {
5817
+ toBounds(data.path, b);
5811
5818
  } else {
5812
5819
  b.x = 0;
5813
5820
  b.y = 0;
@@ -6742,7 +6749,7 @@ class LeafLevelList {
6742
6749
  }
6743
6750
  }
6744
6751
 
6745
- const version = "1.9.4";
6752
+ const version = "1.9.5";
6746
6753
 
6747
6754
  class LeaferCanvas extends LeaferCanvasBase {
6748
6755
  get allowBackgroundColor() {
@@ -7165,7 +7172,7 @@ class Renderer {
7165
7172
  this.times = 0;
7166
7173
  this.config = {
7167
7174
  usePartRender: true,
7168
- maxFPS: 60
7175
+ maxFPS: 120
7169
7176
  };
7170
7177
  this.target = target;
7171
7178
  this.canvas = canvas;
@@ -7320,11 +7327,15 @@ class Renderer {
7320
7327
  if (this.requestTime || !target) return;
7321
7328
  if (target.parentApp) return target.parentApp.requestRender(false);
7322
7329
  const requestTime = this.requestTime = Date.now();
7323
- Platform.requestRender(() => {
7324
- this.FPS = Math.min(60, Math.ceil(1e3 / (Date.now() - requestTime)));
7330
+ const render = () => {
7331
+ const nowFPS = 1e3 / (Date.now() - requestTime);
7332
+ const {maxFPS: maxFPS} = this.config;
7333
+ if (maxFPS && nowFPS > maxFPS - .5) return Platform.requestRender(render);
7334
+ this.FPS = Math.min(120, Math.ceil(nowFPS));
7325
7335
  this.requestTime = 0;
7326
7336
  this.checkRender();
7327
- });
7337
+ };
7338
+ Platform.requestRender(render);
7328
7339
  }
7329
7340
  __onResize(e) {
7330
7341
  if (this.canvas.unreal) return;
@@ -7367,7 +7378,8 @@ class Renderer {
7367
7378
  if (this.target) {
7368
7379
  this.stop();
7369
7380
  this.__removeListenEvents();
7370
- this.target = this.canvas = this.config = null;
7381
+ this.config = {};
7382
+ this.target = this.canvas = null;
7371
7383
  }
7372
7384
  }
7373
7385
  }
@@ -7675,7 +7687,11 @@ class LeaferData extends GroupData {
7675
7687
 
7676
7688
  class FrameData extends BoxData {}
7677
7689
 
7678
- class LineData extends UIData {}
7690
+ class LineData extends UIData {
7691
+ get __usePathBox() {
7692
+ return this.points || this.__pathInputed;
7693
+ }
7694
+ }
7679
7695
 
7680
7696
  class RectData extends UIData {
7681
7697
  get __boxStroke() {
@@ -7689,7 +7705,7 @@ class EllipseData extends UIData {
7689
7705
  }
7690
7706
  }
7691
7707
 
7692
- class PolygonData extends UIData {}
7708
+ class PolygonData extends LineData {}
7693
7709
 
7694
7710
  class StarData extends UIData {}
7695
7711
 
@@ -7999,20 +8015,9 @@ let UI = UI_1 = class UI extends Leaf {
7999
8015
  if (!path) this.__drawPathByBox(pen);
8000
8016
  return pen;
8001
8017
  }
8002
- constructor(data) {
8003
- super(data);
8004
- }
8005
8018
  reset(_data) {}
8006
- set(data, transition) {
8007
- if (data) {
8008
- if (transition) {
8009
- if (transition === "temp") {
8010
- this.lockNormalStyle = true;
8011
- Object.assign(this, data);
8012
- this.lockNormalStyle = false;
8013
- } else this.animate(data, transition);
8014
- } else Object.assign(this, data);
8015
- }
8019
+ set(data, _transition) {
8020
+ if (data) Object.assign(this, data);
8016
8021
  }
8017
8022
  get(name) {
8018
8023
  return isString(name) ? this.__.__getInput(name) : this.__.__getInputData(name);
@@ -8058,7 +8063,7 @@ let UI = UI_1 = class UI extends Leaf {
8058
8063
  const data = this.__;
8059
8064
  if (data.path) {
8060
8065
  data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
8061
- if (data.__useArrow) PathArrow.addArrows(this, !data.cornerRadius);
8066
+ if (data.__useArrow) PathArrow.addArrows(this);
8062
8067
  } else data.__pathForRender && (data.__pathForRender = undefined);
8063
8068
  }
8064
8069
  __drawRenderPath(canvas) {
@@ -8082,7 +8087,8 @@ let UI = UI_1 = class UI extends Leaf {
8082
8087
  drawImagePlaceholder(canvas, _image) {
8083
8088
  Paint.fill(this.__.placeholderColor, this, canvas);
8084
8089
  }
8085
- animate(_keyframe, _options, _type, _isTemp) {
8090
+ animate(keyframe, _options, _type, _isTemp) {
8091
+ this.set(keyframe);
8086
8092
  return Plugin.need("animate");
8087
8093
  }
8088
8094
  killAnimate(_type, _nextStyle) {}
@@ -8271,9 +8277,6 @@ let Group = class Group extends UI {
8271
8277
  get isBranch() {
8272
8278
  return true;
8273
8279
  }
8274
- constructor(data) {
8275
- super(data);
8276
- }
8277
8280
  reset(data) {
8278
8281
  this.__setBranch();
8279
8282
  super.reset(data);
@@ -8398,7 +8401,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8398
8401
  const canvas = this.canvas = Creator.canvas(config);
8399
8402
  this.__controllers.push(this.renderer = Creator.renderer(this, canvas, config), this.watcher = Creator.watcher(this, config), this.layouter = Creator.layouter(this, config));
8400
8403
  if (this.isApp) this.__setApp();
8401
- this.__checkAutoLayout(config, parentApp);
8404
+ this.__checkAutoLayout();
8402
8405
  this.view = canvas.view;
8403
8406
  if (!parentApp) {
8404
8407
  this.selector = Creator.selector(this);
@@ -8497,7 +8500,8 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8497
8500
  this.leafer = leafer;
8498
8501
  this.__level = 1;
8499
8502
  }
8500
- __checkAutoLayout(config, parentApp) {
8503
+ __checkAutoLayout() {
8504
+ const {config: config, parentApp: parentApp} = this;
8501
8505
  if (!parentApp) {
8502
8506
  if (!config.width || !config.height) this.autoLayout = new AutoBounds(config);
8503
8507
  this.canvas.startAutoLayout(this.autoLayout, this.__onResize.bind(this));
@@ -8523,9 +8527,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8523
8527
  return super.__getAttr(attrName);
8524
8528
  }
8525
8529
  __changeCanvasSize(attrName, newValue) {
8526
- const data = DataHelper.copyAttrs({}, this.canvas, canvasSizeAttrs);
8527
- data[attrName] = this.config[attrName] = newValue;
8528
- if (newValue) this.canvas.stopAutoLayout();
8530
+ const {config: config, canvas: canvas} = this;
8531
+ const data = DataHelper.copyAttrs({}, canvas, canvasSizeAttrs);
8532
+ data[attrName] = config[attrName] = newValue;
8533
+ config.width && config.height ? canvas.stopAutoLayout() : this.__checkAutoLayout();
8529
8534
  this.__doResize(data);
8530
8535
  }
8531
8536
  __changeFill(newValue) {
@@ -8672,9 +8677,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8672
8677
  if (!this.parent) {
8673
8678
  if (this.selector) this.selector.destroy();
8674
8679
  if (this.hitCanvasManager) this.hitCanvasManager.destroy();
8675
- this.canvasManager.destroy();
8680
+ if (this.canvasManager) this.canvasManager.destroy();
8676
8681
  }
8677
- this.canvas.destroy();
8682
+ if (this.canvas) this.canvas.destroy();
8678
8683
  this.config.view = this.view = this.parentApp = null;
8679
8684
  if (this.userConfig) this.userConfig.view = null;
8680
8685
  super.destroy();
@@ -8702,9 +8707,6 @@ let Rect = class Rect extends UI {
8702
8707
  get __tag() {
8703
8708
  return "Rect";
8704
8709
  }
8705
- constructor(data) {
8706
- super(data);
8707
- }
8708
8710
  };
8709
8711
 
8710
8712
  __decorate([ dataProcessor(RectData) ], Rect.prototype, "__", void 0);
@@ -8836,9 +8838,6 @@ let Frame = class Frame extends Box {
8836
8838
  get isFrame() {
8837
8839
  return true;
8838
8840
  }
8839
- constructor(data) {
8840
- super(data);
8841
- }
8842
8841
  };
8843
8842
 
8844
8843
  __decorate([ dataProcessor(FrameData) ], Frame.prototype, "__", void 0);
@@ -8855,9 +8854,6 @@ let Ellipse = class Ellipse extends UI {
8855
8854
  get __tag() {
8856
8855
  return "Ellipse";
8857
8856
  }
8858
- constructor(data) {
8859
- super(data);
8860
- }
8861
8857
  __updatePath() {
8862
8858
  const {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = this.__;
8863
8859
  const rx = width / 2, ry = height / 2;
@@ -8901,8 +8897,6 @@ const {moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1} = PathComma
8901
8897
 
8902
8898
  const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint: defaultPoint} = PointHelper;
8903
8899
 
8904
- const {toBounds: toBounds} = PathBounds;
8905
-
8906
8900
  let Line = class Line extends UI {
8907
8901
  get __tag() {
8908
8902
  return "Line";
@@ -8919,31 +8913,16 @@ let Line = class Line extends UI {
8919
8913
  this.rotation = getAngle$1(defaultPoint, value);
8920
8914
  if (this.height) this.height = 0;
8921
8915
  }
8922
- constructor(data) {
8923
- super(data);
8924
- }
8925
8916
  __updatePath() {
8926
8917
  const data = this.__;
8927
8918
  const path = data.path = [];
8928
8919
  if (data.points) {
8929
- drawPoints$1(path, data.points, false, data.closed);
8920
+ drawPoints$1(path, data.points, data.curve, data.closed);
8930
8921
  } else {
8931
8922
  moveTo$2(path, 0, 0);
8932
8923
  lineTo$2(path, this.width, 0);
8933
8924
  }
8934
8925
  }
8935
- __updateRenderPath() {
8936
- const data = this.__;
8937
- if (!this.pathInputed && data.points && data.curve) {
8938
- drawPoints$1(data.__pathForRender = [], data.points, data.curve, data.closed);
8939
- if (data.__useArrow) PathArrow.addArrows(this, false);
8940
- } else super.__updateRenderPath();
8941
- }
8942
- __updateBoxBounds() {
8943
- if (this.points) {
8944
- toBounds(this.__.__pathForRender, this.__layout.boxBounds);
8945
- } else super.__updateBoxBounds();
8946
- }
8947
8926
  };
8948
8927
 
8949
8928
  __decorate([ dataProcessor(LineData) ], Line.prototype, "__", void 0);
@@ -8970,15 +8949,13 @@ let Polygon = class Polygon extends UI {
8970
8949
  get __tag() {
8971
8950
  return "Polygon";
8972
8951
  }
8973
- constructor(data) {
8974
- super(data);
8975
- }
8976
8952
  __updatePath() {
8977
- const path = this.__.path = [];
8978
- if (this.__.points) {
8979
- drawPoints(path, this.__.points, false, true);
8953
+ const data = this.__;
8954
+ const path = data.path = [];
8955
+ if (data.points) {
8956
+ drawPoints(path, data.points, data.curve, true);
8980
8957
  } else {
8981
- const {width: width, height: height, sides: sides} = this.__;
8958
+ const {width: width, height: height, sides: sides} = data;
8982
8959
  const rx = width / 2, ry = height / 2;
8983
8960
  moveTo$1(path, rx, 0);
8984
8961
  for (let i = 1; i < sides; i++) {
@@ -9013,9 +8990,6 @@ let Star = class Star extends UI {
9013
8990
  get __tag() {
9014
8991
  return "Star";
9015
8992
  }
9016
- constructor(data) {
9017
- super(data);
9018
- }
9019
8993
  __updatePath() {
9020
8994
  const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
9021
8995
  const rx = width / 2, ry = height / 2;
@@ -9048,9 +9022,6 @@ let Image = class Image extends Rect {
9048
9022
  const {fill: fill} = this.__;
9049
9023
  return isArray(fill) && fill[0].image;
9050
9024
  }
9051
- constructor(data) {
9052
- super(data);
9053
- }
9054
9025
  };
9055
9026
 
9056
9027
  __decorate([ dataProcessor(ImageData) ], Image.prototype, "__", void 0);
@@ -9150,9 +9121,6 @@ let Text = class Text extends UI {
9150
9121
  this.updateLayout();
9151
9122
  return this.__.__textDrawData;
9152
9123
  }
9153
- constructor(data) {
9154
- super(data);
9155
- }
9156
9124
  __updateTextDrawData() {
9157
9125
  const data = this.__;
9158
9126
  const {lineHeight: lineHeight, letterSpacing: letterSpacing, fontFamily: fontFamily, fontSize: fontSize, fontWeight: fontWeight, italic: italic, textCase: textCase, textOverflow: textOverflow, padding: padding} = data;
@@ -9285,9 +9253,6 @@ let Path = class Path extends UI {
9285
9253
  get __tag() {
9286
9254
  return "Path";
9287
9255
  }
9288
- constructor(data) {
9289
- super(data);
9290
- }
9291
9256
  };
9292
9257
 
9293
9258
  __decorate([ dataProcessor(PathData) ], Path.prototype, "__", void 0);
@@ -9300,9 +9265,6 @@ let Pen = class Pen extends Group {
9300
9265
  get __tag() {
9301
9266
  return "Pen";
9302
9267
  }
9303
- constructor(data) {
9304
- super(data);
9305
- }
9306
9268
  setStyle(data) {
9307
9269
  const path = this.pathElement = new Path(data);
9308
9270
  this.pathStyle = data;
@@ -9998,7 +9960,7 @@ function ignoreRender(ui, value) {
9998
9960
 
9999
9961
  const {get: get$1, scale: scale, copy: copy$1} = MatrixHelper;
10000
9962
 
10001
- const {floor: floor, max: max, abs: abs} = Math;
9963
+ const {floor: floor, ceil: ceil, max: max, abs: abs} = Math;
10002
9964
 
10003
9965
  function createPattern(ui, paint, pixelRatio) {
10004
9966
  let {scaleX: scaleX, scaleY: scaleY} = ui.getRenderScaleData(true, paint.scaleFixed);
@@ -10008,8 +9970,6 @@ function createPattern(ui, paint, pixelRatio) {
10008
9970
  let imageScale, imageMatrix, {width: width, height: height, scaleX: sx, scaleY: sy, transform: transform, repeat: repeat, gap: gap} = data;
10009
9971
  scaleX *= pixelRatio;
10010
9972
  scaleY *= pixelRatio;
10011
- const xGap = gap && gap.x * scaleX;
10012
- const yGap = gap && gap.y * scaleY;
10013
9973
  if (sx) {
10014
9974
  sx = abs(sx);
10015
9975
  sy = abs(sy);
@@ -10026,7 +9986,10 @@ function createPattern(ui, paint, pixelRatio) {
10026
9986
  if (size > Platform.image.maxCacheSize) return false;
10027
9987
  }
10028
9988
  let maxSize = Platform.image.maxPatternSize;
10029
- if (!image.isSVG) {
9989
+ if (image.isSVG) {
9990
+ const ws = width / image.width;
9991
+ if (ws > 1) imageScale = ws / ceil(ws);
9992
+ } else {
10030
9993
  const imageSize = image.width * image.height;
10031
9994
  if (maxSize > imageSize) maxSize = imageSize;
10032
9995
  }
@@ -10041,18 +10004,20 @@ function createPattern(ui, paint, pixelRatio) {
10041
10004
  scaleX /= sx;
10042
10005
  scaleY /= sy;
10043
10006
  }
10007
+ const xGap = gap && gap.x * scaleX;
10008
+ const yGap = gap && gap.y * scaleY;
10044
10009
  if (transform || scaleX !== 1 || scaleY !== 1) {
10010
+ const canvasWidth = width + (xGap || 0);
10011
+ const canvasHeight = height + (yGap || 0);
10012
+ scaleX /= canvasWidth / max(floor(canvasWidth), 1);
10013
+ scaleY /= canvasHeight / max(floor(canvasHeight), 1);
10045
10014
  if (!imageMatrix) {
10046
10015
  imageMatrix = get$1();
10047
10016
  if (transform) copy$1(imageMatrix, transform);
10048
10017
  }
10049
10018
  scale(imageMatrix, 1 / scaleX, 1 / scaleY);
10050
10019
  }
10051
- if (imageMatrix) {
10052
- const canvasWidth = width + (xGap || 0), canvasHeight = height + (yGap || 0);
10053
- scale(imageMatrix, canvasWidth / max(floor(canvasWidth), 1), canvasHeight / max(floor(canvasHeight), 1));
10054
- }
10055
- const canvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap);
10020
+ const canvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth);
10056
10021
  const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
10057
10022
  paint.style = pattern;
10058
10023
  paint.patternId = id;
@@ -11000,4 +10965,4 @@ Object.assign(Effect, EffectModule);
11000
10965
 
11001
10966
  useCanvas();
11002
10967
 
11003
- export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };
10968
+ export { AlignHelper, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsEvent, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, DragBoundsHelper, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MyImage, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Plugin, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, createAttr, createDescriptor, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, extraPropertyEventMap, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isArray, isData, isEmptyData, isFinite, isNull, isNumber, isObject, isString, isUndefined, layoutProcessor, leaferTransformAttrMap, maskType, naturalBoundsType, opacityType, path, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, scrollType, sortType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix$1 as tempMatrix, tempPoint$2 as tempPoint, tryToNumber, useCanvas, useModule, version, visibleType, zoomLayerType };