Skip to content

Commit

Permalink
update WorldMap module and skin
Browse files Browse the repository at this point in the history
  • Loading branch information
Loaal committed Aug 2, 2020
1 parent 4c04e93 commit 07229a0
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 53 deletions.
30 changes: 13 additions & 17 deletions ElvUI/Modules/Maps/Worldmap.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
local E, L, V, P, G = unpack(select(2, ...)) --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local M = E:GetModule("WorldMap")
local S = E:GetModule("Skins")

--Lua functions
local find = string.find
Expand Down Expand Up @@ -131,15 +130,12 @@ function M:PositionCoords()

local db = E.global.general.WorldMapCoordinates
local position = db.position
local xOffset = db.xOffset
local yOffset = db.yOffset

local x, y = 5, 5
if find(position, "RIGHT") then x = -5 end
if find(position, "TOP") then y = -5 end
local x = find(position, "RIGHT") and -5 or 5
local y = find(position, "TOP") and -5 or 5

self.coordsHolder.playerCoords:ClearAllPoints()
self.coordsHolder.playerCoords:Point(position, WorldMapDetailFrame, position, x + xOffset, y + yOffset)
self.coordsHolder.playerCoords:Point(position, WorldMapDetailFrame, position, x + db.xOffset, y + db.yOffset)

self.coordsHolder.mouseCoords:ClearAllPoints()
self.coordsHolder.mouseCoords:Point(position, self.coordsHolder.playerCoords, INVERTED_POINTS[position], 0, y)
Expand All @@ -151,10 +147,6 @@ function M:ToggleMapFramerate()
WorldMapFrame:SetAttribute("UIPanelLayout-allowOtherPanels", true)

WorldMapFrame:SetScale(1)
WorldMapFrame:EnableKeyboard(false)
WorldMapFrame:EnableMouse(false)
else
S:SetUIPanelWindowInfo(WorldMapFrame, "width", 591)
end
end

Expand Down Expand Up @@ -186,7 +178,7 @@ function M:UpdateMapAlpha()
end

function M:Initialize()
M:UpdateMapAlpha()
self:UpdateMapAlpha()

if not E.private.worldmap.enable then return end

Expand All @@ -199,7 +191,7 @@ function M:Initialize()
coordsHolder.playerCoords:SetTextColor(1, 1, 0)
coordsHolder.playerCoords:SetFontObject(NumberFontNormal)
coordsHolder.playerCoords:SetPoint("BOTTOMLEFT", WorldMapDetailFrame, "BOTTOMLEFT", 5, 5)
coordsHolder.playerCoords:SetText(PLAYER..": 0, 0")
coordsHolder.playerCoords:SetFormattedText("%s: 0, 0", PLAYER)

coordsHolder.mouseCoords = coordsHolder:CreateFontString(nil, "OVERLAY")
coordsHolder.mouseCoords:SetTextColor(1, 1, 0)
Expand All @@ -217,21 +209,25 @@ function M:Initialize()
self:RegisterEvent("PLAYER_REGEN_DISABLED")
end

WorldMapFrame:EnableMouse(false)
WorldMapFrame.EnableMouse = E.noop

if E.global.general.smallerWorldMap then
BlackoutWorld:SetTexture(nil)

WorldMapFrame:SetParent(UIParent)
WorldMapFrame.SetParent = E.noop

if GetCVarBool("miniWorldMap") then
S:SetUIPanelWindowInfo(WorldMapFrame, "width", 591)
else
WorldMapFrame:EnableKeyboard(false)
WorldMapFrame.EnableKeyboard = E.noop

if not GetCVarBool("miniWorldMap") then
ShowUIPanel(WorldMapFrame)
self:ToggleMapFramerate()
HideUIPanel(WorldMapFrame)
end

M:SecureHook("ToggleMapFramerate")
self:SecureHook("ToggleMapFramerate")

