mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Add comment explaining why we use scale
This commit is contained in:
@ -42,6 +42,11 @@ namespace osu.Game.Graphics.Containers
|
|||||||
base.Update();
|
base.Update();
|
||||||
if (InternalChildren.Count > 0 && InternalChild.DrawSize.X > 0)
|
if (InternalChildren.Count > 0 && InternalChild.DrawSize.X > 0)
|
||||||
{
|
{
|
||||||
|
// We're modifying scale here for a few reasons
|
||||||
|
// - Guarantees correctness if BorderWidth is being used
|
||||||
|
// - If we were to use RelativeSize/FillMode, we'd need to set the Icon's RelativeSizeAxes directly.
|
||||||
|
// We can't do this because we would need access to AutoSizeAxes to set it to none.
|
||||||
|
// Other issues come up along the way too, so it's not a good solution.
|
||||||
var fitScale = Math.Min(DrawSize.X / InternalChild.DrawSize.X, DrawSize.Y / InternalChild.DrawSize.Y);
|
var fitScale = Math.Min(DrawSize.X / InternalChild.DrawSize.X, DrawSize.Y / InternalChild.DrawSize.Y);
|
||||||
InternalChild.Scale = new Vector2(fitScale);
|
InternalChild.Scale = new Vector2(fitScale);
|
||||||
InternalChild.Anchor = Anchor.Centre;
|
InternalChild.Anchor = Anchor.Centre;
|
||||||
|
Reference in New Issue
Block a user