Skip to content

Commit

Permalink
Merge pull request #27278 from EVAST9919/grid-update
Browse files Browse the repository at this point in the history
Apply padding to `GridContainer`s directly where possible
  • Loading branch information
peppy committed Feb 21, 2024
2 parents 0c35950 + 2543a48 commit 9c40ff2
Show file tree
Hide file tree
Showing 12 changed files with 290 additions and 357 deletions.
54 changes: 25 additions & 29 deletions osu.Game/Overlays/Chat/ChannelList/ChannelListItem.cs
Expand Up @@ -66,41 +66,37 @@ private void load()
Colour = colourProvider.Background4,
Alpha = 0f,
},
new Container
new GridContainer
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Left = 18, Right = 10 },
Child = new GridContainer
ColumnDimensions = new[]
{
RelativeSizeAxes = Axes.Both,
ColumnDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension(),
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.AutoSize),
},
Content = new[]
new Dimension(GridSizeMode.AutoSize),
new Dimension(),
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.AutoSize),
},
Content = new[]
{
new Drawable?[]
{
new Drawable?[]
createIcon(),
text = new TruncatingSpriteText
{
createIcon(),
text = new TruncatingSpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Text = Channel.Name,
Font = OsuFont.Torus.With(size: 17, weight: FontWeight.SemiBold),
Colour = colourProvider.Light3,
Margin = new MarginPadding { Bottom = 2 },
RelativeSizeAxes = Axes.X,
},
createMentionPill(),
close = createCloseButton(),
}
},
},
},
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Text = Channel.Name,
Font = OsuFont.Torus.With(size: 17, weight: FontWeight.SemiBold),
Colour = colourProvider.Light3,
Margin = new MarginPadding { Bottom = 2 },
RelativeSizeAxes = Axes.X,
},
createMentionPill(),
close = createCloseButton(),
}
}
}
};