hooksecurefunc(WorldMapDetailFrame, "SetScale", function(_, scale)
self.blobNewScale = scale
Expand Down
105 changes: 69 additions & 36 deletions ElvUI/Modules/Skins/Blizzard/Worldmap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ local S = E:GetModule("Skins")

--Lua functions
--WoW API / Variables
local InCombatLockdown = InCombatLockdown

S:AddCallback("Skin_WorldMap", function()
if not E.private.skins.blizzard.enable or not E.private.skins.blizzard.worldmap then return end
Expand All @@ -14,9 +13,13 @@ S:AddCallback("Skin_WorldMap", function()
WorldMapFrame:CreateBackdrop("Transparent")
WorldMapFrame.backdrop:Point("TOPRIGHT", WorldMapFrameCloseButton, -3, 0)
WorldMapFrame.backdrop:Point("BOTTOMRIGHT", WorldMapTrackQuest, 0, -3)
WorldMapFrame:SetClampRectInsets(3, 0, 2, 1)

WorldMapFrameTitle:SetDrawLayer("BORDER")

WorldMapTitleButton:Width(530)
WorldMapTitleButton:Point("TOPLEFT", WorldMapFrameMiniBorderLeft, "TOPLEFT", 4, 1)

WorldMapDetailFrame:CreateBackdrop()
WorldMapDetailFrame.backdrop:Point("TOPLEFT", -2, 2)
WorldMapDetailFrame.backdrop:Point("BOTTOMRIGHT", 2, -1)
Expand All @@ -26,8 +29,8 @@ S:AddCallback("Skin_WorldMap", function()
WorldMapQuestDetailScrollFrame:CreateBackdrop("Transparent")
WorldMapQuestDetailScrollFrame.backdrop:Point("TOPLEFT", 24, 2)
WorldMapQuestDetailScrollFrame.backdrop:Point("BOTTOMRIGHT", 23, -4)
WorldMapQuestDetailScrollFrame:SetHitRectInsets(24, -23, 0, -2)
WorldMapQuestDetailScrollFrame.backdrop:SetFrameLevel(WorldMapQuestDetailScrollFrame:GetFrameLevel())
WorldMapQuestDetailScrollFrame:SetHitRectInsets(24, -23, 0, -2)

WorldMapQuestDetailScrollChildFrame:SetScale(1)

Expand All @@ -38,15 +41,17 @@ S:AddCallback("Skin_WorldMap", function()
WorldMapQuestRewardScrollFrame:CreateBackdrop("Transparent")
WorldMapQuestRewardScrollFrame.backdrop:Point("TOPLEFT", 20, 2)
WorldMapQuestRewardScrollFrame.backdrop:Point("BOTTOMRIGHT", 22, -4)
WorldMapQuestRewardScrollFrame:SetHitRectInsets(20, -22, 0, -2)
WorldMapQuestRewardScrollFrame.backdrop:SetFrameLevel(WorldMapQuestRewardScrollFrame:GetFrameLevel())
WorldMapQuestRewardScrollFrame:SetHitRectInsets(20, -22, 0, -2)

WorldMapQuestRewardScrollChildFrame:SetScale(1)

WorldMapQuestRewardScrollFrameTrack:SetTexture()

WorldMapQuestScrollFrame:Point("TOPLEFT", WorldMapDetailFrame, "TOPRIGHT", 6, -1)
WorldMapQuestScrollFrame:CreateBackdrop("Transparent")
WorldMapQuestScrollFrame.backdrop:Point("TOPLEFT", 0, 2)
WorldMapQuestScrollFrame.backdrop:Point("BOTTOMRIGHT", 25, -3)
WorldMapQuestScrollFrame.backdrop:Point("BOTTOMRIGHT", 25, -1)
WorldMapQuestScrollFrame.backdrop:SetFrameLevel(WorldMapQuestScrollFrame:GetFrameLevel())

WorldMapQuestSelectBar:SetTexture(E.Media.Textures.Highlight)
Expand All @@ -59,35 +64,38 @@ S:AddCallback("Skin_WorldMap", function()
S:HandleScrollBar(WorldMapQuestDetailScrollFrameScrollBar)
S:HandleScrollBar(WorldMapQuestRewardScrollFrameScrollBar)

WorldMapQuestScrollFrameScrollBar:Point("TOPLEFT", WorldMapQuestScrollFrame, "TOPRIGHT", 7, -17)
WorldMapQuestScrollFrameScrollBar:Point("BOTTOMLEFT", WorldMapQuestScrollFrame, "BOTTOMRIGHT", 7, 16)
WorldMapQuestScrollFrameScrollBar:Point("TOPLEFT", WorldMapQuestScrollFrame, "TOPRIGHT", 5, -19)
WorldMapQuestScrollFrameScrollBar:Point("BOTTOMLEFT", WorldMapQuestScrollFrame, "BOTTOMRIGHT", 5, 20)

WorldMapQuestDetailScrollFrameScrollBar:Point("TOPLEFT", WorldMapQuestDetailScrollFrame, "TOPRIGHT", 5, -17)
WorldMapQuestDetailScrollFrameScrollBar:Point("BOTTOMLEFT", WorldMapQuestDetailScrollFrame, "BOTTOMRIGHT", 5, 15)
WorldMapQuestDetailScrollFrameScrollBar:Point("TOPLEFT", WorldMapQuestDetailScrollFrame, "TOPRIGHT", 3, -19)
WorldMapQuestDetailScrollFrameScrollBar:Point("BOTTOMLEFT", WorldMapQuestDetailScrollFrame, "BOTTOMRIGHT", 3, 17)

WorldMapQuestRewardScrollFrameScrollBar:Point("TOPLEFT", WorldMapQuestRewardScrollFrame, "TOPRIGHT", 4, -17)
WorldMapQuestRewardScrollFrameScrollBar:Point("BOTTOMLEFT", WorldMapQuestRewardScrollFrame, "BOTTOMRIGHT", 4, 15)
WorldMapQuestRewardScrollFrameScrollBar:Point("TOPLEFT", WorldMapQuestRewardScrollFrame, "TOPRIGHT", 2, -19)
WorldMapQuestRewardScrollFrameScrollBar:Point("BOTTOMLEFT", WorldMapQuestRewardScrollFrame, "BOTTOMRIGHT", 2, 17)

S:HandleCloseButton(WorldMapFrameCloseButton)

WorldMapFrameSizeDownButton:ClearAllPoints()
WorldMapFrameSizeDownButton:Point("RIGHT", WorldMapFrameCloseButton, "LEFT", 4, 0)
WorldMapFrameSizeDownButton.SetPoint = E.noop
WorldMapFrameSizeDownButton:GetHighlightTexture():Kill()
S:HandleNextPrevButton(WorldMapFrameSizeDownButton, nil, nil, true)
S:HandleNextPrevButton(WorldMapFrameSizeDownButton, "down", nil, true)
WorldMapFrameSizeDownButton:Size(26)

WorldMapFrameSizeUpButton:ClearAllPoints()
WorldMapFrameSizeUpButton:Point("RIGHT", WorldMapFrameCloseButton, "LEFT", 4, 0)
WorldMapFrameSizeUpButton:GetHighlightTexture():Kill()
S:HandleNextPrevButton(WorldMapFrameSizeUpButton, nil, nil, true)
S:HandleNextPrevButton(WorldMapFrameSizeUpButton, "up", nil, true)
WorldMapFrameSizeUpButton:Size(26)

S:HandleDropDownBox(WorldMapLevelDropDown)
S:HandleDropDownBox(WorldMapZoneMinimapDropDown)
S:HandleDropDownBox(WorldMapContinentDropDown)
S:HandleDropDownBox(WorldMapZoneDropDown)

WorldMapLevelUpButton:Point("TOPLEFT", WorldMapLevelDropDown, "TOPRIGHT", -6, 4)
WorldMapLevelDownButton:Point("BOTTOMLEFT", WorldMapLevelDropDown, "BOTTOMRIGHT", -6, 0)

S:HandleButton(WorldMapZoomOutButton)
WorldMapZoomOutButton:Point("LEFT", WorldMapZoneDropDown, "RIGHT", 0, 3)

Expand All @@ -104,39 +112,61 @@ S:AddCallback("Skin_WorldMap", function()
WorldMapZoneInfo:FontTemplate(nil, 27, "OUTLINE")
WorldMapZoneInfo:SetShadowOffset(2, -2)

WorldMapLevelDropDown.SetPoint = E.noop

local setPoint = UIParent.SetPoint
local currentMapMode

local function SmallSkin()
if WORLDMAP_SETTINGS.advanced then
WorldMapFrame.backdrop:Point("TOPLEFT", 4, 2)
if currentMapMode == 0 then return end
currentMapMode = 0

WorldMapFrame.backdrop:Point("TOPLEFT", 3, 2)
WorldMapFrame.backdrop:Point("TOPRIGHT", WorldMapFrameCloseButton, -3, 0)

WorldMapDetailFrame.backdrop:Point("TOPLEFT", -2, 2)
WorldMapDetailFrame.backdrop:Point("BOTTOMRIGHT", 1, -1)

WorldMapLevelDropDown:ClearAllPoints()
WorldMapLevelDropDown:Point("TOPRIGHT", WorldMapPositioningGuide, "TOPRIGHT", -420, -24)
setPoint(WorldMapLevelDropDown, "TOPRIGHT", WorldMapPositioningGuide, "TOPRIGHT", -419, -24)
else
if currentMapMode == 1 then return end
currentMapMode = 1

WorldMapFrame.backdrop:Point("TOPLEFT", 11, -12)
WorldMapFrame.backdrop:Point("TOPRIGHT", WorldMapFrameCloseButton, -1, 0)

WorldMapDetailFrame.backdrop:Point("TOPLEFT", -2, 2)
WorldMapDetailFrame.backdrop:Point("BOTTOMRIGHT", 2, -1)

WorldMapLevelDropDown:ClearAllPoints()
WorldMapLevelDropDown:Point("TOPRIGHT", WorldMapPositioningGuide, "TOPRIGHT", -440, -38)
setPoint(WorldMapLevelDropDown, "TOPRIGHT", WorldMapPositioningGuide, "TOPRIGHT", -439, -38)
end
end

local function LargeSkin()
if not E.private.worldmap.enable or (E.private.worldmap.enable and not E.global.general.smallerWorldMap) then
if not InCombatLockdown() then
WorldMapFrame:EnableMouse(false)
WorldMapFrame:EnableKeyboard(false)
elseif not WorldMapFrame:IsEventRegistered("PLAYER_REGEN_ENABLED") then
WorldMapFrame:RegisterEvent("PLAYER_REGEN_ENABLED", function(self)
self:EnableMouse(false)
self:EnableKeyboard(false)
self:UnregisterEvent("PLAYER_REGEN_ENABLED")
end)
end
end
if currentMapMode == 2 then return end
currentMapMode = 2

WorldMapFrame.backdrop:Point("TOPLEFT", WorldMapDetailFrame, "TOPLEFT", -8, 70)
WorldMapFrame.backdrop:Point("TOPRIGHT", WorldMapFrameCloseButton, -3, 0)

WorldMapDetailFrame.backdrop:Point("TOPLEFT", -1, 1)
WorldMapDetailFrame.backdrop:Point("BOTTOMRIGHT", 1, -1)

WorldMapFrame.backdrop:Point("TOPLEFT", WorldMapDetailFrame, "TOPLEFT", -13, 70)
setPoint(WorldMapLevelDropDown, "TOPRIGHT", WorldMapPositioningGuide, "TOPRIGHT", -50, -35)
end

local function QuestSkin()
WorldMapFrame.backdrop:Point("TOPLEFT", WorldMapDetailFrame, "TOPLEFT", -14, 70)
if currentMapMode == 3 then return end
currentMapMode = 3

WorldMapFrame.backdrop:Point("TOPLEFT", WorldMapDetailFrame, "TOPLEFT", -9, 70)
WorldMapFrame.backdrop:Point("TOPRIGHT", WorldMapFrameCloseButton, -3, 0)

WorldMapDetailFrame.backdrop:Point("TOPLEFT", -1, 1)
WorldMapDetailFrame.backdrop:Point("BOTTOMRIGHT", 1, -1)

setPoint(WorldMapLevelDropDown, "TOPRIGHT", WorldMapPositioningGuide, "TOPRIGHT", -50, -35)
end

local function FixSkin()
Expand All @@ -150,13 +180,16 @@ S:AddCallback("Skin_WorldMap", function()
end

if not E.private.worldmap.enable then
ShowUIPanel(WorldMapFrame)
FixSkin()
HideUIPanel(WorldMapFrame)
else
FixSkin()
WorldMapFrame:EnableMouse(false)
WorldMapFrame.EnableMouse = E.noop
end

WorldMapTitleButton:Hide()
WorldMapFrame.backdrop:EnableMouse(true)

FixSkin()
S:SetUIPanelWindowInfo(WorldMapFrame, "width", 594)

hooksecurefunc("WorldMapFrame_SetQuestMapView", QuestSkin)
hooksecurefunc("WorldMapFrame_SetFullMapView", LargeSkin)
hooksecurefunc("WorldMapFrame_SetMiniMode", SmallSkin)
Expand Down

0 comments on commit 07229a0

Please sign in to comment.