Here I'm using the zoom() function when a user clicks on the zoom_in, zoom_out buttons. The img_update() function is used to redraw the canvas element. Now zoom works only after I'm painting on the canvas, but I'd like to see zoom effect immediately after the user clicks on the zoom buttons. How can I fix this?