add automatic canvas resizing