Make Fabric.js object draggable but not "selectable"

Zwade picture Zwade · Feb 12, 2013 · Viewed 10.7k times · Source

Fabric.js has this really cool aspect where it allows, by default, all objects to be "selectable", which means they are able to be dragged, resized, and rotated. However, I would like for them to be draggable only, no resizing or rotating. Is this possible? I don't mind mucking with the source if that is what's needed, it would be better than reimplementing it myself.

Answer

Zwade picture Zwade · Feb 12, 2013

Nevermind, I have found the answer here: http://fabricjs.com/customization/

This is the line that does it

canvas.item(0).hasControls = false;