Mikey S.
Mikey S.

Reputation: 3331

Fabric.js - Implementing shape recognition on newly created paths

I would like to add basic shape recognition features to a Fabric.js based project. I currently use the path:created observer to fetch the newly created path and then pass the path representation to a function which can figure if the path creates some kind of shape or not , i'm just wondering how does the entire path is actually represented.

I could see that the path object has a path array which represents the path itself but can't quite figure how it does that, if anyone has a better idea of implementing this sort of feature, I would be more than happy to hear.

Upvotes: 0

Views: 822

Answers (1)

kangax
kangax

Reputation: 39168

The created path is an instance of fabric.Path. fabric.Path more or less mirrors format of SVG <path> element (also see path data). fabric.Path::render parses this data and renders shape accordingly.

Upvotes: 1

Related Questions