Cathy
Cathy

Reputation: 377

How to display the dimensions of group and non group shape in canvas

I am doing a project using fabric.js in that I want to display the shape dimensions in canvas and the dimension should change according to drag,drop and resize. Here is the image. Edit: I have to display the dimensions(height,width and angle) for non group shape and group shape using onclick listener.I need help regarding in this any help or hint would be great. Thanks in advance.

Upvotes: 3

Views: 263

Answers (1)

rodrigopandini
rodrigopandini

Reputation: 945

You can listen to object:scaling events and update the text objectc accordingly, getting the width and height using the functions that @kangax said. You will also need reposition the texts when you resize the object.
Check this link: http://fabricjs.com/events/

Upvotes: 2

Related Questions