fix minimap zoom

fix non-default chat tab on login
This commit is contained in:
Pinya
2018-07-22 21:21:20 +03:00
parent 7621e0f4af
commit 86d207f941
2 changed files with 18 additions and 6 deletions
+16 -6
View File
@@ -70,16 +70,17 @@ function M:Minimap_OnMouseUp(btn)
end
function M:Minimap_OnMouseWheel()
if arg1 > 0 then
_G.MinimapZoomIn:Click()
elseif arg1 < 0 then
_G.MinimapZoomOut:Click()
local zoomLevel = Minimap:GetZoom()
if arg1 > 0 and zoomLevel < 5 then
Minimap:SetZoom(zoomLevel + 1)
elseif arg1 < 0 and zoomLevel > 0 then
Minimap:SetZoom(zoomLevel - 1)
end
end
function M:Update_ZoneText()
if E.db.general.minimap.locationText == "HIDE" or not E.private.general.minimap.enable then return end
Minimap.location:SetText(strsub(GetMinimapZoneText(),1,46))
Minimap.location:SetText(strsub(GetMinimapZoneText(), 1, 46))
Minimap.location:SetTextColor(self:GetLocTextColor())
E:FontTemplate(Minimap.location, E.LSM:Fetch("font", E.db.general.minimap.locationFont), E.db.general.minimap.locationFontSize, E.db.general.minimap.locationFontOutline)
end
@@ -96,14 +97,22 @@ local function ResetZoom()
MinimapZoomOut:Disable()
isResetting = false
end
local function SetupZoomReset()
local function SetupZoomReset(_, zoomLevel)
if E.db.general.minimap.resetZoom.enable and not isResetting then
isResetting = true
E:Delay(E.db.general.minimap.resetZoom.time, ResetZoom)
else
E.private.general.minimap.zoomLevel = zoomLevel
end
end
hooksecurefunc(Minimap, "SetZoom", SetupZoomReset)
function M:MINIMAP_UPDATE_ZOOM()
if E.private.general.minimap.zoomLevel ~= Minimap:GetZoom() then
Minimap:SetZoom(E.private.general.minimap.zoomLevel)
end
end
function M:UpdateSettings()
E.MinimapSize = E.private.general.minimap.enable and E.db.general.minimap.size or Minimap:GetWidth() + 10
E.MinimapWidth = E.MinimapSize
@@ -315,6 +324,7 @@ function M:Initialize()
self:RegisterEvent("ZONE_CHANGED", "Update_ZoneText")
self:RegisterEvent("ZONE_CHANGED_INDOORS", "Update_ZoneText")
self:RegisterEvent("PLAYER_ENTERING_WORLD", "Update_ZoneText")
self:RegisterEvent("MINIMAP_UPDATE_ZOOM")
local fm = CreateFrame("Minimap", "FarmModeMap", E.UIParent)
E:Size(fm, E.db.farmSize)