I'm trying to figure out how to detect in processing / processing js when the mouse is over a certain object on screen. In this case, I am drawing lines. It seems like processing can't attach a "listener" to an object, so I would have to do this with some sort of coordinate detection - but I haven't found any good examples of this. This is my code so far:
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.
}