Skip to content

2.16 • Scaling by a multiple

Latest

Choose a tag to compare

@KyNorthstar KyNorthstar released this 19 Jan 00:57
· 2 commits to production since this release
dee2425

This release adds .scaling(dimensionsBy:) to TwoDimensional and Rectangle, alongside the existing .scaled(within: functions.

You pass a Length to this new function (e.g. CGFloat for scaling a CGRect) and it multiplies the sides by that number. If it's a rectangle then the returned result is centered within the original rectangle; if not then it's just scaled.

You can optionally also pass a ScaleDirection just like the other scaling functions, and that direction will be respected.

Bug fixes

This release fixes bug #65 by finally forcing .stretch to obey the .down direction: When attempting to stretch-scale something larger than its parent, it'll instead remain (at most) the same size of its parent.