@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.
- package/.history/package_20251226173335.json +164 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/index.min.mjs +1 -1
- package/dist/index.min.mjs.map +1 -1
- package/dist/index.mjs +44 -0
- package/dist/index.mjs.map +1 -1
- package/dist/index.node.cjs +44 -0
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.mjs +44 -0
- package/dist/index.node.mjs.map +1 -1
- package/dist/src/shapes/Object/InteractiveObject.d.ts.map +1 -1
- package/dist/src/shapes/Object/InteractiveObject.min.mjs +1 -1
- package/dist/src/shapes/Object/InteractiveObject.min.mjs.map +1 -1
- package/dist/src/shapes/Object/InteractiveObject.mjs +44 -0
- package/dist/src/shapes/Object/InteractiveObject.mjs.map +1 -1
- package/dist-extensions/src/shapes/Object/InteractiveObject.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/shapes/Object/InteractiveObject.ts +42 -0
package/dist/index.node.mjs
CHANGED
|
@@ -9654,7 +9654,51 @@ class InteractiveFabricObject extends FabricObject$1 {
|
|
|
9654
9654
|
* @param {ControlRenderingStyleOverride} styleOverride object to override the object style
|
|
9655
9655
|
*/
|
|
9656
9656
|
drawControls(ctx) {
|
|
9657
|
+
var _this$canvas;
|
|
9657
9658
|
let styleOverride = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
9659
|
+
// Check if object is being actively transformed (Canva-style control visibility)
|
|
9660
|
+
// Only hide controls when actually dragging, not just on click/select
|
|
9661
|
+
const currentTransform = (_this$canvas = this.canvas) === null || _this$canvas === void 0 ? void 0 : _this$canvas._currentTransform;
|
|
9662
|
+
const isActivelyTransforming = currentTransform && currentTransform.target === this && this.isMoving; // isMoving is true only during actual drag
|
|
9663
|
+
|
|
9664
|
+
if (isActivelyTransforming) {
|
|
9665
|
+
const activeCorner = currentTransform.corner;
|
|
9666
|
+
|
|
9667
|
+
// Moving (no active corner) - don't draw any controls, just border
|
|
9668
|
+
if (!activeCorner) {
|
|
9669
|
+
return;
|
|
9670
|
+
}
|
|
9671
|
+
|
|
9672
|
+
// Scaling/rotating - only draw the active control
|
|
9673
|
+
const control = this.controls[activeCorner];
|
|
9674
|
+
if (control && control.getVisibility(this, activeCorner)) {
|
|
9675
|
+
ctx.save();
|
|
9676
|
+
const retinaScaling = this.getCanvasRetinaScaling();
|
|
9677
|
+
const {
|
|
9678
|
+
cornerStrokeColor,
|
|
9679
|
+
cornerDashArray,
|
|
9680
|
+
cornerColor
|
|
9681
|
+
} = this;
|
|
9682
|
+
const options = {
|
|
9683
|
+
cornerStrokeColor,
|
|
9684
|
+
cornerDashArray,
|
|
9685
|
+
cornerColor,
|
|
9686
|
+
...styleOverride
|
|
9687
|
+
};
|
|
9688
|
+
ctx.setTransform(retinaScaling, 0, 0, retinaScaling, 0, 0);
|
|
9689
|
+
ctx.strokeStyle = ctx.fillStyle = options.cornerColor;
|
|
9690
|
+
if (!this.transparentCorners) {
|
|
9691
|
+
ctx.strokeStyle = options.cornerStrokeColor;
|
|
9692
|
+
}
|
|
9693
|
+
this._setLineDash(ctx, options.cornerDashArray);
|
|
9694
|
+
const p = this.oCoords[activeCorner];
|
|
9695
|
+
control.render(ctx, p.x, p.y, options, this);
|
|
9696
|
+
ctx.restore();
|
|
9697
|
+
}
|
|
9698
|
+
return;
|
|
9699
|
+
}
|
|
9700
|
+
|
|
9701
|
+
// Normal rendering - draw all controls
|
|
9658
9702
|
ctx.save();
|
|
9659
9703
|
const retinaScaling = this.getCanvasRetinaScaling();
|
|
9660
9704
|
const {
|