Action = () => OnRequestSelect?.Invoke(Channel);
Expand Down
63 changes: 29 additions & 34 deletions osu.Game/Overlays/Profile/Header/DetailHeaderContainer.cs
Expand Up @@ -26,47 +26,42 @@ private void load(OverlayColourProvider colourProvider)
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background5,
},
new Container
new GridContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Horizontal = WaveOverlayContainer.HORIZONTAL_PADDING, Vertical = 10 },
Child = new GridContainer
RowDimensions = new[]
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
},
ColumnDimensions = new[]
{
new Dimension(),
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.AutoSize),
},
Content = new[]
new Dimension(GridSizeMode.AutoSize),
},
ColumnDimensions = new[]
{
new Dimension(),
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.AutoSize),
},
Content = new[]
{
new Drawable[]
{
new Drawable[]
new MainDetails
{
RelativeSizeAxes = Axes.X,
User = { BindTarget = User }
},
new Box
{
RelativeSizeAxes = Axes.Y,
Width = 2,
Colour = colourProvider.Background6,
Margin = new MarginPadding { Horizontal = 15 }
},
new ExtendedDetails
{
new MainDetails
{
RelativeSizeAxes = Axes.X,
User = { BindTarget = User }
},
new Box
{
RelativeSizeAxes = Axes.Y,
Width = 2,
Colour = colourProvider.Background6,
Margin = new MarginPadding { Horizontal = 15 }
},
new ExtendedDetails
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
User = { BindTarget = User }
}
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
User = { BindTarget = User }
}
}
}
Expand Down
44 changes: 20 additions & 24 deletions osu.Game/Screens/Edit/BottomBar.cs
Expand Up @@ -47,35 +47,31 @@ private void load(OverlayColourProvider colourProvider, Editor editor)
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background4,
},
new Container
new GridContainer
{
RelativeSizeAxes = Axes.Both,
Child = new GridContainer
ColumnDimensions = new[]
{
RelativeSizeAxes = Axes.Both,
ColumnDimensions = new[]
{
new Dimension(GridSizeMode.Absolute, 170),
new Dimension(),
new Dimension(GridSizeMode.Absolute, 220),
new Dimension(GridSizeMode.Absolute, HitObjectComposer.TOOLBOX_CONTRACTED_SIZE_RIGHT),
},
Content = new[]
new Dimension(GridSizeMode.Absolute, 170),
new Dimension(),
new Dimension(GridSizeMode.Absolute, 220),
new Dimension(GridSizeMode.Absolute, HitObjectComposer.TOOLBOX_CONTRACTED_SIZE_RIGHT),
},
Content = new[]
{
new Drawable[]
{
new Drawable[]
new TimeInfoContainer { RelativeSizeAxes = Axes.Both },
new SummaryTimeline { RelativeSizeAxes = Axes.Both },
new PlaybackControl { RelativeSizeAxes = Axes.Both },
TestGameplayButton = new TestGameplayButton
{
new TimeInfoContainer { RelativeSizeAxes = Axes.Both },
new SummaryTimeline { RelativeSizeAxes = Axes.Both },
new PlaybackControl { RelativeSizeAxes = Axes.Both },
TestGameplayButton = new TestGameplayButton
{
RelativeSizeAxes = Axes.Both,
Size = new Vector2(1),
Action = editor.TestGameplay,
}
},
}
},
RelativeSizeAxes = Axes.Both,
Size = new Vector2(1),
Action = editor.TestGameplay,
}
},
}
}
};
}
Expand Down
89 changes: 37 additions & 52 deletions osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs
Expand Up @@ -86,78 +86,63 @@ private void load(OverlayColourProvider colourProvider)
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background3
},
new Container
new GridContainer
{
RelativeSizeAxes = Axes.Both,
Child = new GridContainer
Content = new[]
{
RelativeSizeAxes = Axes.Both,
Content = new[]
new Drawable[]
{
new Drawable[]
new ChevronButton
{
new ChevronButton
{
Icon = FontAwesome.Solid.ChevronLeft,
Action = beatDivisor.SelectPrevious
},
new DivisorDisplay { BeatDivisor = { BindTarget = beatDivisor } },
new ChevronButton
{
Icon = FontAwesome.Solid.ChevronRight,
Action = beatDivisor.SelectNext
}
Icon = FontAwesome.Solid.ChevronLeft,
Action = beatDivisor.SelectPrevious
},
new DivisorDisplay { BeatDivisor = { BindTarget = beatDivisor } },
new ChevronButton
{
Icon = FontAwesome.Solid.ChevronRight,
Action = beatDivisor.SelectNext
}
},
ColumnDimensions = new[]
{
new Dimension(GridSizeMode.Absolute, 20),
new Dimension(),
new Dimension(GridSizeMode.Absolute, 20)
}
},
ColumnDimensions = new[]
{
new Dimension(GridSizeMode.Absolute, 20),
new Dimension(),
new Dimension(GridSizeMode.Absolute, 20)
}
}
}
}
},
new Drawable[]
{
new Container
new GridContainer
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
Content = new[]
{
new Container
new Drawable[]
{
RelativeSizeAxes = Axes.Both,
Child = new GridContainer
new ChevronButton
{
RelativeSizeAxes = Axes.Both,
Content = new[]
{
new Drawable[]
{
new ChevronButton
{
Icon = FontAwesome.Solid.ChevronLeft,
Action = () => cycleDivisorType(-1)
},
new DivisorTypeText { BeatDivisor = { BindTarget = beatDivisor } },
new ChevronButton
{
Icon = FontAwesome.Solid.ChevronRight,
Action = () => cycleDivisorType(1)
}
},
},
ColumnDimensions = new[]
{
new Dimension(GridSizeMode.Absolute, 20),
new Dimension(),
new Dimension(GridSizeMode.Absolute, 20)
}
Icon = FontAwesome.Solid.ChevronLeft,
Action = () => cycleDivisorType(-1)
},
new DivisorTypeText { BeatDivisor = { BindTarget = beatDivisor } },
new ChevronButton
{
Icon = FontAwesome.Solid.ChevronRight,
Action = () => cycleDivisorType(1)
}
}
},
},
ColumnDimensions = new[]
{
new Dimension(GridSizeMode.Absolute, 20),
new Dimension(),
new Dimension(GridSizeMode.Absolute, 20)
}
}
},
Expand Down
35 changes: 15 additions & 20 deletions osu.Game/Screens/Edit/EditorScreenWithTimeline.cs
Expand Up @@ -57,37 +57,32 @@ private void load(OverlayColourProvider colourProvider)
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background4
},
new Container
new GridContainer
{
Name = "Timeline content",
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Horizontal = PADDING, Top = PADDING },
Child = new GridContainer
Content = new[]
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Content = new[]
new Drawable[]
{
new Drawable[]
TimelineContent = new Container
{
TimelineContent = new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
},
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
},
},
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
},
ColumnDimensions = new[]
{
new Dimension(),
new Dimension(GridSizeMode.Absolute, 90),
}
},
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
},
ColumnDimensions = new[]
{
new Dimension(),
new Dimension(GridSizeMode.Absolute, 90),
}
}
}
},
Expand Down

0 comments on commit 9c40ff2

Please sign in to comment.