Introduce getDimWithMargin helper