@nasser-sw/fabric 7.0.1-beta19 → 7.0.1-beta20

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.
@@ -551,6 +551,48 @@ export class InteractiveFabricObject<
551
551
  ctx: CanvasRenderingContext2D,
552
552
  styleOverride: ControlRenderingStyleOverride = {},
553
553
  ) {
554
+ // Check if object is being actively transformed (Canva-style control visibility)
555
+ // Only hide controls when actually dragging, not just on click/select
556
+ const currentTransform = this.canvas?._currentTransform;
557
+ const isActivelyTransforming =
558
+ currentTransform &&
559
+ (currentTransform.target as unknown) === this &&
560
+ this.isMoving; // isMoving is true only during actual drag
561
+
562
+ if (isActivelyTransforming) {
563
+ const activeCorner = currentTransform!.corner;
564
+
565
+ // Moving (no active corner) - don't draw any controls, just border
566
+ if (!activeCorner) {
567
+ return;
568
+ }
569
+
570
+ // Scaling/rotating - only draw the active control
571
+ const control = this.controls[activeCorner];
572
+ if (control && control.getVisibility(this, activeCorner)) {
573
+ ctx.save();
574
+ const retinaScaling = this.getCanvasRetinaScaling();
575
+ const { cornerStrokeColor, cornerDashArray, cornerColor } = this;
576
+ const options = {
577
+ cornerStrokeColor,
578
+ cornerDashArray,
579
+ cornerColor,
580
+ ...styleOverride,
581
+ };
582
+ ctx.setTransform(retinaScaling, 0, 0, retinaScaling, 0, 0);
583
+ ctx.strokeStyle = ctx.fillStyle = options.cornerColor;
584
+ if (!this.transparentCorners) {
585
+ ctx.strokeStyle = options.cornerStrokeColor;
586
+ }
587
+ this._setLineDash(ctx, options.cornerDashArray);
588
+ const p = this.oCoords[activeCorner];
589
+ control.render(ctx, p.x, p.y, options, this);
590
+ ctx.restore();
591
+ }
592
+ return;
593
+ }
594
+
595
+ // Normal rendering - draw all controls
554
596
  ctx.save();
555
597
  const retinaScaling = this.getCanvasRetinaScaling();
556
598
  const { cornerStrokeColor, cornerDashArray, cornerColor } = this;