I have a large interactive tree-like structure with clickable branches and leaves.
The code works as follows:
setup(){
//main setup
}
update(input){
tree.update(input);
}
draw(){
tree.draw();
}
class Tree{
// tree stuff
update(){
}
draw(){
clicked?{
// do stuff
}else{
//do other stuff
}
}
boolean clicked(){
is the mouse within the branch? return true
}
}
The tree gets updated ONCE and then is just being drawn.
I use translate() with mouseDragged(). Everything works fine, however when I do the translation I loose the clickability. The whole structure is displayed correctly though. I guess it's because the coordinates are set in the very beginning. Strangely the drawing translates perfectly, just the click fails.