Fabric.js : How to Update textbox width and font size on group scaling. #10003
Replies: 3 comments 3 replies
-
You can upgrade to version 6.0 to write custom controllers, which will allow you to achieve the desired result. import type { Control } from "fabric";
import { Group } from "fabric";
Group.createControls = (): { controls: Record<string, Control> } => ({ controls: createControls() });
function createControls() {
const tl = new Control({...});
const tr = new Control({...});
...
return { mb, mt,ml, mr, tl, tr, bl, br }
} |
Beta Was this translation helpful? Give feedback.
-
@niketaOptimumnbrew scaling of a group can be done by control, by code or when the group is scaled because is inside an active selection. The object will look the same unless you are using patterns or gradients as fill/stroke. You have to write a function that given the textbox will set the scale factor to 1 and multiply fontSize and width by the old scale, that's it. is simple. |
Beta Was this translation helpful? Give feedback.
-
Screen.Recording.2024-08-19.at.17.01.13.movis it ? try below code
|
Beta Was this translation helpful? Give feedback.
-
Hey,
I'm using fabric.js version 5.3.0.
I want to update textbox width and font size of object depending on group / active selection scaling.
Any idea how to do that?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions