pixels icon indicating copy to clipboard operation
pixels copied to clipboard

Add pixel_to_window_pos() func

Open omprakaash opened this issue 1 year ago • 1 comments

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 ? )

omprakaash avatar Oct 01 '23 18:10 omprakaash

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

parasyte avatar Oct 30 '23 03:10 parasyte