0

How to clear the current selection (unselect selected objects) programmatically in fabric.js?

After a user hast selected a group, my custom event handler for "selected" runs. Now the group is selected. But I would like it not to be selected.

Witek
  • 6,160
  • 7
  • 43
  • 63
  • 1
    Does this solve your issue? https://stackoverflow.com/questions/20462307/fabric-js-how-to-deselect-one-or-multiple-objects-on-canvas – MalwareMoon Dec 05 '22 at 13:10

1 Answers1

0

canvas.deactivateAllWithDispatch() or just canvas.deactivateAll() if no events should be triggered. Then canvas.renderAll() might be required.

Witek
  • 6,160
  • 7
  • 43
  • 63