vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | simpleMinimap_Autozoom = simpleMinimap:NewModule("autozoom") |
2 | local L = AceLibrary("AceLocale-2.1"):GetInstance("simpleMinimap_Autozoom", true) |
||
3 | -- |
||
4 | function simpleMinimap_Autozoom:OnInitialize() |
||
5 | self.db = simpleMinimap:AcquireDBNamespace("autozoom") |
||
6 | self.defaults = { enabled=true, time=20 } |
||
7 | self.options = { |
||
8 | type = "group", name=L.autozoom, desc=L.autozoom_desc, |
||
9 | args = { |
||
10 | title = { |
||
11 | type="header", order=1, name="simpleMinimap |cFFFFFFCC"..L.autozoom |
||
12 | }, |
||
13 | spacer1 = { |
||
14 | type = "header", order=2 |
||
15 | }, |
||
16 | enabled = { |
||
17 | type="toggle", order=3, name=L.enabled, desc=L.enabled_desc, |
||
18 | get=function() return(self.db.profile.enabled) end, |
||
19 | set=function(x) self.db.profile.enabled=x simpleMinimap:ToggleModuleActive(self,x) end |
||
20 | }, |
||
21 | spacer2 = { |
||
22 | type="header", order=4, name="---" |
||
23 | }, |
||
24 | time = { |
||
25 | type="range", order=10, name=L.time, desc=L.time_desc, |
||
26 | min= 2, max=120, step=2, |
||
27 | get=function() return(self.db.profile.time) end, |
||
28 | set=function(x) self.db.profile.time=x end |
||
29 | } |
||
30 | } |
||
31 | } |
||
32 | simpleMinimap.options.args.modules.args.autozoom = self.options |
||
33 | simpleMinimap:RegisterDefaults("autozoom", "profile", self.defaults) |
||
34 | end |
||
35 | -- |
||
36 | function simpleMinimap_Autozoom:OnEnable() |
||
37 | if(self.db.profile.enabled) then |
||
38 | self:Hook("Minimap_ZoomIn") |
||
39 | self:Hook("Minimap_ZoomOut") |
||
40 | self:EventAutozoom() |
||
41 | else |
||
42 | simpleMinimap:ToggleModuleActive(self, false) |
||
43 | end |
||
44 | end |
||
45 | -- |
||
46 | function simpleMinimap_Autozoom:OnDisable() |
||
47 | self:CancelAllScheduledEvents() |
||
48 | end |
||
49 | -- |
||
50 | function simpleMinimap_Autozoom:EventAutozoom() |
||
51 | Minimap:SetZoom(0) |
||
52 | MinimapZoomOut:Disable() |
||
53 | MinimapZoomIn:Enable() |
||
54 | end |
||
55 | -- |
||
56 | function simpleMinimap_Autozoom:Minimap_ZoomIn() |
||
57 | self:ScheduleEvent("smmAutozoom", self.EventAutozoom, self.db.profile.time, self) |
||
58 | return self.hooks.Minimap_ZoomIn() |
||
59 | end |
||
60 | -- |
||
61 | function simpleMinimap_Autozoom:Minimap_ZoomOut() |
||
62 | self:ScheduleEvent("smmAutozoom", self.EventAutozoom, self.db.profile.time, self) |
||
63 | return self.hooks.Minimap_ZoomOut() |
||
64 | end |