1
我想弄清楚如何检测处理/处理js时鼠标在屏幕上的某个对象。在这种情况下,我正在画线。看起来处理不能将“监听器”附加到对象上,所以我必须通过某种坐标检测来完成此操作 - 但我还没有找到任何这方面的好例子。这是到目前为止我的代码:处理 - mouseOver对象
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.
}