From c43c383abf5d05caa5827b23b1fd53f61cff5b55 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 22 Apr 2024 18:43:34 +0800 Subject: [PATCH] Allow storboard videos to take on no-relative size when specified by a mapper --- .../Drawables/DrawableStoryboardVideo.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardVideo.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardVideo.cs index 9a5db4bb39..98cb01d5f3 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardVideo.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardVideo.cs @@ -23,7 +23,17 @@ public DrawableStoryboardVideo(StoryboardVideo video) { Video = video; - RelativeSizeAxes = Axes.Both; + // In osu-stable, a mapper can add a scale command for a storyboard. + // This allows scaling based on the video's absolute size. + // + // If not specified we take up the full available space. + bool useRelative = !video.TimelineGroup.Scale.HasCommands; + + RelativeSizeAxes = useRelative ? Axes.Both : Axes.None; + AutoSizeAxes = useRelative ? Axes.None : Axes.Both; + + Anchor = Anchor.Centre; + Origin = Anchor.Centre; } [BackgroundDependencyLoader(true)] @@ -36,7 +46,7 @@ private void load(IBindable beatmap, TextureStore textureStore) InternalChild = drawableVideo = new Video(stream, false) { - RelativeSizeAxes = Axes.Both, + RelativeSizeAxes = RelativeSizeAxes, FillMode = FillMode.Fill, Anchor = Anchor.Centre, Origin = Anchor.Centre,