From e67dbf11a107dd5c24e3654b575d0438e0e7b3fb Mon Sep 17 00:00:00 2001 From: Simpy Date: Fri, 27 Dec 2024 18:17:54 -0500 Subject: [PATCH] use the cvar api --- ElvUI/Core/General/API.lua | 13 ++++++++----- ElvUI/Core/Modules/Maps/Minimap.lua | 15 +++++++++++++-- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/ElvUI/Core/General/API.lua b/ElvUI/Core/General/API.lua index a3d9e55680..5a38804fe5 100644 --- a/ElvUI/Core/General/API.lua +++ b/ElvUI/Core/General/API.lua @@ -800,6 +800,14 @@ function E:PLAYER_ENTERING_WORLD(_, initLogin, isReload) if initLogin or isReload then E:CheckIncompatible() + + if E.Retail then + if E.private.general.minimap.enable then + E:SetCVar('rotateMinimap', 0) -- Impossible to turn off in ElvUI if its on + end + elseif E.db.general.lockCameraDistanceMax then + E:SetCVar('cameraDistanceMaxZoomFactor', E.db.general.cameraDistanceMax) -- Blizzard will set this value to int(60/CVar cameraDistanceMax)+1 at logout if it is manually set higher than that + end end if not E.MediaUpdated then @@ -807,11 +815,6 @@ function E:PLAYER_ENTERING_WORLD(_, initLogin, isReload) E.MediaUpdated = true end - -- Blizzard will set this value to int(60/CVar cameraDistanceMax)+1 at logout if it is manually set higher than that - if not E.Retail and E.db.general.lockCameraDistanceMax then - E:SetCVar('cameraDistanceMaxZoomFactor', E.db.general.cameraDistanceMax) - end - local _, instanceType = GetInstanceInfo() if instanceType == 'pvp' then E.BGTimer = E:ScheduleRepeatingTimer('RequestBGInfo', 5) diff --git a/ElvUI/Core/Modules/Maps/Minimap.lua b/ElvUI/Core/Modules/Maps/Minimap.lua index 943a14a261..ea03e93587 100644 --- a/ElvUI/Core/Modules/Maps/Minimap.lua +++ b/ElvUI/Core/Modules/Maps/Minimap.lua @@ -611,6 +611,12 @@ function M:ClusterPoint(_, anchor) end end +function M:ContainerScale(scale) + if scale ~= 1 then + self:SetScale(1) + end +end + function M:PLAYER_ENTERING_WORLD(_, initLogin, isReload) if initLogin or isReload then local LFGIconBorder = _G.MiniMapLFGFrameBorder or _G.MiniMapLFGBorder or _G.LFGMinimapFrameBorder @@ -625,8 +631,13 @@ end function M:Initialize() if E.private.general.minimap.enable then Minimap:SetMaskTexture(E.Retail and 130937 or [[interface\chatframe\chatframebackground]]) - SetCVar("rotateMinimap", 0) --Impossible to turn off in ElvUI if its on. - Minimap:GetParent():SetScale(1) --Another setting that could get set in Blizzard Edit Mode + + local container = MinimapCluster.MinimapContainer + if container then + container:SetScale(1) -- Setting that could get set in Blizzard Edit Mode + + hooksecurefunc(container, 'SetScale', M.ContainerScale) + end else Minimap:SetMaskTexture(E.Retail and 186178 or [[textures\minimapmask]])