WorldMap GetCursorPosition
In the process of updating for BfA I ran into a problem I dont find the right math (I'm not good at math ;) ).
The old way to translate Mouse position to Map coords in my zz_coords addon Lua Code:
For BfA I found that WorldMapFrame.ScrollContainer provides the GetCursorPosition-Function. But it seems I cant use that frame as a replacement to get the effective scale/width/height. When I remove the 2 lines that adjust x and y to the scale in BfA I get the right coords only when fully zoomed out. Lua Code:
|
Blizzard actually did all the work:
Code:
local x, y = WorldMapFrame.ScrollContainer:GetNormalizedCursorPosition() Just multiply x and y by 100 and it should work like you want. |
Argh ... I already played with it but still tried to keep width and height in the formula.
Thank you!!! Should have asked earlier :) I have spent the whole day digging through the new worldmap functions :D |
I wasted several hours on it myself before I found that method.
|
All times are GMT -6. The time now is 01:02 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI