鼠标在Bezier曲线上 [英] Mouse Over Bezier Curve
问题描述
有没有简单的集成方法来检测曲线上的鼠标悬停事件?
我希望将bezier曲线添加到画布作为可移动和可编辑的元素,我需要一种方法来选择它们。
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);
推荐答案
这个答案是几年前写的,因为kinetic.js不再维护和链接不工作。
This answer was written several years ago and since kinetic.js is no longer maintained and the links don't work.
你可以尝试concrete.js( http: //www.concretejs.com )。
You can try concrete.js (http://www.concretejs.com).
我会检查kinetic.js库。它是html5 canvas库,支持许多功能,包括曲线检测。你可以在这里尝试一些例子:
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 /
如果您不想使用其他库并且速度仍然很快,可以尝试以下方法。
If you do not want to use other libraries and still have great speed, you could try the following approach.
这篇关于鼠标在Bezier曲线上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!