Posts

Showing posts from January 6, 2019

how to rotate line in fabricjs by clicking any point to select/drag?

Image
2 I have a line with one end at a fixed point that can be rotated or stretched by the user. jsfiddle here It seems that in fabricJS the only way to select a line/object for rotation is the little selection box in the middle. Also, a line is narrow so it is hard to select. Typically one must drag a rectangular selection box across the line to select it, then grab the unlabeled rotation box. I want to simplify this to: click anywhere on the line and drag to rotate. ideas? thx. code snippet: var canvas = new fabric.Canvas("c", {stateful: true}); var line1 = new fabric.Line([ 100, 200, 330, 200 ], { fill: 'red', stroke: 'red', strokeWidth: 3, selectable: true, evented: false, minScaleLimit: 0.25, lockRotation: false, centered...