[Vuejs]-Fabricjs how to double-click a picture(or rect) to edit text and name it

0👍

Based on your requirements, you can

  1. Create a subclass of Image class (or whatever object that you need to attach a label to)
  2. Make it create an instance of IText or Textbox and save an internal reference to it
  3. By hooking into the event handlers on the image (e.g. double click), manually manage the events of the text. Make sure to keep the position and dimensions of the text updated when the image is modified.

Take a look at this answer: Resize Fabric Rect without resizing Textbox. It does something very similar to what you’ve described.

Leave a comment