correctly positioning contentView and scroll offsets when scaling
Added consideration for horizontalAlign and verticalAlign properties
Added null check