Zwade
Zwade

Reputation: 1712

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.

Upvotes: 10

Views: 11796

Answers (2)

rdo
rdo

Reputation: 3982

on creation pass following options to object:

hasBorders: false
hasControls: false
hasRotatingPoint: false

Upvotes: 9

Zwade
Zwade

Reputation: 1712

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

This is the line that does it

canvas.item(0).hasControls = false;

Upvotes: 11

Related Questions