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