Chinchilla Minimap

Chinchilla Minimap

2M Downloads

temp fix for non-guild mythic plus difficulty banner position bug

Nukme opened this issue ยท 0 comments

commented

The problem reported in #28 is because the difficulty banner in non-guild mythic plus doesn't fall into either MiniMapInstanceDifficulty or GuildInstanceDifficulty. It is a standalone button called MiniMapChallengeMode, which is not set by Chinchilla.

My temp fix is to add settings for MiniMapChallengeMode in Chinchilla\Modules\MoveButtons.lua.

local buttons = {
	difficulty = MiniMapInstanceDifficulty,
	guilddifficulty = GuildInstanceDifficulty,
	challengedifficulty = MiniMapChallengeMode,
	map = MiniMapWorldMapButton,
	mail = MiniMapMailFrame,
	lfg = QueueStatusMinimapButton,
	dayNight = GameTimeFrame,
	clock = TimeManagerClockButton,
	track = MiniMapTracking,
	voice = MiniMapVoiceChatFrame,
	zoomIn = MinimapZoomIn,
	zoomOut = MinimapZoomOut,
	garrison = GarrisonLandingPageMinimapButton,
}
function MoveButtons:OnDisable()
	self:SetLocked()

	for k, v in pairs(buttons) do
		if k == "guilddifficulty" then k = "difficulty" end
		if k == "challengedifficulty" then k = "difficulty" end

		local deg = buttonStarts[k]

		v:ClearAllPoints()
		v:SetPoint("CENTER", Minimap, "CENTER", getOffset(deg))
		v:SetClampedToScreen(false)
	end
end
function MoveButtons:Update()
	for k, v in pairs(buttons) do
		if k == "guilddifficulty" then k = "difficulty" end
		if k == "challengedifficulty" then k = "difficulty" end

		local deg = self.db.profile[k] or buttonStarts[k]

		if not deg then
			deg = getAngle(v:GetCenter())
		end

		v:ClearAllPoints()

		if type(deg) == "table" then
			v:SetPoint("CENTER", UIParent, deg[1], deg[2], deg[3])
			v:SetClampedToScreen(true)
		else
			v:SetPoint("CENTER", Minimap, "CENTER", getOffset(deg))
			v:SetClampedToScreen(false)
		end
	end
end
local function angle_set(info, value)
	local key = info[#info - 1]

	MoveButtons.db.profile[key] = value

	if not MoveButtons:IsEnabled() then
		return
	end

	if key == "difficulty" then
		MiniMapInstanceDifficulty:ClearAllPoints()
		MiniMapInstanceDifficulty:SetPoint("CENTER", Minimap, "CENTER", getOffset(value))
		GuildInstanceDifficulty:ClearAllPoints()
		GuildInstanceDifficulty:SetPoint("CENTER", Minimap, "CENTER", getOffset(value))
		MiniMapChallengeMode:ClearAllPoints()
		MiniMapChallengeMode:SetPoint("CENTER", Minimap, "CENTER", getOffset(value))
	else
		buttons[key]:ClearAllPoints()
		buttons[key]:SetPoint("CENTER", Minimap, "CENTER", getOffset(value))
	end

	if key == "lfg" then PositionLFD() end
end
local function x_set(info, value)
	if not MoveButtons:IsEnabled() then
		return
	end

	local key = info[#info - 1]
	local data = MoveButtons.db.profile[key]
	local y = y_get(info)

	data[1], data[2], data[3] = getPointXY(buttons[key], value + GetScreenWidth()/2, y + GetScreenHeight()/2)

	if key == "difficulty" then
		MiniMapInstanceDifficulty:ClearAllPoints()
		MiniMapInstanceDifficulty:SetPoint("CENTER", UIParent, unpack(data))
		GuildInstanceDifficulty:ClearAllPoints()
		GuildInstanceDifficulty:SetPoint("CENTER", UIParent, unpack(data))
		MiniMapChallengeMode:ClearAllPoints()
		MiniMapChallengeMode:SetPoint("CENTER", UIParent, unpack(data))
	else
		buttons[key]:ClearAllPoints()
		buttons[key]:SetPoint("CENTER", UIParent, unpack(data))
	end

	if key == "lfg" then PositionLFD() end
end
local function y_set(info, value)
	if not MoveButtons:IsEnabled() then
		return
	end

	local key = info[#info - 1]
	local data = MoveButtons.db.profile[key]
	local x = x_get(info)

	data[1], data[2], data[3] = getPointXY(buttons[key], x + GetScreenWidth()/2, value + GetScreenHeight()/2)

	if key == "difficulty" then
		MiniMapInstanceDifficulty:ClearAllPoints()
		MiniMapInstanceDifficulty:SetPoint("CENTER", UIParent, unpack(data))
		GuildInstanceDifficulty:ClearAllPoints()
		GuildInstanceDifficulty:SetPoint("CENTER", UIParent, unpack(data))
		MiniMapChallengeMode:ClearAllPoints()
		MiniMapChallengeMode:SetPoint("CENTER", UIParent,  unpack(data))
	else
		buttons[key]:ClearAllPoints()
		buttons[key]:SetPoint("CENTER", UIParent, unpack(data))
	end

	if key == "lfg" then PositionLFD() end
end