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

Add pixel_to_window_pos() func #375

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

omprakaash
Copy link

@omprakaash omprakaash commented Oct 1, 2023

Added a function to obtain physical windows position of a pixel. Opening a draft PR to ensure correctness first. I am kind of rusty on graphical transformations atm. Should resolve #366

  • Taking it out of draft. Tested it by following these steps. Running example/minimal-winit -> obtaining physical_location of cursor when a cursor_move event occurs -> obtaining pixel_pos from that physical_location -> running the new pixel_pos_to_window_pos() func to see if the inital phycical_location of cursor matches with the window position obtained from the new function.

It usually matches but is sometime off by one (possibly because a pixel could take up more than a single 'unit' of space in a window ? )

Added a function to obtain physical windows position of a pixel.
@omprakaash omprakaash marked this pull request as ready for review October 18, 2023 04:55
@parasyte
Copy link
Owner

This seems to share a lot of code with window_pos_to_pixel(). Do you see any way to DRY it up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Getting window position from pixel position
2 participants