adding resize canvas function for viewer