From 7e705c6a9a908f477ad6777599f37fbb48bbc3c9 Mon Sep 17 00:00:00 2001 From: Christopher Serr Date: Sun, 9 Jun 2024 17:55:35 +0200 Subject: [PATCH] Dynamically adjust the column widths Instead of assuming each column has the width of the text `88:88:88`, we now determine the largest string per column (based on unicode scalar values) and adjust the column width accordingly. There is still a fixed minimum width based on the string `88:88`, which ensures that the columns don't switch sizes too often, especially if you start with empty splits. We could've also chosen `8:88:88`, which would ensure there's no column size change as you approach the hour mark. However, this would increase the size of delta columns unnecessarily. So it's a little bit of a trade-off. --- livesplit-core | 2 +- src/ui/TimerView.tsx | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/livesplit-core b/livesplit-core index 5be35bef..334e37d7 160000 --- a/livesplit-core +++ b/livesplit-core @@ -1 +1 @@ -Subproject commit 5be35bef56868e284c184614e778f434db4ac85a +Subproject commit 334e37d7d39046bd7c01a9f073ec449fa29ffbf2 diff --git a/src/ui/TimerView.tsx b/src/ui/TimerView.tsx index b4dac553..2d22b427 100644 --- a/src/ui/TimerView.tsx +++ b/src/ui/TimerView.tsx @@ -91,12 +91,17 @@ export class TimerView extends React.Component { > { - this.props.eventSink.updateLayoutState( - this.props.layout, - this.props.layoutState, - this.props.layoutUrlCache.imageCache, - ); - this.props.layoutUrlCache.collect(); + // The drag upload above causes the layout to be + // dropped. We need to wait for it to be replaced + // with the new layout. + if (this.props.layout.ptr !== 0) { + this.props.eventSink.updateLayoutState( + this.props.layout, + this.props.layoutState, + this.props.layoutUrlCache.imageCache, + ); + this.props.layoutUrlCache.collect(); + } return this.props.layoutState; }} layoutUrlCache={this.props.layoutUrlCache}