void detectmousePressed() { if(mousePressed==true) { caughti=t.pressed(caughti, mouseX,mouseY); t.update(); s1.pressed(mouseX, mouseY); } } void mouseReleased() { caughti=-1; if(add==true) { if(search==true && parentn!=-1) { search=false; } } if(delete==true) { if(parentnd > -1) { //t.deletebranch(parentnd); t.deletechildren(parentnd); parentnd=-1; } } } void drawMODE() { int posx=17; int posy=290; fill(100); text("press h to show or hide mini trees",posx,posy-40); text("press: e select, a add, d delete",posx,posy-20); if(add==true) { text("mode:ADD",posx,posy);} else if(delete==true) { text("mode:DELETE",posx,posy);} else {text("mode:SELECT",posx,posy);} } void keyPressed() { float up; if(key=='a') { add=true; delete=false; } if(key=='d') { delete=true; add=false; } if(key=='e') { add=false; parentn=-1; search=true; delete=false; parentnd=-1; searchd=true; } if(key=='h') { showEX=!showEX; for(int i=0; i < B.length; i++) { B[i].setRENDERT(showEX); } if(showEX==false) { up=-1;} else {up=1;} for(int i=0; i < B.length; i++) { if(i<5) { B[i].setCY(B[i].getCY()+up*100); } else { B[i].setCY(B[i].getCY()+up*150); } } s1.setSY(s1.getSY()+up*170); } } void mousePressed() { for(int i=0; i < B.length; i++) { B[i].pressed(mouseX,mouseY); } if(add==true) { if(parentn == -1 && search==true) { parentn = t.giveparent(mouseX,mouseY); } else if(search == false && parentn != -1) { t.addbranch(parentn, mouseX, mouseY); search = true; parentn=-1; } } if(delete==true) { parentnd = t.giveparent(mouseX,mouseY); } } int ButtonVal() { int value; for(int i=0; i < B.length; i++) { value = int(B[i].givev()); if(value > 0) { return value; } } return -1; }