Answered
HTML5 Canvas - Detect button state
I thought this would be simple.
I just want to have a toggle button, so that when clicked, its state stays in the downState, and when clicked again, it goes to the upState. For that to work I would need to know what state the button is in.
This works to the point the button stays in the downStte if clicked, but it's not working for toggling back to the upstate:
this.retinoscopeButton.addEventListener("click", retinoscope.bind(this));
function retinoscope(){
if (retinoscopeButton.upState == true){
retinoscopeButton.upState=retinoscopeButton.downState;
} else if (retinoscopeButton.downState == true){
retinoscopeButton.downState=retinoscopeButton.upState;
}
}
