I am creating an image viewer with the possibility to put the image into black and white. The image manipulation is preformed by the Pixastic library with some added features of my own. Basically it takes the img and replaces it with a canvas element with a representation off the adjusted image.
Pixastic also provides a revert function that will put the img back instead of the canvas.
My code works perfectly when I press the button. The canvas is created and the black and white image is shown. Now when i move my mouse and press the button again the manipulation is reverted just like intended.
The problem appears when i don't move my mouse and press the button the second time. My function is called but the fields i changed in my function to set is to black and white are still the values they had before the first click.
When I move my mouse between clicks this problem doesn't exist.
I maipulate my image in the first click. With a second click it should undo the maipulation from the first. But when I click the second time it looks like the first click never happend.