Fixes for Mapster and Worldmap skin (#87)
This commit is contained in:
committed by
GitHub
parent
494ebbd885
commit
411aa7d604
+1
-1
@@ -5,7 +5,7 @@
|
||||
## Notes: User Interface replacement AddOn for World of Warcraft.
|
||||
## SavedVariables: ElvDB, ElvPrivateDB
|
||||
## SavedVariablesPerCharacter: ElvCharacterDB
|
||||
## OptionalDeps: Blizzard_DebugTools, SharedMedia, Tukui, ButtonFacade
|
||||
## OptionalDeps: Blizzard_DebugTools, SharedMedia, Tukui, ButtonFacade, Mapster
|
||||
## X-oUF: ElvUF
|
||||
## X-IconTexture: Interface\AddOns\ElvUI\Media\ElvUILogo
|
||||
|
||||
|
||||
@@ -177,9 +177,16 @@ function M:UpdateMapAlpha()
|
||||
end
|
||||
end
|
||||
|
||||
function M:IsMapsterEnabled()
|
||||
local Mapster = LibStub("AceAddon-3.0"):GetAddon("Mapster", true)
|
||||
return Mapster ~= nil
|
||||
end
|
||||
|
||||
function M:Initialize()
|
||||
self:UpdateMapAlpha()
|
||||
|
||||
local mapsterEnabled = self:IsMapsterEnabled()
|
||||
|
||||
if not E.private.worldmap.enable then return end
|
||||
|
||||
if E.global.general.WorldMapCoordinates.enable then
|
||||
@@ -209,17 +216,24 @@ function M:Initialize()
|
||||
self:RegisterEvent("PLAYER_REGEN_DISABLED")
|
||||
end
|
||||
|
||||
WorldMapFrame:EnableMouse(false)
|
||||
WorldMapFrame.EnableMouse = E.noop
|
||||
-- Only disable mouse interaction if Mapster is not enabled
|
||||
-- Mapster needs mouse events for dragging the map
|
||||
if not mapsterEnabled then
|
||||
WorldMapFrame:EnableMouse(false)
|
||||
WorldMapFrame.EnableMouse = E.noop
|
||||
end
|
||||
|
||||
if E.global.general.smallerWorldMap then
|
||||
BlackoutWorld:SetTexture(nil)
|
||||
-- Only modify these if Mapster is not handling positioning
|
||||
if not mapsterEnabled then
|
||||
BlackoutWorld:SetTexture(nil)
|
||||
|
||||
WorldMapFrame:SetParent(UIParent)
|
||||
WorldMapFrame.SetParent = E.noop
|
||||
WorldMapFrame:SetParent(UIParent)
|
||||
WorldMapFrame.SetParent = E.noop
|
||||
|
||||
WorldMapFrame:EnableKeyboard(false)
|
||||
WorldMapFrame.EnableKeyboard = E.noop
|
||||
WorldMapFrame:EnableKeyboard(false)
|
||||
WorldMapFrame.EnableKeyboard = E.noop
|
||||
end
|
||||
|
||||
if not GetCVarBool("miniWorldMap") then
|
||||
ShowUIPanel(WorldMapFrame)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)) --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local S = E:GetModule("Skins")
|
||||
local M = E:GetModule("WorldMap")
|
||||
|
||||
--Lua functions
|
||||
--WoW API / Variables
|
||||
@@ -7,18 +8,23 @@ local S = E:GetModule("Skins")
|
||||
S:AddCallback("Skin_WorldMap", function()
|
||||
if not E.private.skins.blizzard.enable or not E.private.skins.blizzard.worldmap then return end
|
||||
|
||||
-- Check if Mapster is enabled
|
||||
local mapsterEnabled = M:IsMapsterEnabled()
|
||||
|
||||
WorldMapFrame:DisableDrawLayer("BACKGROUND")
|
||||
WorldMapFrame:DisableDrawLayer("ARTWORK")
|
||||
WorldMapFrame:DisableDrawLayer("OVERLAY")
|
||||
WorldMapFrame:CreateBackdrop("Transparent")
|
||||
WorldMapFrame.backdrop:Point("TOPRIGHT", WorldMapFrameCloseButton, -3, 0)
|
||||
WorldMapFrame.backdrop:Point("BOTTOMRIGHT", WorldMapTrackQuest, 0, -3)
|
||||
WorldMapFrame:SetClampRectInsets(3, 0, 2, 1)
|
||||
|
||||
if not mapsterEnabled then
|
||||
WorldMapFrame:SetClampRectInsets(3, 0, 2, 1)
|
||||
WorldMapFrameTitle:SetDrawLayer("BORDER")
|
||||
WorldMapTitleButton:Width(530)
|
||||
WorldMapTitleButton:Point("TOPLEFT", WorldMapFrameMiniBorderLeft, "TOPLEFT", 4, 1)
|
||||
end
|
||||
|
||||
WorldMapFrameTitle:SetDrawLayer("BORDER")
|
||||
|
||||
WorldMapTitleButton:Width(530)
|
||||
WorldMapTitleButton:Point("TOPLEFT", WorldMapFrameMiniBorderLeft, "TOPLEFT", 4, 1)
|
||||
|
||||
WorldMapDetailFrame:CreateBackdrop()
|
||||
WorldMapDetailFrame.backdrop:Point("TOPLEFT", -2, 2)
|
||||
@@ -124,6 +130,8 @@ S:AddCallback("Skin_WorldMap", function()
|
||||
local currentMapMode
|
||||
|
||||
local function SmallSkin()
|
||||
if mapsterEnabled then return end -- Let Mapster handle positioning
|
||||
|
||||
if WORLDMAP_SETTINGS.advanced then
|
||||
if currentMapMode == 0 then return end
|
||||
currentMapMode = 0
|
||||
@@ -150,6 +158,8 @@ S:AddCallback("Skin_WorldMap", function()
|
||||
end
|
||||
|
||||
local function LargeSkin()
|
||||
if mapsterEnabled then return end -- Let Mapster handle positioning
|
||||
|
||||
if currentMapMode == 2 then return end
|
||||
currentMapMode = 2
|
||||
|
||||
@@ -163,6 +173,8 @@ S:AddCallback("Skin_WorldMap", function()
|
||||
end
|
||||
|
||||
local function QuestSkin()
|
||||
if mapsterEnabled then return end -- Let Mapster handle positioning
|
||||
|
||||
if currentMapMode == 3 then return end
|
||||
currentMapMode = 3
|
||||
|
||||
@@ -176,6 +188,8 @@ S:AddCallback("Skin_WorldMap", function()
|
||||
end
|
||||
|
||||
local function FixSkin()
|
||||
if mapsterEnabled then return end -- Let Mapster handle positioning
|
||||
|
||||
if WORLDMAP_SETTINGS.size == WORLDMAP_FULLMAP_SIZE then
|
||||
LargeSkin()
|
||||
elseif WORLDMAP_SETTINGS.size == WORLDMAP_WINDOWED_SIZE then
|
||||
@@ -185,7 +199,7 @@ S:AddCallback("Skin_WorldMap", function()
|
||||
end
|
||||
end
|
||||
|
||||
if not E.private.worldmap.enable then
|
||||
if not E.private.worldmap.enable and not mapsterEnabled then
|
||||
WorldMapFrame:EnableMouse(false)
|
||||
WorldMapFrame.EnableMouse = E.noop
|
||||
end
|
||||
@@ -193,12 +207,13 @@ S:AddCallback("Skin_WorldMap", function()
|
||||
WorldMapTitleButton:Hide()
|
||||
WorldMapFrame.backdrop:EnableMouse(true)
|
||||
|
||||
FixSkin()
|
||||
S:SetUIPanelWindowInfo(WorldMapFrame, "width", 594)
|
||||
|
||||
hooksecurefunc("WorldMapFrame_SetQuestMapView", QuestSkin)
|
||||
hooksecurefunc("WorldMapFrame_SetFullMapView", LargeSkin)
|
||||
hooksecurefunc("WorldMapFrame_SetMiniMode", SmallSkin)
|
||||
hooksecurefunc("ToggleMapFramerate", FixSkin)
|
||||
hooksecurefunc("WorldMapFrame_ToggleAdvanced", FixSkin)
|
||||
if not mapsterEnabled then
|
||||
FixSkin()
|
||||
S:SetUIPanelWindowInfo(WorldMapFrame, "width", 594)
|
||||
hooksecurefunc("WorldMapFrame_SetQuestMapView", QuestSkin)
|
||||
hooksecurefunc("WorldMapFrame_SetFullMapView", LargeSkin)
|
||||
hooksecurefunc("WorldMapFrame_SetMiniMode", SmallSkin)
|
||||
hooksecurefunc("ToggleMapFramerate", FixSkin)
|
||||
hooksecurefunc("WorldMapFrame_ToggleAdvanced", FixSkin)
|
||||
end
|
||||
end)
|
||||
@@ -102,13 +102,27 @@ S:AddCallbackForAddon("Mapster", "Mapster", function()
|
||||
WorldMapDetailFrame.backdrop:Hide()
|
||||
end
|
||||
|
||||
-- Position Mapster Options Button based on map size
|
||||
local function updateMapsterButtonPosition()
|
||||
MapsterOptionsButton:ClearAllPoints()
|
||||
if Mapster.miniMap or (WORLDMAP_SETTINGS and WORLDMAP_SETTINGS.size == WORLDMAP_WINDOWED_SIZE) then
|
||||
-- Minimized map - anchor to SizeUpButton
|
||||
MapsterOptionsButton:Point("RIGHT", WorldMapFrameSizeUpButton, "LEFT", -4, 0)
|
||||
else
|
||||
-- Maximized map - anchor to SizeDownButton
|
||||
MapsterOptionsButton:Point("RIGHT", WorldMapFrameSizeDownButton, "LEFT", -4, 0)
|
||||
end
|
||||
end
|
||||
|
||||
local function sizeDown()
|
||||
WorldMapFrame.backdrop:Point("TOPLEFT", WorldMapDetailFrame, "TOPLEFT", -14, 27)
|
||||
WorldMapDetailFrame.backdrop:Hide()
|
||||
updateMapsterButtonPosition()
|
||||
end
|
||||
local function sizeUp()
|
||||
WorldMapFrame.backdrop:Point("TOPLEFT", WorldMapDetailFrame, "TOPLEFT", -14, 70)
|
||||
WorldMapDetailFrame.backdrop:Show()
|
||||
updateMapsterButtonPosition()
|
||||
end
|
||||
|
||||
S:SecureHook(Mapster, "SizeDown", sizeDown)
|
||||
@@ -128,12 +142,10 @@ S:AddCallbackForAddon("Mapster", "Mapster", function()
|
||||
end
|
||||
end)
|
||||
|
||||
MapsterOptionsButton:Point("TOPRIGHT", WorldMapPositioningGuide, "TOPRIGHT", -50, -3)
|
||||
MapsterOptionsButton.SetPoint = E.noop
|
||||
S:HandleButton(MapsterOptionsButton)
|
||||
updateMapsterButtonPosition()
|
||||
|
||||
MapsterQuestObjectivesDropDown:Point("BOTTOMRIGHT", WorldMapPositioningGuide, "BOTTOMRIGHT", -7, -4)
|
||||
|
||||
S:HandleButton(MapsterOptionsButton)
|
||||
S:HandleDropDownBox(MapsterQuestObjectivesDropDown)
|
||||
|
||||
do -- Scaler
|
||||
|
||||
Reference in New Issue
Block a user