optimize canvas viewport