-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWorldMap.lua
78 lines (63 loc) · 2.13 KB
/
WorldMap.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
local addonName, vm = ...
local overlayFrame, markers, tooltip = nil, {}, nil
-- local functions
local placeMarker, getMarker, placeMarker, leaveMarker, enterMarker, clickMarker
vm.WorldMap = {
display = function()
for k, v in pairs(VadeMecum_Notes) do
placeMarker(k, VadeMecum_Notes[k])
end
if tooltip == nill then
tooltip = CreateFrame('GameTooltip', 'VadeMecum_tt', WorldMapFrame, 'GameTooltipTemplate');
tooltip:Hide();
end
VadeMecumMapOverlayParent:Show()
overlayFrame:Show()
end
}
-- +++
function placeMarker(index, note)
marker = getMarker(index)
marker:SetAlpha(1)
marker:SetWidth(16)
marker:SetHeight(16)
marker.id = index
local texture = marker:GetNormalTexture()
local color = vm.Config.Colors[note.color] or {1,1,1}
texture:SetVertexColor(color[1],color[2],color[3], 0.6)
vm.Astrolabe:PlaceIconOnWorldMap(WorldMapButton, marker, note.continent, note.zone, note.posX, note.posY)
end
-- +++
function enterMarker(marker)
vm.Utils.showTooltip(marker, tooltip)
end
-- +++
function leaveMarker ()
tooltip:Hide()
end
-- +++
function clickMarker(marker)
vm.Utils.showTooltip(marker, tooltip, true)
end
-- +++
function getMarker(index)
local marker = markers[index]
if marker == nil then
if overlayFrame == nil then
overlayFrame = CreateFrame("Frame", nil, VadeMecumMapOverlayParent, "VadeMecumrMapOverlayTemplate")
-- overlayFrame:EnableKeyboard(true)
-- overlayFrame:SetScript('OnKeyUp', function(this, key)
-- if (key == 'N') and IsShiftKeyDown() then
-- vm.Notes.add()
-- end
-- end)
end
marker = CreateFrame("Button" , nil, overlayFrame, "VadeMecumrMarkerTemplate")
marker:SetID(index)
marker:SetScript('OnEnter', function() enterMarker(this) end)
marker:SetScript('OnLeave', function() leaveMarker() end)
marker:SetScript('OnClick', function() clickMarker(this) end)
markers[index] = marker
end
return marker
end