开发者

HTML5 Polygonic Selection onmousemove

开发者 https://www.devze.com 2023-04-12 21:33 出处:网络
I need functionality like Photoshop polygon selection tool in HTML 5. I tried using HTML5 Path properties and I can draw lin开发者_C百科e on canvas but can\'t have logic to make that line join and mak

I need functionality like Photoshop polygon selection tool in HTML 5. I tried using HTML5 Path properties and I can draw lin开发者_C百科e on canvas but can't have logic to make that line join and make polygon selection.


You can handle clicks on the canvas and put the click coordinates in an array variable.

You can keep adding the points to path array until the path is complete. A path is complete when the user clicks on the first point after create 3 or more points.


You can use this application to draw your polygon and export it to give you the correct HTML and Javascript canvas statements to produce the polygon on a web page

canvimation

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号