You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Separator lines which are 1 pixel wide, such as those used by default in panels and the Separator widget, are rendered with their centers at a pixel coordinate rather than their edges at a pixel coordinate. This leads to them appearing as 2-pixel translucent lines rather than 1-pixel opaque lines.
This was discussed somewhat in #1322, but I think it's worth revisiting. Right now, 1-pixel lines are very heavily used in egui, and this behavior can lead to some unintuitive and visually unappealing results (for instance, this contributes to #4773; the 1-pixel border of the panel feathers upwards, merging with the vertical separator above). If a 2-pixel transparent border is more aesthetically appealing, it should be explicitly represented as such for layout purposes.
I think this lies more on the "bug" side than the "feature" side because the code that draws these separator lines, for both separators and panels, does call round_to_pixel--it's just that the rounding value is incorrect for lines with odd widths.
To Reproduce
This can be seen in any egui application that uses panels or separators. For instance, all of these 2-pixel medium-grey outlines in the demo app are supposed to be 1-pixel light grey outlines:
Expected behavior
Lines which are 1 pixel (as a unit) wide should, at 1 pixel per point, be 1 physical pixel wide. It's not as simple as always rounding up or down-- for e.g. a border around a rectangle, you may want to round "outwards" or "inwards", which rounds differently depending on which side of the rectangle you're on. It may be worth looking into how CSS does this (which ties into #4019).
The text was updated successfully, but these errors were encountered:
Describe the bug
Separator lines which are 1 pixel wide, such as those used by default in panels and the
Separator
widget, are rendered with their centers at a pixel coordinate rather than their edges at a pixel coordinate. This leads to them appearing as 2-pixel translucent lines rather than 1-pixel opaque lines.This was discussed somewhat in #1322, but I think it's worth revisiting. Right now, 1-pixel lines are very heavily used in egui, and this behavior can lead to some unintuitive and visually unappealing results (for instance, this contributes to #4773; the 1-pixel border of the panel feathers upwards, merging with the vertical separator above). If a 2-pixel transparent border is more aesthetically appealing, it should be explicitly represented as such for layout purposes.
I think this lies more on the "bug" side than the "feature" side because the code that draws these separator lines, for both separators and panels, does call
round_to_pixel
--it's just that the rounding value is incorrect for lines with odd widths.To Reproduce
This can be seen in any egui application that uses panels or separators. For instance, all of these 2-pixel medium-grey outlines in the demo app are supposed to be 1-pixel light grey outlines:
![image](https://private-user-images.githubusercontent.com/79560998/345607524-a448b7cf-59ab-4d77-a715-9cbd46a52561.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAzNDQzNDcsIm5iZiI6MTcyMDM0NDA0NywicGF0aCI6Ii83OTU2MDk5OC8zNDU2MDc1MjQtYTQ0OGI3Y2YtNTlhYi00ZDc3LWE3MTUtOWNiZDQ2YTUyNTYxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzA3VDA5MjA0N1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWVmMWYxNGE0OTMxZDUwMzViMjA1NGQxZWRlYWY1MzJiOTU4MTMzMmIwMjU5MTQyZTNhYTE3MWQ2ZThlY2Y2OTImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.bSikKGOmLyXizCpyKBIhJxrzbQK-2Ip-JWBSK8S4mOA)
Expected behavior
Lines which are 1 pixel (as a unit) wide should, at 1 pixel per point, be 1 physical pixel wide. It's not as simple as always rounding up or down-- for e.g. a border around a rectangle, you may want to round "outwards" or "inwards", which rounds differently depending on which side of the rectangle you're on. It may be worth looking into how CSS does this (which ties into #4019).
The text was updated successfully, but these errors were encountered: