Skip to content

Use percentage for desktop toolbar positioning#642

Merged
josuave merged 2 commits intomasterfrom
desktop-toolbar-pct
Dec 4, 2021
Merged

Use percentage for desktop toolbar positioning#642
josuave merged 2 commits intomasterfrom
desktop-toolbar-pct

Conversation

@dremin
Copy link
Copy Markdown
Collaborator

@dremin dremin commented Nov 29, 2021

The current absolute positioning method can be annoying, as when screen sizes change (such as RDP), the toolbar ends up in the wrong place. By using percentages, this doesn't occur.

Note that I didn't add migration for the setting. Whatever is saved from the old absolute positioning scheme will fail the bounds check and result in the default position being used. When the user moves it back to the desired location, the percentage will save. @josuave does this sound OK? Adding migration didn't seem worth it here, but open to adding it if needed.

@dremin dremin added Core Features core to Cairo Refactor labels Nov 29, 2021
@dremin dremin requested a review from josuave November 29, 2021 05:06
@josuave josuave self-assigned this Dec 4, 2021
return (absolutePos + size / 2) / total;
}

private double PctToAbsPos(double percentPos, double size, double total)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It doesn't have to be in this PR but we should not use shortened or abbreviated terms unless it is universally known.
Abs and Pos are pretty universal, especially in development. Percent on the other hand has variations. At this point, with modern development and computers, abbreviations in code are more a limitation imposed by either habit or laziness. Rule of thumb, anything that you name (class, method or variable) should have a name who's length is somewhat related to its scope, lifetime and complexity. Shorter lifetime/scope ~= shorter, less descriptive name

@josuave josuave merged commit 5afb284 into master Dec 4, 2021
@josuave josuave deleted the desktop-toolbar-pct branch December 4, 2021 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Core Features core to Cairo Refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants