Chinchilla Minimap

Chinchilla Minimap

2M Downloads

Garrison minimap button

Hmmharold opened this issue ยท 5 comments

commented

Describe the bug
Garrison minimap is floating by itself in default location (top-right) upon logging into game.
Disabling then Enabling Move Buttons resets Garrison button back into place
Reloading UI puts Garrison button back in space(top-right)

To Reproduce

Expected behavior
Garrison minimap button should be attached to minimap when checked on MoveButtons>Garrison>Attach to minimap and stay attached after reload

Screenshots
WoWScrnShot_101620_011455

WoW version
Retail 9.0.1

Additional context
Add any other context about the problem here.

commented

Happening for me as well on Horde side. SexyMap had similar issue in it's 9.x version until it was updated, assume it's some change in the UI

commented

It's because that Blizzard has hardcoded the anchors for GarrisonLandingPageMinimapButton in 9.0.

local garrisonTypeAnchors = {
	["default"] = AnchorUtil.CreateAnchor("TOPLEFT", "MinimapBackdrop", "TOPLEFT", 32, -118),
	[Enum.GarrisonType.Type_9_0] = AnchorUtil.CreateAnchor("TOPLEFT", "MinimapBackdrop", "TOPLEFT", 32, -106),
}

local function GetGarrisonTypeAnchor(garrisonType)
	return garrisonTypeAnchors[garrisonType or "default"] or garrisonTypeAnchors["default"];
end

local function ApplyGarrisonTypeAnchor(self, garrisonType)
	local anchor = GetGarrisonTypeAnchor(garrisonType);
	local clearAllPoints = true;
	anchor:SetPoint(self, clearAllPoints);
end
function GarrisonLandingPageMinimapButton_UpdateIcon(self)
	local garrisonType = C_Garrison.GetLandingPageGarrisonType();
	self.garrisonType = garrisonType;

	ApplyGarrisonTypeAnchor(self, garrisonType);

So every /reload command would take this button back to one of the two anchors. SexyMap solves this problem by hooking a function to GarrisonLandingPageMinimapButton_UpdateIcon().

commented

Upon checking the frames(/fstack), I find that "MinimapCluster" and "MinimapBackdrop" are not moved to the position of "Minimap", they are not overlapped. So I figure out a temp fix to 'stick' the garrison button to minimap:

add 2 lines in function Position:SetMinimapPosition(point, x, y) in Chinchilla/Modules/Position.lua.

change from

	Minimap:ClearAllPoints()
	Minimap:SetPoint(point, UIParent, point, x, y)

to

	Minimap:ClearAllPoints()
	Minimap:SetPoint(point, UIParent, point, x, y)

	MinimapCluster:ClearAllPoints()
	MinimapCluster:SetPoint(point, UIParent, point, x, y)

This would make garrison button to go along with the minimap, but it still is 'fixed' by the hardcoded blizz anchor.

commented

Borrowing the idea from the SexyMap fix, I come up with another temp fix that solves the issue.

change function MoveButtons:OnEnable() in Chinchilla/Modules/MoveButtons.lua

from

function MoveButtons:OnEnable()
	self:SetLocked()
	self:Update()

	if not Chinchilla:IsClassic() and not Chinchilla:IsHooked("QueueStatusFrame_Update") then
		Chinchilla:SecureHook("QueueStatusFrame_Update", PositionLFD)
	end
end

to

function MoveButtons:OnEnable()
	self:SetLocked()
	self:Update()

	if not Chinchilla:IsClassic() and not Chinchilla:IsHooked("QueueStatusFrame_Update") then
		Chinchilla:SecureHook("QueueStatusFrame_Update", PositionLFD)
	end

	if not Chinchilla:IsClassic() and not Chinchilla:IsHooked("GarrisonLandingPageMinimapButton_UpdateIcon") then
		hooksecurefunc("GarrisonLandingPageMinimapButton_UpdateIcon", function()
			MoveButtons:Update()
		end)
	end
end

Unlike the fix for SexyMap, in which it could hook update of a specific button frame (GarrisonLandingPageMinimapButton), I don't know how to do the same in Chinchilla. So for now the updates for all buttons are hooked.

commented

I just updated to the latest alpha version and this are still not working properly? Or is it just me having issues?

Doesn't help much either, that the release of Shadowlands caused the button to go AWOL, so now I don't even know where that button is hiding.

EDIT: Button is back (after completing the story and unlocking/choosing my covenant) and seems to stay where it should now.