Mercurial > wow > cyborg-mmo7
changeset 45:57d46de51ba7
Fixed the dragging of the minimap button. It's still not saved.
author | madcatzinc@35b17cf1-18cd-47ff-9ca3-31d6b526ef09 |
---|---|
date | Mon, 29 Apr 2013 17:44:53 +0000 |
parents | 3e4739a6a99d |
children | 3a3dc5e4405a |
files | CyborgMMO7.lua |
diffstat | 1 files changed, 14 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/CyborgMMO7.lua Mon Apr 29 17:44:46 2013 +0000 +++ b/CyborgMMO7.lua Mon Apr 29 17:44:53 2013 +0000 @@ -38,30 +38,24 @@ local Settings = nil -function CyborgMMO_MiniMapButtonReposition(pos) - CyborgMMO_MiniMapFrame:SetPoint("TOPLEFT", - "Minimap", - "TOPLEFT", - 52 - (80 * cos(pos)), - (80 * sin(pos)) - 52) +function CyborgMMO_MiniMapButtonReposition(angle) + local r = 80 + local dx = r * math.cos(angle) + local dy = r * math.sin(angle) + CyborgMMO_MiniMapFrame:ClearAllPoints() + CyborgMMO_MiniMapFrame:SetPoint("CENTER", "Minimap", "CENTER", dx, dy) end function CyborgMMO_MiniMapButtonOnUpdate() + local xpos,ypos = GetCursorPosition() + local xmap,ymap = Minimap:GetCenter() - local xpos,ypos = GetCursorPosition() - local xmin,ymin = Minimap:GetLeft(), Minimap:GetBottom() + xpos = xpos / UIParent:GetScale() - xmap + ypos = ypos / UIParent:GetScale() - ymap - xpos = (xmin)-(xpos / UIParent:GetScale()) - ypos = (ypos/ UIParent:GetScale())-(ymin) - - local degrees = math.deg(math.atan2(ypos, xpos)) - - while degrees < 0 do - degrees = degrees + 360 - end - - CyborgMMO_MiniMapButtonReposition(degrees) + local angle = math.atan2(ypos, xpos) + CyborgMMO_MiniMapButtonReposition(angle) end function CyborgMMO_MouseModeChange(mode) @@ -351,7 +345,8 @@ CyborgMMO_SetCyborgHeadButton(Settings.CyborgButton) local xmin,ymin = Minimap:GetLeft(),Minimap:GetBottom() - CyborgMMO_MiniMapButtonReposition(math.deg(math.atan2(ymin, xmin))) + local angle = math.rad(150) + CyborgMMO_MiniMapButtonReposition(angle) end end