-
-
Notifications
You must be signed in to change notification settings - Fork 145
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
draw a polygon #84
Comments
Hi, it sounds interesting, we will keep this feature in mind for future updates 🙌 |
Hi Sir , I am using your project and modifying some parts particularly to be able to add and draw polygon to the image that was added on the canvas. I would just like to asks if you have an idea how we can solve the issue of being able to add multiple polygons on the canvas and be able to edit the selected polygon and also be able to delete the selected polygon same as on the shapes like square, circle .etc. I have a working code here which I was able to connect and create polygon and edit it but the thing is I can't solve the adding of multiple polygons and also editing selected polygon and deleting selected polygon. Maybe you have an expertise in fabric js would really be appreciated. Thank you.
|
why are you referencing using:
Current delete function should delete select polygon. and edit polygon (selecting any point on selected polygon should be able to change it). Can you make example stackblitz for better understanding of your issue. |
the issue of Edit is: |
@Saqib92 Hi Sir, good day. So basically, I am creating this app based on Mr. Kevoj angular editor using fabric js. So as you can see on the first screenshot. I have this feature where I can add image on the canvas and then there is a menu on the left side for me to add different shapes like square, circle etc and be able to change the color and the size and also be able to delete the shapes. Now when it comes to the shapes like square, rectable, triangle and circle I already have made it work and it working fine. My current issue is that the I cant make the polygon work the same as those existing shapes. What I want to achieve is be able to draw a polygon which now is working. (just the draw). So when I click the polygon item from the menu I should be able to draw a polygon and have a button set the created polygon as completed so that I can click in the menu again and be able to create another polygon. Next is be able to select from the created polygon in the canvas and be able to move, edit or delete it. As you can see on the screenshot I have a progress now where I can draw and edit but not the multiple functionality where in we can create multiple polygon and select one to edit or delete. This is the stackblitz I created but it does not full work because I am not really familiar with the blitz tool but I have all the code
and for the dialog where In I uses a color picker here is the code
Thank you for the help and ideas. Much Appreciated. |
to your question on what I am referencing using: this.polygon = newPolygon; is The issue I am facing that time with the fill color getting darker each time getClickCoords is called is likely because I am adding the same polygon object (this.polygon) to the canvas each time, and then modifying its fill color. This means that each time I add the polygon, it retains its previous fill color, and the new fill color is layered on top of the old one. To solve this issue, I created a new fabric.Polygon object each time getClickCoords is being called. |
let poly = this.canvas.getActiveObject(); causes the following issue Invalid or undefined 'poly' object. |
Your stackblitz link is very messy. Please update it with minimal code i.e only polygon with an image. |
Hi Sir, I was able to fix the following issues. Thank you for the idea and help @Saqib92 . Very much appreciated. |
Hi Sir, good-day. Is it possible to add or a draw a polygon on top of the image?.
The text was updated successfully, but these errors were encountered: