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