vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | |
2 | |||
3 | function YatlasButton_OnEvent(event) |
||
4 | if(event == "VARIABLES_LOADED") then |
||
5 | YatlasOptionsButtonSlider:SetValue(YatlasOptions.ButtonLocation); |
||
6 | YatlasButton_Update(); |
||
7 | end |
||
8 | end |
||
9 | |||
10 | function YatlasButton_Update() |
||
11 | if(YatlasOptions.ShowButton) then |
||
12 | YatlasButtonFrame:SetPoint( |
||
13 | "TOPLEFT", "Minimap", "TOPLEFT", |
||
14 | 54 - (78 * cos(YatlasOptions.ButtonLocation)), |
||
15 | (78 * sin(YatlasOptions.ButtonLocation)) - 55); |
||
16 | YatlasButtonFrame:Show(); |
||
17 | else |
||
18 | YatlasButtonFrame:Hide(); |
||
19 | end |
||
20 | end |
||
21 | |||
22 | function YatlasButton_BeingDragged() |
||
23 | -- Thanks to Gello for this code |
||
24 | local xpos,ypos = GetCursorPosition() |
||
25 | local xmin,ymin = Minimap:GetLeft(), Minimap:GetBottom() |
||
26 | |||
27 | xpos = xmin-xpos/UIParent:GetScale()+70 |
||
28 | ypos = ypos/UIParent:GetScale()-ymin-70 |
||
29 | |||
30 | YatlasButton_SetPosition(math.deg(math.atan2(ypos,xpos))); |
||
31 | end |
||
32 | |||
33 | function YatlasButton_OnEnter() |
||
34 | GameTooltip:SetOwner(this, "ANCHOR_LEFT"); |
||
35 | GameTooltip:SetText(YATLAS_BUTTON_TOOLTIP1); |
||
36 | GameTooltip:AddLine(YATLAS_BUTTON_TOOLTIP2); |
||
37 | GameTooltip:AddLine(YATLAS_BUTTON_TOOLTIP3); |
||
38 | GameTooltip:Show(); |
||
39 | end |
||
40 | |||
41 | function YatlasButton_SetPosition(v) |
||
42 | if(v < 0) then |
||
43 | v = v + 360; |
||
44 | end |
||
45 | if(v == YatlasOptions.ButtonLocation) then |
||
46 | return; |
||
47 | end |
||
48 | |||
49 | YatlasOptionsButtonSlider:SetValue(YatlasOptions.ButtonLocation); |
||
50 | |||
51 | YatlasOptions.ButtonLocation = v; |
||
52 | YatlasButton_Update() |
||
53 | end |
||
54 | |||
55 | function YatlasButton_GetPosition() |
||
56 | return YatlasOptions.ButtonLocation; |
||
57 | end |
||
58 | |||
59 | |||
60 | function YatlasButton_OnClick() |
||
61 | YatlasFrame:Toggle(); |
||
62 | end |