ailon / markerjs2

Add image annotation to your web apps.
https://markerjs.com
Other
142 stars 39 forks source link

Is there a way to make a polygon? Which base should I inherit? #140

Closed kor-devops closed 1 year ago

kor-devops commented 1 year ago

I want to create a custom marker. Can we make a polygon? Which marker base should I inherit?

ailon commented 1 year ago

Depends on what you mean by "polygon". If you are talking about user drawing a totally custom polygon, then you'd need to go down to the MarkerBase. There's nothing built-in in marker.js to help you. On the other hand, if you want to create a marker representing a specific polygon like a star or a hexagon or whatever, then there's a tutorial for that.

kor-devops commented 1 year ago

Thank you!

kor-devops commented 1 year ago

I'm sorry, but I'll ask you an additional question.

I want to make a polygon with four vertices. Should I use the RectangularBoxMarkerBase?

Where should I refer to if I want to insert shapes with code instead of mouse selection?

ailon commented 1 year ago

1) If you mean a "fixed" shape polygon then yes. Just refer to the tutorial/sample I mentioned. You just change the triangle drawn to whatever you want to draw.

2) marker.js 2 is focusing on interactive marker creation. While it's probably possible to insert the marker from code, it's not the intended usage scenario.