Mercurial > wow > cyborg-mmo7
comparison CyborgMMO7.lua @ 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 | 5d18eb57ea2f |
| children | 3a3dc5e4405a |
comparison
equal
deleted
inserted
replaced
| 44:3e4739a6a99d | 45:57d46de51ba7 |
|---|---|
| 36 local SettingsLoaded = false | 36 local SettingsLoaded = false |
| 37 local SaveName = GetRealmName().."_"..UnitName("player") | 37 local SaveName = GetRealmName().."_"..UnitName("player") |
| 38 local Settings = nil | 38 local Settings = nil |
| 39 | 39 |
| 40 | 40 |
| 41 function CyborgMMO_MiniMapButtonReposition(pos) | 41 function CyborgMMO_MiniMapButtonReposition(angle) |
| 42 CyborgMMO_MiniMapFrame:SetPoint("TOPLEFT", | 42 local r = 80 |
| 43 "Minimap", | 43 local dx = r * math.cos(angle) |
| 44 "TOPLEFT", | 44 local dy = r * math.sin(angle) |
| 45 52 - (80 * cos(pos)), | 45 CyborgMMO_MiniMapFrame:ClearAllPoints() |
| 46 (80 * sin(pos)) - 52) | 46 CyborgMMO_MiniMapFrame:SetPoint("CENTER", "Minimap", "CENTER", dx, dy) |
| 47 end | 47 end |
| 48 | 48 |
| 49 | 49 |
| 50 function CyborgMMO_MiniMapButtonOnUpdate() | 50 function CyborgMMO_MiniMapButtonOnUpdate() |
| 51 | |
| 52 local xpos,ypos = GetCursorPosition() | 51 local xpos,ypos = GetCursorPosition() |
| 53 local xmin,ymin = Minimap:GetLeft(), Minimap:GetBottom() | 52 local xmap,ymap = Minimap:GetCenter() |
| 54 | 53 |
| 55 xpos = (xmin)-(xpos / UIParent:GetScale()) | 54 xpos = xpos / UIParent:GetScale() - xmap |
| 56 ypos = (ypos/ UIParent:GetScale())-(ymin) | 55 ypos = ypos / UIParent:GetScale() - ymap |
| 57 | 56 |
| 58 local degrees = math.deg(math.atan2(ypos, xpos)) | 57 local angle = math.atan2(ypos, xpos) |
| 59 | 58 CyborgMMO_MiniMapButtonReposition(angle) |
| 60 while degrees < 0 do | |
| 61 degrees = degrees + 360 | |
| 62 end | |
| 63 | |
| 64 CyborgMMO_MiniMapButtonReposition(degrees) | |
| 65 end | 59 end |
| 66 | 60 |
| 67 function CyborgMMO_MouseModeChange(mode) | 61 function CyborgMMO_MouseModeChange(mode) |
| 68 local MiniMapTexture = getglobal("CyborgMMO_MiniMapFrameButton_Icon") | 62 local MiniMapTexture = getglobal("CyborgMMO_MiniMapFrameButton_Icon") |
| 69 local MiniMapGlowTexture = getglobal("CyborgMMO_MiniMapFrameButton_IconGlow") | 63 local MiniMapGlowTexture = getglobal("CyborgMMO_MiniMapFrameButton_IconGlow") |
| 349 | 343 |
| 350 CyborgMMO_SetMiniMapButton(Settings.MiniMapButton) | 344 CyborgMMO_SetMiniMapButton(Settings.MiniMapButton) |
| 351 CyborgMMO_SetCyborgHeadButton(Settings.CyborgButton) | 345 CyborgMMO_SetCyborgHeadButton(Settings.CyborgButton) |
| 352 | 346 |
| 353 local xmin,ymin = Minimap:GetLeft(),Minimap:GetBottom() | 347 local xmin,ymin = Minimap:GetLeft(),Minimap:GetBottom() |
| 354 CyborgMMO_MiniMapButtonReposition(math.deg(math.atan2(ymin, xmin))) | 348 local angle = math.rad(150) |
| 349 CyborgMMO_MiniMapButtonReposition(angle) | |
| 355 end | 350 end |
| 356 end | 351 end |
| 357 | 352 |
| 358 function CyborgMMO_SetDefaultSettings() | 353 function CyborgMMO_SetDefaultSettings() |
| 359 CyborgMMO_OpenButtonPageOpenMainForm:ClearAllPoints() | 354 CyborgMMO_OpenButtonPageOpenMainForm:ClearAllPoints() |
