Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make Fabric.js object draggable but not "selectable"

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.

like image 593
Zwade Avatar asked Feb 12 '13 22:02

Zwade


2 Answers

on creation pass following options to object:

hasBorders: false
hasControls: false
hasRotatingPoint: false
like image 149
rdo Avatar answered Oct 30 '22 04:10

rdo


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

This is the line that does it

canvas.item(0).hasControls = false;
like image 22
Zwade Avatar answered Oct 30 '22 04:10

Zwade