@leafer-draw/worker 2.0.6 → 2.0.8

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/worker.js CHANGED
@@ -2709,6 +2709,32 @@ var LeaferUI = function(exports) {
2709
2709
  getDerivative(t, fromV, v1, v2, toV) {
2710
2710
  const o = 1 - t;
2711
2711
  return 3 * o * o * (v1 - fromV) + 6 * o * t * (v2 - v1) + 3 * t * t * (toV - v2);
2712
+ },
2713
+ cut(t, fromX, fromY, x1, y1, x2, y2, toX, toY) {
2714
+ if (t <= 0) return {
2715
+ left: null,
2716
+ right: [ x1, y1, x2, y2, toX, toY ]
2717
+ }; else if (t >= 1) return {
2718
+ left: [ x1, y1, x2, y2, toX, toY ],
2719
+ right: null
2720
+ };
2721
+ const u = 1 - t;
2722
+ const leftX1 = fromX * u + x1 * t;
2723
+ const leftY1 = fromY * u + y1 * t;
2724
+ const P12x = x1 * u + x2 * t;
2725
+ const P12y = y1 * u + y2 * t;
2726
+ const rightX2 = x2 * u + toX * t;
2727
+ const rightY2 = y2 * u + toY * t;
2728
+ const leftX2 = leftX1 * u + P12x * t;
2729
+ const leftY2 = leftY1 * u + P12y * t;
2730
+ const rightX1 = P12x * u + rightX2 * t;
2731
+ const rightY1 = P12y * u + rightY2 * t;
2732
+ const leftX = leftX2 * u + rightX1 * t;
2733
+ const leftY = leftY2 * u + rightY1 * t;
2734
+ return {
2735
+ left: [ leftX1, leftY1, leftX2, leftY2, leftX, leftY ],
2736
+ right: [ rightX1, rightY1, rightX2, rightY2, toX, toY ]
2737
+ };
2712
2738
  }
2713
2739
  };
2714
2740
  const {getPointAndSet: getPointAndSet, toTwoPointBounds: toTwoPointBounds$1, ellipse: ellipse$6} = BezierHelper;
@@ -6637,7 +6663,7 @@ var LeaferUI = function(exports) {
6637
6663
  this.levelMap = null;
6638
6664
  }
6639
6665
  }
6640
- const version = "2.0.6";
6666
+ const version = "2.0.8";
6641
6667
  class LeaferCanvas extends LeaferCanvasBase {
6642
6668
  get allowBackgroundColor() {
6643
6669
  return true;
@@ -7891,7 +7917,7 @@ var LeaferUI = function(exports) {
7891
7917
  __updateRenderPath(updateCache) {
7892
7918
  const data = this.__;
7893
7919
  if (data.path) {
7894
- data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
7920
+ data.__pathForRender = data.cornerRadius || data.path.radius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
7895
7921
  if (data.__useArrow) PathArrow.addArrows(this, updateCache);
7896
7922
  } else data.__pathForRender && (data.__pathForRender = undefined);
7897
7923
  }
@@ -8610,7 +8636,7 @@ var LeaferUI = function(exports) {
8610
8636
  }
8611
8637
  }
8612
8638
  if (!open) closePath$2(path);
8613
- if (Platform.ellipseToCurve || data.__useArrow) data.path = this.getPath(true);
8639
+ if (Platform.ellipseToCurve || data.__useArrow || data.cornerRadius) data.path = this.getPath(true);
8614
8640
  }
8615
8641
  };
8616
8642
  __decorate([ dataProcessor(EllipseData) ], exports.Ellipse.prototype, "__", void 0);
@@ -8628,7 +8654,7 @@ var LeaferUI = function(exports) {
8628
8654
  const data = this.__;
8629
8655
  const path = data.path = [];
8630
8656
  if (data.points) {
8631
- drawPoints$1(path, data.points, data.curve, true);
8657
+ drawPoints$1(path, data.points, data.curve, data.closed);
8632
8658
  } else {
8633
8659
  const {width: width, height: height, sides: sides} = data;
8634
8660
  const rx = width / 2, ry = height / 2;