Combat Mode

Combat Mode

9.4k Downloads

Fix for reticle changing position when switching states

julen3 opened this issue ยท 2 comments

commented

When the reticle switches its color and size from pointing to nothing to pointing to an enemy, it moves slightly down. It seems this is caused by the reticle scaling down, which also affects the value of its position in the y axis.

In CombatMode.lua, the following function

`local function SetCrosshairAppearance(state)
local CrosshairAppearance = CM.DB.global.crosshairAppearance

-- Sets new scale at the end of animation
CrosshairAnimation:SetScript("OnFinished", function()
if state == "hostile" or state == "friendly" then
CrosshairFrame:SetScale(endingScale)
end
end)

if state == "hostile" then
CrosshairTexture:SetTexture(CrosshairAppearance.Active)
CrosshairTexture:SetVertexColor(1, .2, 0.3, 1)
CrosshairAnimation:Play()
elseif state == "friendly" then
CrosshairTexture:SetTexture(CrosshairAppearance.Active)
CrosshairTexture:SetVertexColor(0, 1, 0.3, .8)
CrosshairAnimation:Play()
else -- "base" falls here
CrosshairTexture:SetTexture(CrosshairAppearance.Base)
CrosshairTexture:SetVertexColor(1, 1, 1, .5)
CrosshairAnimation:Play(true) -- reverse
CrosshairFrame:SetScale(startingScale)
end
end`

should be changed by this one (do CrosshairFrame:SetPoint after CrosshairFrame:SetScale, either when going for the endingScale or the startingScale)

`local function SetCrosshairAppearance(state)
local CrosshairAppearance = CM.DB.global.crosshairAppearance

-- Sets new scale at the end of animation
CrosshairAnimation:SetScript("OnFinished", function()
if state == "hostile" or state == "friendly" then
CrosshairFrame:SetScale(endingScale)
CrosshairFrame:SetPoint("CENTER", 0, (CM.DB.global.crosshairY or 100)/endingScale)
end
end)

if state == "hostile" then
CrosshairTexture:SetTexture(CrosshairAppearance.Active)
CrosshairTexture:SetVertexColor(1, .2, 0.3, 1)
CrosshairAnimation:Play()
elseif state == "friendly" then
CrosshairTexture:SetTexture(CrosshairAppearance.Active)
CrosshairTexture:SetVertexColor(0, 1, 0.3, .8)
CrosshairAnimation:Play()
else -- "base" falls here
CrosshairTexture:SetTexture(CrosshairAppearance.Base)
CrosshairTexture:SetVertexColor(1, 1, 1, .5)
CrosshairAnimation:Play(true) -- reverse
CrosshairFrame:SetScale(startingScale)
CrosshairFrame:SetPoint("CENTER", 0, CM.DB.global.crosshairY or 100)
end
end`

I have tested this with the latest version (2.0.9)

commented

Thank you, @julen3.