Skip to content

Commit

Permalink
Fix updating of slottexture attributes after scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
RagedUnicorn committed Dec 20, 2019
1 parent e1a976c commit c223e4c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gui/GM_ChangeMenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ function me.UpdateChangeMenu(gearSlot)
end

local changeMenuSlot = changeMenuSlots[index]
mod.uiHelper.PrepareSlotTexture(changeMenuSlot)
mod.uiHelper.UpdateSlotTextureAttributes(changeMenuSlot)

-- update metadata for slot
changeMenuSlot.slotId = gearSlotMetaData.slotId
Expand Down
3 changes: 2 additions & 1 deletion gui/GM_GearBar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function me.CreateGearSlot(gearBarFrame, position)
gearSlot.position = position

mod.uiHelper.CreateHighlightFrame(gearSlot)
mod.uiHelper.PrepareSlotTexture(gearSlot)
mod.uiHelper.UpdateSlotTextureAttributes(gearSlot)
mod.uiHelper.CreateCooldownOverlay(
gearSlot,
RGGM_CONSTANTS.ELEMENT_GEAR_BAR_SLOT_COOLDOWN_FRAME,
Expand Down Expand Up @@ -288,6 +288,7 @@ function me.UpdateGearBar()
gearSlot:SetAttribute("type1", "item")
gearSlot:SetAttribute("item", gearSlotMetaData.slotId)
me.UpdateTexture(gearSlot, gearSlotMetaData)
mod.uiHelper.UpdateSlotTextureAttributes(gearSlot)
slotCount = slotCount + 1
gearSlot:Show()
else
Expand Down
9 changes: 6 additions & 3 deletions gui/GM_UiHelper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ me.tag = "UiHelper"
@param {table} slot
]]--
function me.PrepareSlotTexture(slot)
-- set a dummy texture - otherwise GetNormalTexture will return nil
slot:SetNormalTexture("//dummy")
function me.UpdateSlotTextureAttributes(slot)
if slot:GetNormalTexture() == nil then
-- set a dummy texture - otherwise GetNormalTexture will return nil
slot:SetNormalTexture("//dummy")
end

local texture = slot:GetNormalTexture()
texture:SetTexCoord(0.1, 0.9, 0.1, 0.9)
texture:SetPoint(
Expand Down

0 comments on commit c223e4c

Please sign in to comment.