I am having a problem where I don't know where to go with it.
When i click 1 of the black rectangles it shows "Rectangle 0 clicked" but the canvas disappear.
How can I make it to show it in the canvas ???
for (var i = 0; i < rects.length; i++) {
if (x > rects[i][0] && x < rects[i][0] + rects[i][2] && y > rects[i][1] && y < rects[i][1] + rects[i][3]) {
document.getElementById("Display").innerHTML = 'Rectangle ' + i + ' clicked';
}
}
Aucun commentaire:
Enregistrer un commentaire