g3n / engine

Go 3D Game Engine (http://g3n.rocks)
https://discord.gg/NfaeVr8zDg
BSD 2-Clause "Simplified" License
2.82k stars 298 forks source link

Fix mouse coordinates in mouse events on Mac #237

Closed mat007 closed 3 years ago

mat007 commented 3 years ago

On Mac the initial mouse down coordinates for demos don’t get recorded properly and result in a «jump» when rotating or spanning:

ko

I noticed there is a PR that’s been open for quite a while about this: #109 but it changes code that’s not there anymore. I also noticed the scaling has been removed at other locations: https://github.com/g3n/engine/blob/master/window/canvas.go#L411 https://github.com/g3n/engine/blob/master/window/canvas.go#L423 and https://github.com/g3n/engine/blob/master/window/canvas.go#L434 therefore I mimicked these comments in the change in the PR.

I realize a proper fix should probably do something like what #161 does, I’ll probably give it a try later as I noticed some HiDPI issues on my Windows. But in the meanwhile this at least fixes MacOS (and doesn’t break on Windows as the scale is always 1):

ok