leafer-draw 2.0.6 → 2.0.7

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
@@ -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.7";
6641
6667
  const debug$4 = Debug.get("LeaferCanvas");
6642
6668
  class LeaferCanvas extends LeaferCanvasBase {
6643
6669
  set zIndex(zIndex) {
@@ -8085,7 +8111,7 @@ var LeaferUI = function(exports) {
8085
8111
  __updateRenderPath(updateCache) {
8086
8112
  const data = this.__;
8087
8113
  if (data.path) {
8088
- data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
8114
+ data.__pathForRender = data.cornerRadius || data.path.radius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
8089
8115
  if (data.__useArrow) PathArrow.addArrows(this, updateCache);
8090
8116
  } else data.__pathForRender && (data.__pathForRender = undefined);
8091
8117
  }
@@ -8804,7 +8830,7 @@ var LeaferUI = function(exports) {
8804
8830
  }
8805
8831
  }
8806
8832
  if (!open) closePath$2(path);
8807
- if (Platform.ellipseToCurve || data.__useArrow) data.path = this.getPath(true);
8833
+ if (Platform.ellipseToCurve || data.__useArrow || data.cornerRadius) data.path = this.getPath(true);
8808
8834
  }
8809
8835
  };
8810
8836
  __decorate([ dataProcessor(EllipseData) ], exports.Ellipse.prototype, "__", void 0);
@@ -8822,7 +8848,7 @@ var LeaferUI = function(exports) {
8822
8848
  const data = this.__;
8823
8849
  const path = data.path = [];
8824
8850
  if (data.points) {
8825
- drawPoints$1(path, data.points, data.curve, true);
8851
+ drawPoints$1(path, data.points, data.curve, data.closed);
8826
8852
  } else {
8827
8853
  const {width: width, height: height, sides: sides} = data;
8828
8854
  const rx = width / 2, ry = height / 2;