change canvas resize logic