@leafer-ui/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;
@@ -8086,7 +8112,7 @@ var LeaferUI = function(exports) {
8086
8112
  __updateRenderPath(updateCache) {
8087
8113
  const data = this.__;
8088
8114
  if (data.path) {
8089
- data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
8115
+ data.__pathForRender = data.cornerRadius || data.path.radius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
8090
8116
  if (data.__useArrow) PathArrow.addArrows(this, updateCache);
8091
8117
  } else data.__pathForRender && (data.__pathForRender = undefined);
8092
8118
  }
@@ -8805,7 +8831,7 @@ var LeaferUI = function(exports) {
8805
8831
  }
8806
8832
  }
8807
8833
  if (!open) closePath$2(path);
8808
- if (Platform.ellipseToCurve || data.__useArrow) data.path = this.getPath(true);
8834
+ if (Platform.ellipseToCurve || data.__useArrow || data.cornerRadius) data.path = this.getPath(true);
8809
8835
  }
8810
8836
  };
8811
8837
  __decorate([ dataProcessor(EllipseData) ], exports.Ellipse.prototype, "__", void 0);
@@ -8823,7 +8849,7 @@ var LeaferUI = function(exports) {
8823
8849
  const data = this.__;
8824
8850
  const path = data.path = [];
8825
8851
  if (data.points) {
8826
- drawPoints$1(path, data.points, data.curve, true);
8852
+ drawPoints$1(path, data.points, data.curve, data.closed);
8827
8853
  } else {
8828
8854
  const {width: width, height: height, sides: sides} = data;
8829
8855
  const rx = width / 2, ry = height / 2;