Demigiant / dotween

A Unity C# animation engine. HOTween v2
http://dotween.demigiant.com
Other
2.36k stars 350 forks source link

Path Editor not correctly scaled for HiDPI/scaled monitors #402

Closed lamara closed 4 years ago

lamara commented 4 years ago

I'm using DOTween, on macOS, on a scaled monitor (at 2x scaling, aka retina). The path editor doesn't appear to respect my machine's scaled screen coordinates, so when adding waypoints, the waypoint's coordinates aren't set at the mouse cursor. They're instead divided by two. This effectively pins all coordinates to the top-left quadrant of the scene view, and is quite annoying to work with.

Attached GIF below to illustrate.

Screen Recording 2020-05-25 at 5 24 40 PM

Versions are: DOTween v1.2.335 DOTweenPro v1.0.178

Demigiant commented 4 years ago

Ouch, that is very bad :| I will investigate tomorrow but it seems an internal Unity bug. What version of Unity are you on? EDIT: Made the gif bigger and saw it, 2019.3.14. Will investigate on that one.

lamara commented 4 years ago

Thanks for the quick response!

I'm on Unity 2019.3.14f1.

Demigiant commented 4 years ago

So the problem is indeed Unity's, which returns the wrong pixel coordinates for the mouse position in the editor (divided by two as you mentioned in case of 200% scaling, meaning it returns the mousePosition as if the UI wasn't scaled at all :|). I'm trying to find a workaround for that :P

Demigiant commented 4 years ago

Ok I managed (had to hack into Unity because apparently there is no public way to find the UI Scaling, sigh). Can you write me from here and mention it's you, so I can send you an update? I will need confirmation from you that it works, since I'm not 100% sure the system I found to get the UI scaling is the same for Windows and OSX (because you have no UI Scaling option in the preferences).

lamara commented 4 years ago

Tested Daniele's patch, and everything looks good on the macOS side. Thanks!

Demigiant commented 4 years ago

Great ^_^ Will push it on the Asset Store on the next update :)