Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize Delta text #9

Merged
merged 5 commits into from
May 12, 2024
Merged

Conversation

nicomarg
Copy link
Contributor

Parent PR: LiveSplit/LiveSplit#2497

Added options to customize the text on the left of the component.

Added options to change the text on the left of the component.
Added an extra option to display different texts when ahead or behind the comparison.
InternalComponent.AlternateNameText.Clear();
InternalComponent.AlternateNameText.Add(CompositeComparisons.GetShortComparisonName(comparison));
}
InternalComponent.LongestString = text;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be the longest possible string out of all the values it can switch between, otherwise the horizontal layout will resize when the text changes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specifically, I think it needs to be the longer of Settings.CustomText and Settings.CustomTextAhead when there's an override

Copy link
Contributor Author

@nicomarg nicomarg May 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can write it like that, though the old behaviour (when set to Current Comparison) was to update LongestString to the (current) long comparison name at each update, not the longest it can be without changing the settings.
If this variable is meant to be changed while running (previously it was at each current comparison change), I don't see the point of telling the renderer to make space for something longer than we need it to display.
If it's not meant to be changed regularly, would it be better to set it to the longest comparison name when set to current comparison ?
Or is it a kind of "middle ground", meaning changing comparison is meant to be relatively rare and at that point changing layout spacing isn't a big deal, while being ahead/behind changes often enough to warrant always making enough space for both texts ?

Copy link
Member

@wooferzfg wooferzfg May 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue with your current code is that the text changes between ahead vs. behind, but LongestString doesn't account for this. That's the only case that's problematic in my opinion.

Changing the comparison or the settings isn't something we need to account for here
(ideally changing the comparison wouldn't cause a resize either, but since that's already an issue outside of this PR, no need to handle it)

src/LiveSplit.Delta/UI/Components/DeltaComponent.cs Outdated Show resolved Hide resolved
src/LiveSplit.Delta/UI/Components/DeltaComponent.cs Outdated Show resolved Hide resolved
src/LiveSplit.Delta/UI/Components/DeltaSettings.cs Outdated Show resolved Hide resolved
Fixed the counter-intuitive behaviour of still providing the short comparison name as an alternate text when using custom text.
Also fixes LongestString not necessarily being the longest alternative
Renamed labels used in the code.
Renamed TextBehind/TextAhead to CustomText/CustomTextAhead to better express the fact that the first one is used as the sole text in constant text mode and as the text when behind otherwise.
@nicomarg
Copy link
Contributor Author

nicomarg commented May 12, 2024

Last 2 commits fix issues pointd earlier.
For anyone willing to read the Designer diff, idk why Designer changed some refs to class members from member to this.member when it is declared in the other file describing the partial class.

wooferzfg and others added 2 commits May 12, 2024 12:31
In differential mode, LongestString is now always the longest of the two strings, to avoid causing resizings.
@wooferzfg wooferzfg merged commit 370d7e4 into LiveSplit:master May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants