@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.mjs
CHANGED
|
@@ -9598,7 +9598,51 @@ class InteractiveFabricObject extends FabricObject$1 {
|
|
|
9598
9598
|
* @param {ControlRenderingStyleOverride} styleOverride object to override the object style
|
|
9599
9599
|
*/
|
|
9600
9600
|
drawControls(ctx) {
|
|
9601
|
+
var _this$canvas;
|
|
9601
9602
|
let styleOverride = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
9603
|
+
// Check if object is being actively transformed (Canva-style control visibility)
|
|
9604
|
+
// Only hide controls when actually dragging, not just on click/select
|
|
9605
|
+
const currentTransform = (_this$canvas = this.canvas) === null || _this$canvas === void 0 ? void 0 : _this$canvas._currentTransform;
|
|
9606
|
+
const isActivelyTransforming = currentTransform && currentTransform.target === this && this.isMoving; // isMoving is true only during actual drag
|
|
9607
|
+
|
|
9608
|
+
if (isActivelyTransforming) {
|
|
9609
|
+
const activeCorner = currentTransform.corner;
|
|
9610
|
+
|
|
9611
|
+
// Moving (no active corner) - don't draw any controls, just border
|
|
9612
|
+
if (!activeCorner) {
|
|
9613
|
+
return;
|
|
9614
|
+
}
|
|
9615
|
+
|
|
9616
|
+
// Scaling/rotating - only draw the active control
|
|
9617
|
+
const control = this.controls[activeCorner];
|
|
9618
|
+
if (control && control.getVisibility(this, activeCorner)) {
|
|
9619
|
+
ctx.save();
|
|
9620
|
+
const retinaScaling = this.getCanvasRetinaScaling();
|
|
9621
|
+
const {
|
|
9622
|
+
cornerStrokeColor,
|
|
9623
|
+
cornerDashArray,
|
|
9624
|
+
cornerColor
|
|
9625
|
+
} = this;
|
|
9626
|
+
const options = {
|
|
9627
|
+
cornerStrokeColor,
|
|
9628
|
+
cornerDashArray,
|
|
9629
|
+
cornerColor,
|
|
9630
|
+
...styleOverride
|
|
9631
|
+
};
|
|
9632
|
+
ctx.setTransform(retinaScaling, 0, 0, retinaScaling, 0, 0);
|
|
9633
|
+
ctx.strokeStyle = ctx.fillStyle = options.cornerColor;
|
|
9634
|
+
if (!this.transparentCorners) {
|
|
9635
|
+
ctx.strokeStyle = options.cornerStrokeColor;
|
|
9636
|
+
}
|
|
9637
|
+
this._setLineDash(ctx, options.cornerDashArray);
|
|
9638
|
+
const p = this.oCoords[activeCorner];
|
|
9639
|
+
control.render(ctx, p.x, p.y, options, this);
|
|
9640
|
+
ctx.restore();
|
|
9641
|
+
}
|
|
9642
|
+
return;
|
|
9643
|
+
}
|
|
9644
|
+
|
|
9645
|
+
// Normal rendering - draw all controls
|
|
9602
9646
|
ctx.save();
|
|
9603
9647
|
const retinaScaling = this.getCanvasRetinaScaling();
|
|
9604
9648
|
const {
|