From a14c8a1a197becc23f4ebad074a5315964630ea3 Mon Sep 17 00:00:00 2001 From: Michael Kirsch Date: Wed, 12 Nov 2025 00:01:49 +0100 Subject: [PATCH] Reflect accuracy settings in width calculation --- .../UI/Components/SplitsComponent.cs | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/LiveSplit.Subsplits/UI/Components/SplitsComponent.cs b/src/LiveSplit.Subsplits/UI/Components/SplitsComponent.cs index 9b3ea52..e622b6e 100644 --- a/src/LiveSplit.Subsplits/UI/Components/SplitsComponent.cs +++ b/src/LiveSplit.Subsplits/UI/Components/SplitsComponent.cs @@ -28,6 +28,10 @@ public class SplitsComponent : IComponent protected SimpleLabel MeasureDeltaLabel { get; set; } protected SimpleLabel MeasureCharLabel { get; set; } + protected TimeAccuracy CurrentAccuracy { get; set; } + protected TimeAccuracy CurrentDeltaAccuracy { get; set; } + protected bool CurrentDropDecimals { get; set; } + protected ITimeFormatter TimeFormatter { get; set; } protected ITimeFormatter DeltaTimeFormatter { get; set; } @@ -74,8 +78,11 @@ public SplitsComponent(LiveSplitState state) MeasureTimeLabel = new SimpleLabel(); MeasureDeltaLabel = new SimpleLabel(); MeasureCharLabel = new SimpleLabel(); - TimeFormatter = new SplitTimeFormatter(Settings.SplitTimesAccuracy); - DeltaTimeFormatter = new DeltaSplitTimeFormatter(Settings.DeltasAccuracy, Settings.DropDecimals); + CurrentAccuracy = Settings.SplitTimesAccuracy; + CurrentDeltaAccuracy = Settings.DeltasAccuracy; + CurrentDropDecimals = Settings.DropDecimals; + TimeFormatter = new SplitTimeFormatter(CurrentAccuracy); + DeltaTimeFormatter = new DeltaSplitTimeFormatter(CurrentDeltaAccuracy, CurrentDropDecimals); ShadowImages = []; visualSplitCount = Settings.VisualSplitCount; @@ -165,6 +172,19 @@ private void Prepare(LiveSplitState state) OldState = state; } + if (Settings.SplitTimesAccuracy != CurrentAccuracy) + { + TimeFormatter = new SplitTimeFormatter(Settings.SplitTimesAccuracy); + CurrentAccuracy = Settings.SplitTimesAccuracy; + } + + if (Settings.DeltasAccuracy != CurrentDeltaAccuracy || Settings.DropDecimals != CurrentDropDecimals) + { + DeltaTimeFormatter = new DeltaSplitTimeFormatter(Settings.DeltasAccuracy, Settings.DropDecimals); + CurrentDeltaAccuracy = Settings.DeltasAccuracy; + CurrentDropDecimals = Settings.DropDecimals; + } + if (Settings.VisualSplitCount != visualSplitCount || Settings.ShowColumnLabels != PreviousShowLabels || (Settings.ShowColumnLabels && state.Layout.Mode != OldLayoutMode))