More intelligent canvas height determination