-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
derive default line width from display dpi
allows better default on high dpi displays where the previous default of 1 pixel would've been too small. Closes: #285
- Loading branch information
Showing
5 changed files
with
12 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bd0ffe6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The accuracy of the math really isn't important here, it only has to scale with DPI—floats aren't needed. X gives us millimeters, we can just operate on millimiters instead of converting to inches, too. And the exact logic behind the default choice doesn't have to be documented.
Putting it all together, the code becomes as simple as this:
This gives a 1mm wide line, I actually measured it to be sure.
bd0ffe6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was planning to get rid of it too.
This makes the default line 4px from the previous 1px default on my screen. Which seems a bit excessive. I've divided the value for 4 in 2ea7a12.
We should have some documentation about the fact that the default line width isn't static and depends on resolution + screen size.