@nasser-sw/fabric 7.0.1-beta5 → 7.0.1-beta6

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/index.mjs CHANGED
@@ -17628,14 +17628,10 @@ class Line extends FabricObject {
17628
17628
  };
17629
17629
  }
17630
17630
  _p1PositionHandler() {
17631
- var _this$canvas;
17632
- const vpt = ((_this$canvas = this.canvas) === null || _this$canvas === void 0 ? void 0 : _this$canvas.viewportTransform) || [1, 0, 0, 1, 0, 0];
17633
- return new Point(this.x1, this.y1).transform(vpt);
17631
+ return new Point(this.x1, this.y1).transform(this.getViewportTransform());
17634
17632
  }
17635
17633
  _p2PositionHandler() {
17636
- var _this$canvas2;
17637
- const vpt = ((_this$canvas2 = this.canvas) === null || _this$canvas2 === void 0 ? void 0 : _this$canvas2.viewportTransform) || [1, 0, 0, 1, 0, 0];
17638
- return new Point(this.x2, this.y2).transform(vpt);
17634
+ return new Point(this.x2, this.y2).transform(this.getViewportTransform());
17639
17635
  }
17640
17636
  _renderEndpointControl(ctx, left, top) {
17641
17637
  const size = 12;
@@ -17658,9 +17654,9 @@ class Line extends FabricObject {
17658
17654
  return super.drawBorders(ctx, styleOverride, {});
17659
17655
  }
17660
17656
  _drawLineBorders(ctx) {
17661
- var _this$canvas3;
17657
+ var _this$canvas;
17662
17658
  let styleOverride = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
17663
- const vpt = ((_this$canvas3 = this.canvas) === null || _this$canvas3 === void 0 ? void 0 : _this$canvas3.viewportTransform) || [1, 0, 0, 1, 0, 0];
17659
+ const vpt = ((_this$canvas = this.canvas) === null || _this$canvas === void 0 ? void 0 : _this$canvas.viewportTransform) || [1, 0, 0, 1, 0, 0];
17664
17660
  ctx.save();
17665
17661
  ctx.setTransform(vpt[0], vpt[1], vpt[2], vpt[3], vpt[4], vpt[5]);
17666
17662
  ctx.strokeStyle = styleOverride.borderColor || this.borderColor || 'rgba(100, 200, 200, 0.5)';
@@ -17736,8 +17732,8 @@ class Line extends FabricObject {
17736
17732
  }
17737
17733
  containsPoint(point) {
17738
17734
  if (this._useEndpointCoords) {
17739
- var _this$canvas4;
17740
- if (((_this$canvas4 = this.canvas) === null || _this$canvas4 === void 0 ? void 0 : _this$canvas4.getActiveObject()) === this) {
17735
+ var _this$canvas2;
17736
+ if (((_this$canvas2 = this.canvas) === null || _this$canvas2 === void 0 ? void 0 : _this$canvas2.getActiveObject()) === this) {
17741
17737
  return super.containsPoint(point);
17742
17738
  }
17743
17739
  const distance = this._distanceToLineSegment(point.x, point.y);
@@ -17771,7 +17767,7 @@ class Line extends FabricObject {
17771
17767
  return Math.sqrt((px - closestX) * (px - closestX) + (py - closestY) * (py - closestY));
17772
17768
  }
17773
17769
  _endpointActionHandler(eventData, transformData, x, y) {
17774
- var _this$canvas6;
17770
+ var _this$canvas4;
17775
17771
  const controlKey = transformData.corner;
17776
17772
  const pointer = new Point(x, y);
17777
17773
  let newX = pointer.x;
@@ -17785,7 +17781,7 @@ class Line extends FabricObject {
17785
17781
  newY = snapped.y;
17786
17782
  }
17787
17783
  if (this._useEndpointCoords) {
17788
- var _this$canvas5;
17784
+ var _this$canvas3;
17789
17785
  if (controlKey === 'p1') {
17790
17786
  this.x1 = newX;
17791
17787
  this.y1 = newY;
@@ -17795,7 +17791,7 @@ class Line extends FabricObject {
17795
17791
  }
17796
17792
  this.dirty = true;
17797
17793
  this.setCoords();
17798
- (_this$canvas5 = this.canvas) === null || _this$canvas5 === void 0 || _this$canvas5.requestRenderAll();
17794
+ (_this$canvas3 = this.canvas) === null || _this$canvas3 === void 0 || _this$canvas3.requestRenderAll();
17799
17795
  return true;
17800
17796
  }
17801
17797
 
@@ -17811,7 +17807,7 @@ class Line extends FabricObject {
17811
17807
  this._setWidthHeight();
17812
17808
  this.dirty = true;
17813
17809
  this._updatingEndpoints = false;
17814
- (_this$canvas6 = this.canvas) === null || _this$canvas6 === void 0 || _this$canvas6.requestRenderAll();
17810
+ (_this$canvas4 = this.canvas) === null || _this$canvas4 === void 0 || _this$canvas4.requestRenderAll();
17815
17811
  this.fire('modified', {
17816
17812
  transform: transformData,
17817
17813
  target: this,
@@ -17886,11 +17882,9 @@ class Line extends FabricObject {
17886
17882
  super.render(ctx);
17887
17883
  }
17888
17884
  _renderDirectly(ctx) {
17889
- var _this$canvas7, _this$stroke;
17885
+ var _this$stroke;
17890
17886
  if (!this.visible) return;
17891
17887
  ctx.save();
17892
- const vpt = ((_this$canvas7 = this.canvas) === null || _this$canvas7 === void 0 ? void 0 : _this$canvas7.viewportTransform) || [1, 0, 0, 1, 0, 0];
17893
- ctx.transform(vpt[0], vpt[1], vpt[2], vpt[3], vpt[4], vpt[5]);
17894
17888
  ctx.globalAlpha = this.opacity;
17895
17889
  ctx.strokeStyle = ((_this$stroke = this.stroke) === null || _this$stroke === void 0 ? void 0 : _this$stroke.toString()) || '#000';
17896
17890
  ctx.lineWidth = this.strokeWidth;