I guess that the loadImage will not load the image again if already loaded.
Meaning that when you call loadImage on the third click the call to loadImage(…1.png) will not trigger onImageLoaded.
You could use the isImageLoaded call in the onClick to check if it needs loading, if already loaded you can call the drawImage directly.
↧