From a551d8c7a39ee52d1b6160071a3c7fc48f00c6c2 Mon Sep 17 00:00:00 2001 From: kitemy Date: Sun, 15 Nov 2026 13:55:41 +0100 Subject: [PATCH] feat(ui): allow backing vocals to span full stage width Introduce `backingStageWidth` to `LyricLineDisplay` to allow backing vocals to be positioned relative to the entire stage width rather than being constrained to the individual lyric line width. This enables wider distribution of backing vocals across the screen. (AI-assisted commit message, signed kitemy.) --- .../UI/LyricLineDisplay.BackingVocals.cs | 19 +++++++++++++++++-- .../UI/LyricStage.cs | 3 +++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/typebeat.Game.Rulesets.TypeBeat/UI/LyricLineDisplay.BackingVocals.cs b/typebeat.Game.Rulesets.TypeBeat/UI/LyricLineDisplay.BackingVocals.cs index 65e0b5f0..fcfdae56 100644 --- a/typebeat.Game.Rulesets.TypeBeat/UI/LyricLineDisplay.BackingVocals.cs +++ b/typebeat.Game.Rulesets.TypeBeat/UI/LyricLineDisplay.BackingVocals.cs @@ -52,6 +52,7 @@ public partial class LyricLineDisplay private float[] backingTilts = Array.Empty(); private Vector2[] backingRest = Array.Empty(); private bool backingEnabled = true; + private float backingStageWidth; /// The backing words this line shows (its source line's, see ). private IReadOnlyList backingWords => Line.Source.BackingVocals; @@ -93,12 +94,14 @@ private void layoutBackingVocals() if (backingTexts.Length == 0) return; - float width = cellX[^1]; + float lyricWidth = cellX[^1]; + float span = backingStageWidth > 0 ? backingStageWidth : lyricWidth; + float left = (lyricWidth - span) * 0.5f; float ruby = furigana.Count > 0 ? requestedFontSize * 0.36f * 1.15f + 2 * SizeRatio : 0; float lift = ruby + BACKING_GAP * SizeRatio; for (int i = 0; i < backingTexts.Length; i++) - backingRest[i] = new Vector2(width * (float)BackingVocals.AnchorOf(backingWords, i), -lift); + backingRest[i] = new Vector2(left + span * (float)BackingVocals.AnchorOf(backingWords, i), -lift); updateBackingVocals(Time.Current); } @@ -132,6 +135,18 @@ public void SetBackingVocalsEnabled(bool enabled) updateBackingVocals(Time.Current); } + /// Sets the full stage width used to place backing vocals across the screen. + public void SetBackingStageWidth(float width) + { + if (width <= 0 || Math.Abs(backingStageWidth - width) < 0.1f) + return; + + backingStageWidth = width; + + if (IsLoaded) + layoutBackingVocals(); + } + /// How many backing words this line draws (test support). internal int BackingVocalCount => backingTexts.Length; diff --git a/typebeat.Game.Rulesets.TypeBeat/UI/LyricStage.cs b/typebeat.Game.Rulesets.TypeBeat/UI/LyricStage.cs index 925c440f..d6cf0fb0 100644 --- a/typebeat.Game.Rulesets.TypeBeat/UI/LyricStage.cs +++ b/typebeat.Game.Rulesets.TypeBeat/UI/LyricStage.cs @@ -826,7 +826,10 @@ protected override void Update() bool resized = false; foreach (var display in displays) + { + display.SetBackingStageWidth(DrawWidth); resized |= display.SetMaximumWidth(lineWidth); + } if (resized) {