@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.
@@ -17684,14 +17684,10 @@ class Line extends FabricObject {
17684
17684
  };
17685
17685
  }
17686
17686
  _p1PositionHandler() {
17687
- var _this$canvas;
17688
- const vpt = ((_this$canvas = this.canvas) === null || _this$canvas === void 0 ? void 0 : _this$canvas.viewportTransform) || [1, 0, 0, 1, 0, 0];
17689
- return new Point(this.x1, this.y1).transform(vpt);
17687
+ return new Point(this.x1, this.y1).transform(this.getViewportTransform());
17690
17688
  }
17691
17689
  _p2PositionHandler() {
17692
- var _this$canvas2;
17693
- const vpt = ((_this$canvas2 = this.canvas) === null || _this$canvas2 === void 0 ? void 0 : _this$canvas2.viewportTransform) || [1, 0, 0, 1, 0, 0];
17694
- return new Point(this.x2, this.y2).transform(vpt);
17690
+ return new Point(this.x2, this.y2).transform(this.getViewportTransform());
17695
17691
  }
17696
17692
  _renderEndpointControl(ctx, left, top) {
17697
17693
  const size = 12;
@@ -17714,9 +17710,9 @@ class Line extends FabricObject {
17714
17710
  return super.drawBorders(ctx, styleOverride, {});
17715
17711
  }
17716
17712
  _drawLineBorders(ctx) {
17717
- var _this$canvas3;
17713
+ var _this$canvas;
17718
17714
  let styleOverride = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
17719
- const vpt = ((_this$canvas3 = this.canvas) === null || _this$canvas3 === void 0 ? void 0 : _this$canvas3.viewportTransform) || [1, 0, 0, 1, 0, 0];
17715
+ const vpt = ((_this$canvas = this.canvas) === null || _this$canvas === void 0 ? void 0 : _this$canvas.viewportTransform) || [1, 0, 0, 1, 0, 0];
17720
17716
  ctx.save();
17721
17717
  ctx.setTransform(vpt[0], vpt[1], vpt[2], vpt[3], vpt[4], vpt[5]);
17722
17718
  ctx.strokeStyle = styleOverride.borderColor || this.borderColor || 'rgba(100, 200, 200, 0.5)';
@@ -17792,8 +17788,8 @@ class Line extends FabricObject {
17792
17788
  }
17793
17789
  containsPoint(point) {
17794
17790
  if (this._useEndpointCoords) {
17795
- var _this$canvas4;
17796
- if (((_this$canvas4 = this.canvas) === null || _this$canvas4 === void 0 ? void 0 : _this$canvas4.getActiveObject()) === this) {
17791
+ var _this$canvas2;
17792
+ if (((_this$canvas2 = this.canvas) === null || _this$canvas2 === void 0 ? void 0 : _this$canvas2.getActiveObject()) === this) {
17797
17793
  return super.containsPoint(point);
17798
17794
  }
17799
17795
  const distance = this._distanceToLineSegment(point.x, point.y);
@@ -17827,7 +17823,7 @@ class Line extends FabricObject {
17827
17823
  return Math.sqrt((px - closestX) * (px - closestX) + (py - closestY) * (py - closestY));
17828
17824
  }
17829
17825
  _endpointActionHandler(eventData, transformData, x, y) {
17830
- var _this$canvas6;
17826
+ var _this$canvas4;
17831
17827
  const controlKey = transformData.corner;
17832
17828
  const pointer = new Point(x, y);
17833
17829
  let newX = pointer.x;
@@ -17841,7 +17837,7 @@ class Line extends FabricObject {
17841
17837
  newY = snapped.y;
17842
17838
  }
17843
17839
  if (this._useEndpointCoords) {
17844
- var _this$canvas5;
17840
+ var _this$canvas3;
17845
17841
  if (controlKey === 'p1') {
17846
17842
  this.x1 = newX;
17847
17843
  this.y1 = newY;
@@ -17851,7 +17847,7 @@ class Line extends FabricObject {
17851
17847
  }
17852
17848
  this.dirty = true;
17853
17849
  this.setCoords();
17854
- (_this$canvas5 = this.canvas) === null || _this$canvas5 === void 0 || _this$canvas5.requestRenderAll();
17850
+ (_this$canvas3 = this.canvas) === null || _this$canvas3 === void 0 || _this$canvas3.requestRenderAll();
17855
17851
  return true;
17856
17852
  }
17857
17853
 
@@ -17867,7 +17863,7 @@ class Line extends FabricObject {
17867
17863
  this._setWidthHeight();
17868
17864
  this.dirty = true;
17869
17865
  this._updatingEndpoints = false;
17870
- (_this$canvas6 = this.canvas) === null || _this$canvas6 === void 0 || _this$canvas6.requestRenderAll();
17866
+ (_this$canvas4 = this.canvas) === null || _this$canvas4 === void 0 || _this$canvas4.requestRenderAll();
17871
17867
  this.fire('modified', {
17872
17868
  transform: transformData,
17873
17869
  target: this,
@@ -17942,11 +17938,9 @@ class Line extends FabricObject {
17942
17938
  super.render(ctx);
17943
17939
  }
17944
17940
  _renderDirectly(ctx) {
17945
- var _this$canvas7, _this$stroke;
17941
+ var _this$stroke;
17946
17942
  if (!this.visible) return;
17947
17943
  ctx.save();
17948
- const vpt = ((_this$canvas7 = this.canvas) === null || _this$canvas7 === void 0 ? void 0 : _this$canvas7.viewportTransform) || [1, 0, 0, 1, 0, 0];
17949
- ctx.transform(vpt[0], vpt[1], vpt[2], vpt[3], vpt[4], vpt[5]);
17950
17944
  ctx.globalAlpha = this.opacity;
17951
17945
  ctx.strokeStyle = ((_this$stroke = this.stroke) === null || _this$stroke === void 0 ? void 0 : _this$stroke.toString()) || '#000';
17952
17946
  ctx.lineWidth = this.strokeWidth;