Mouse Over Bezier Curve

青春壹個敷衍的年華 提交于 2019-12-11 17:44:52

问题


Is there any easy integrated way to detect a mouseover event on a curve? I wish to add bezier curves to the canvas as movable and editable elements and I need a way to select them.

I would rather not use any external libraries (for educational purposes);


回答1:


This answer was written several years ago and since kinetic.js is no longer maintained and the links don't work.

You can try concrete.js (http://www.concretejs.com).

I would check the kinetic.js library. It is html5 canvas library, that supports many features including curve detection. You can try some examples here:

http://www.html5canvastutorials.com/labs/html5-canvas-curve-detection-tutorial/

http://www.html5canvastutorials.com/labs/html5-canvas-physics-engine-with-curve-detection/

http://www.html5canvastutorials.com/labs/html5-canvas-modify-curves-with-anchor-points-using-kineticjs/

If you do not want to use other libraries and still have great speed, you could try the following approach.



来源:https://stackoverflow.com/questions/11815227/mouse-over-bezier-curve

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!