Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating Rectangle shape #2

Open
thesunnypro opened this issue Jan 11, 2017 · 6 comments
Open

Creating Rectangle shape #2

thesunnypro opened this issue Jan 11, 2017 · 6 comments

Comments

@thesunnypro
Copy link

Hey devs,

How do I draw a rectangle with this module. Default one seems to draw only circle.

Help will be highly appreciated.

@Akkusativobjekt
Copy link

I have a working solution for this enhancement, which I could provide if desired. I extended the functionality of the ng2-img-map class that it can distinguish circles (marker with two numbers) and rectangles (mark with four numbers: x, y , width, height).

Problem with with approach is that it feels inconsistent if one uses only rectangles, but can set the markerRadius, which won't have any effect. Possible solution here would be to move the radius to the markers array (x,y, radius), which would also allow cirlces with different radii/radiuses

@christyTarento
Copy link

Hey @Akkusativobjekt

have you updated the module to accept rectangles?

Thanks

@kunmi
Copy link

kunmi commented Aug 16, 2018

I have this implemented in the version I forked, along with polygons, image-icons, and drag-support for the aforementioned components. I will comment, clean-up the code and make a pull-request soon.

@MattWlodarski
Copy link

Hey @kunmi how do I get access to your updated version? I need to be able to draw polygons. Thanks!

@kunmi
Copy link

kunmi commented Feb 26, 2019

@MattWlodarski
I just pushed it to feature_polygon. Would do some cleanup, properly document and update the README.md file to include how to use the parts by the weekend (or after work tomorrow; tho I haven't touched angular in a loooong while).

Quick notes (included in the branch feature_polygon)

  • Draw polygon (as many as possible) programatically or through the UI -> double click to start drawing, single click other points to signify vertexes (denoted by small circles), the edge to next vertex also follows your mouse.
  • New marker types (Image and composite markers->image+shape)
  • Polygons and markers support; click, double click and drag actions; they also have events attached to them, as well visual feedback/cursor/highlighting
  • Convinience method for retriving all markers within a polygon
  • Change event for all marker / polygon types
  • Cordinates representation for polygon, also same as default scheme from main project (ratio of the UI)

This was also my first and last foray into angular, I tried adhering as much as possible to the design patterns; sorry if I in some ways; I might have disobeyed some patterns.

I HOPE ITS HELPFUL 👍

@koncarevicradovan
Copy link

Hey @kunmi are rectangles available now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants