From 9fd59215b9f2b3a6906dd64e1a057e118af03b32 Mon Sep 17 00:00:00 2001 From: Michael Kirsch Date: Tue, 11 Nov 2025 23:50:56 +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.Splits/UI/Components/SplitsComponent.cs b/src/LiveSplit.Splits/UI/Components/SplitsComponent.cs index 3a9bacf..b2d65db 100644 --- a/src/LiveSplit.Splits/UI/Components/SplitsComponent.cs +++ b/src/LiveSplit.Splits/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; } @@ -70,8 +74,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; @@ -158,6 +165,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; + } + int previousSplitCount = visualSplitCount; visualSplitCount = Math.Min(state.Run.Count, Settings.VisualSplitCount); if (previousSplitCount != visualSplitCount