tbolis / react-sketch

Sketch Tool for React-based applications, backed up by FabricJS
http://tbolis.github.io/showcase/react-sketch/
MIT License
683 stars 230 forks source link

Getting drawn rectangles? #168

Closed agaertner closed 2 years ago

agaertner commented 2 years ago

Hey, how can I get a list of drawn rectangles?

Eg.

            rects: [
                {"topLeftY": 122, "topLeftX": 122, "width": 122, "height": 122},
            ]
huy-lv commented 2 years ago

Try this:

<SketchField ref={sketchRef} />
...
const drawnObjects = sketchRef.current.toJSON()