mirror of
https://github.com/osukey/osukey.git
synced 2025-05-06 22:27:25 +09:00
Move dimming logic to custom scroll container
This commit is contained in:
parent
e9c9c764ca
commit
94d07e147f
@ -61,7 +61,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
private DifficultyMultiplierDisplay? multiplierDisplay;
|
private DifficultyMultiplierDisplay? multiplierDisplay;
|
||||||
private ModSettingsArea modSettingsArea = null!;
|
private ModSettingsArea modSettingsArea = null!;
|
||||||
private OsuScrollContainer columnScroll = null!;
|
private ColumnScrollContainer columnScroll = null!;
|
||||||
private ColumnFlowContainer columnFlow = null!;
|
private ColumnFlowContainer columnFlow = null!;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -98,7 +98,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
RelativePositionAxes = Axes.Both,
|
RelativePositionAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
columnScroll = new OsuScrollContainer(Direction.Horizontal)
|
columnScroll = new ColumnScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Masking = false,
|
Masking = false,
|
||||||
@ -320,28 +320,34 @@ namespace osu.Game.Overlays.Mods
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class ColumnScrollContainer : OsuScrollContainer<ColumnFlowContainer>
|
||||||
|
{
|
||||||
|
public ColumnScrollContainer()
|
||||||
|
: base(Direction.Horizontal)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
// the bounds below represent the horizontal range of scroll items to be considered fully visible/active, in the scroll's internal coordinate space.
|
// the bounds below represent the horizontal range of scroll items to be considered fully visible/active, in the scroll's internal coordinate space.
|
||||||
// note that clamping is applied to the left scroll bound to ensure scrolling past extents does not change the set of active columns.
|
// note that clamping is applied to the left scroll bound to ensure scrolling past extents does not change the set of active columns.
|
||||||
float leftScrollBound = Math.Clamp(columnScroll.Current, 0, columnScroll.ScrollableExtent);
|
float leftScrollBound = Math.Clamp(Current, 0, ScrollableExtent);
|
||||||
float rightScrollBound = leftScrollBound + columnScroll.DrawWidth;
|
float rightScrollBound = leftScrollBound + DrawWidth;
|
||||||
|
|
||||||
foreach (var column in columnFlow)
|
foreach (var column in Child)
|
||||||
{
|
{
|
||||||
// DrawWidth/DrawPosition do not include shear effects, and we want to know the full extents of the columns post-shear,
|
// DrawWidth/DrawPosition do not include shear effects, and we want to know the full extents of the columns post-shear,
|
||||||
// so we have to manually compensate.
|
// so we have to manually compensate.
|
||||||
// additionally note that columnFlow.Parent is not columnScroll, but rather it is the scroll's internal container.
|
var topLeft = column.ToSpaceOfOtherDrawable(new Vector2(-column.DrawHeight * SHEAR, 0), ScrollContent);
|
||||||
// this is intentional in order to include margin of the columnFlow in calculations correctly and operate in the "scroll internal content space".
|
var topRight = column.ToSpaceOfOtherDrawable(new Vector2(column.DrawWidth, 0), ScrollContent);
|
||||||
var topLeft = column.ToSpaceOfOtherDrawable(new Vector2(-column.DrawHeight * SHEAR, 0), columnFlow.Parent);
|
|
||||||
var topRight = column.ToSpaceOfOtherDrawable(new Vector2(column.DrawWidth, 0), columnFlow.Parent);
|
|
||||||
|
|
||||||
column.Active.Value = Precision.AlmostBigger(topLeft.X, leftScrollBound)
|
column.Active.Value = Precision.AlmostBigger(topLeft.X, leftScrollBound)
|
||||||
&& Precision.DefinitelyBigger(rightScrollBound, topRight.X);
|
&& Precision.DefinitelyBigger(rightScrollBound, topRight.X);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class ColumnFlowContainer : FillFlowContainer<ColumnDimContainer>
|
private class ColumnFlowContainer : FillFlowContainer<ColumnDimContainer>
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user