-
Notifications
You must be signed in to change notification settings - Fork 920
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
Add safe area and document coordinate systems #3890
Conversation
7899334
to
67113a7
Compare
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.
Can macOS backend provide safe area when the transparent decorations are used? The ones where the buttons are over the main surface.
Didn't even know we had I was kinda hoping I could define |
You just need to |
Added `Window::safe_area`, which describes the area of the surface that is unobstructed by notches, bezels etc. The drawing code in the examples have been updated to draw a star inside the safe area, and the plain background outside of it. Also renamed `Window::inner_position` to `Window::surface_position`, and changed it to from screen coordinates to window coordinates, to better align how these coordinate systems work together. Finally, added some SVG images and documentation to describe how all of this works.
67113a7
to
98a9914
Compare
Dunno, I can imagine that it will happen on some platforms
I have ensured that |
ed83b5f
to
bc12e13
Compare
Very bare-bones, probably not correct
8133eb7
to
12f3666
Compare
I have changed I believe the only remaining thing is for @daxpedda to fix the web wrt. scrolling, as I wrote shortly about in #3890 (comment) (if you don't have the time rn, I'm inclined to merge this fairly soon anyhow, and then track the completion of that in #3910). |
I've merged this now, though note that it's only really implemented for macOS and iOS (and Wayland, because there's no protocol for it). Web is implemented, though as noted above, it needs to be changed. All of this remaining work (fixing the web implementation, implementing properly on the other platforms) is tracked in #3910. |
Resolves #2308, by adding
Window::safe_area
, which describes the area of the surface that is unobstructed by notches, bezels etc. The drawing code in the examples have been updated to draw a star inside the safe area, and the plain background outside of it.Also renamed
Window::inner_position
(introduced in #430) toWindow::surface_position
, and changed it to from screen coordinates to window coordinates, to better align how these coordinate systems work together.Finally, I've added some SVG images and documentation to describe how these coordinate systems work together. The images should be auto-adjusting to the page theme when viewed on docs.rs. See also #3891, whether we use window coordinates or surface coordinates is currently a bit confusing.
Completing implementation on all platforms is tracked in #3910
Fixes #1122
Fixes #2308
Fixes #3742
Fixes #2066
Fixes #2347
Fixes #2235