【发布时间】:2012-02-12 23:19:56
【问题描述】:
我试图弄清楚当鼠标悬停在屏幕上的某个对象上时如何检测处理/处理 js。在这种情况下,我正在画线。似乎处理无法将“侦听器”附加到对象,所以我必须通过某种坐标检测来做到这一点 - 但我还没有找到任何好的例子。到目前为止,这是我的代码:
void draw() {
for(int i = 0; i < commLength; i ++) {
...
line(circ.x, circ.y, circ.x + dir.x, circ.y + dir.y);
}
}
void mouseOver(){
//need to detect if mouse is over one of the lines.
}
【问题讨论】: