dash-recipes icon indicating copy to clipboard operation
dash-recipes copied to clipboard

gfx backend mouse input is scaled by 2 on Mac

Open Timmmm opened this issue 6 years ago • 3 comments

This must be a hidpi issue, but on Mac on a retina display the mouse input positions are all doubled (or equivalently, the output image is doubled).

That is, if you click 1cm to the right the left window edge, the click will be received by the widget 2cm to the right of the window edge. The doubling is relative to the window, not the screen. Hope that's clear!

Timmmm avatar Feb 28 '19 10:02 Timmmm

Fixing something Mac-related without a Mac is challenging. I will give it a try. Thanks for the ticket!

snuk182 avatar Mar 01 '19 13:03 snuk182

As a workaround I may propose the following for mouse input processing:

glutin::WindowEvent::CursorMoved { position: (x, y), .. } => {
                        mx = (x as f64 * window.hidpi_factor()) as i32;
                        my = (y as f64 * window.hidpi_factor()) as i32;
                        ctx.input_motion(mx, my);
}

snuk182 avatar Mar 01 '19 13:03 snuk182

Have recently accepted a version-raise PR that may solve this. Couldn't you please check?

snuk182 avatar Jul 30 '20 08:07 snuk182