calculate ideal view box