Adds resize event handler for canvas