Add files via upload
This commit is contained in:
+13
-4
@@ -52,15 +52,24 @@ end
|
||||
MM._updatePosition = applyPosition
|
||||
|
||||
local function onDragUpdate()
|
||||
local mx, my = GetCursorPosition()
|
||||
local scale = UIParent:GetEffectiveScale() or 1
|
||||
mx = mx / scale; my = my / scale
|
||||
-- Do all math in the button's own effective scale. The button is
|
||||
-- parented to Minimap, whose effective scale can differ from
|
||||
-- UIParent's; mixing scales makes the icon drift away from the cursor.
|
||||
local btn = this
|
||||
local bscale = btn:GetEffectiveScale() or 1
|
||||
local uscale = UIParent:GetEffectiveScale() or 1
|
||||
local mx, my = GetCursorPosition()
|
||||
mx = mx / bscale
|
||||
my = my / bscale
|
||||
local ucx, ucy = UIParent:GetCenter()
|
||||
if not ucx then return end
|
||||
-- Convert UIParent center from UIParent scale into btn scale.
|
||||
ucx = ucx * uscale / bscale
|
||||
ucy = ucy * uscale / bscale
|
||||
local o = opts()
|
||||
o.minimapX = mx - ucx
|
||||
o.minimapY = my - ucy
|
||||
applyPosition(this)
|
||||
applyPosition(btn)
|
||||
end
|
||||
|
||||
function MM:Create()
|
||||
|
||||
Reference in New Issue
Block a user