mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 15:07:44 +08:00
Refactor getTieredComponent
This commit is contained in:
parent
11b1b8c633
commit
63346f6b75
@ -69,19 +69,23 @@ namespace osu.Game.Skinning.Editor
|
|||||||
|
|
||||||
var result = default(Anchor);
|
var result = default(Anchor);
|
||||||
|
|
||||||
static Anchor getTieredComponent(float component, Anchor tier0, Anchor tier1, Anchor tier2) =>
|
|
||||||
component >= 2 / 3f
|
|
||||||
? tier2
|
|
||||||
: component >= 1 / 3f
|
|
||||||
? tier1
|
|
||||||
: tier0;
|
|
||||||
|
|
||||||
result |= getTieredComponent(absolutePosition.X / factor.X, Anchor.x0, Anchor.x1, Anchor.x2);
|
result |= getTieredComponent(absolutePosition.X / factor.X, Anchor.x0, Anchor.x1, Anchor.x2);
|
||||||
result |= getTieredComponent(absolutePosition.Y / factor.Y, Anchor.y0, Anchor.y1, Anchor.y2);
|
result |= getTieredComponent(absolutePosition.Y / factor.Y, Anchor.y0, Anchor.y1, Anchor.y2);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Anchor getTieredComponent(float component, Anchor tier0, Anchor tier1, Anchor tier2)
|
||||||
|
{
|
||||||
|
if (component >= 2 / 3f)
|
||||||
|
return tier2;
|
||||||
|
|
||||||
|
if (component >= 1 / 3f)
|
||||||
|
return tier1;
|
||||||
|
|
||||||
|
return tier0;
|
||||||
|
}
|
||||||
|
|
||||||
private Vector2 getOriginPositionFromQuad(in Quad quad, Anchor origin)
|
private Vector2 getOriginPositionFromQuad(in Quad quad, Anchor origin)
|
||||||
{
|
{
|
||||||
var result = quad.TopLeft;
|
var result = quad.TopLeft;
|
||||||
|
Loading…
Reference in New Issue
Block a user