fix: scaling border

This commit is contained in:
Salikh Gurgenidze
2026-01-05 12:37:26 +04:00
parent 0494a5cde8
commit e36ca87d53
5 changed files with 215 additions and 9 deletions
+57 -5
View File
@@ -172,9 +172,12 @@ function QuestItemBar:Update()
frame:Show()
local pinnedItems = addon.Modules.DB:GetSetting("questBarPinnedItems") or {}
local buttonSize = 37
local buttonSize = addon.Modules.DB:GetSetting("questBarSize") or 36
local spacing = 2
local xOffset = 5
-- Update frame height based on button size
frame:SetHeight(buttonSize + 8)
-- Used to keep track of which bag items are already displayed
local usedBagSlots = {}
@@ -358,13 +361,37 @@ function QuestItemBar:Update()
button:ClearAllPoints()
button:SetPoint("LEFT", frame, "LEFT", xOffset + (i-1) * (buttonSize + spacing), 0)
button:SetWidth(buttonSize)
button:SetHeight(buttonSize)
-- Resize all button textures to match button size
local icon = getglobal(button:GetName() .. "IconTexture")
if icon then
icon:SetWidth(buttonSize)
icon:SetHeight(buttonSize)
end
-- Scale border proportionally (64/37 is the standard ratio for WoW item buttons)
local borderSize = buttonSize * 64 / 37
local normalTex = getglobal(button:GetName() .. "NormalTexture")
if normalTex then
normalTex:SetWidth(borderSize)
normalTex:SetHeight(borderSize)
end
-- Resize empty slot background
local emptyBg = getglobal(button:GetName() .. "_EmptySlotBg")
if emptyBg then
emptyBg:SetWidth(buttonSize)
emptyBg:SetHeight(buttonSize)
end
-- Update visual overlays (cooldown, etc)
if Guda_ItemButton_UpdateCooldown then
Guda_ItemButton_UpdateCooldown(button)
end
end
-- Hide any extra buttons beyond current slots
for j = slots + 1, table.getn(buttons) do
local extra = buttons[j]
@@ -451,8 +478,8 @@ end
function QuestItemBar:UpdateFlyout(parent)
if not flyoutFrame then return end
flyoutFrame.parent = parent
local buttonSize = 37
local buttonSize = addon.Modules.DB:GetSetting("questBarSize") or 36
local spacing = 2
-- Collect items not in main buttons
@@ -573,8 +600,33 @@ function QuestItemBar:UpdateFlyout(parent)
btn:ClearAllPoints()
btn:SetPoint("BOTTOM", flyoutFrame, "BOTTOM", 0, (i-1) * (buttonSize + spacing) + 5)
btn:SetWidth(buttonSize)
btn:SetHeight(buttonSize)
-- Resize all button textures to match button size
local btnIcon = getglobal(btn:GetName() .. "IconTexture")
if btnIcon then
btnIcon:SetWidth(buttonSize)
btnIcon:SetHeight(buttonSize)
end
-- Scale border proportionally (64/37 is the standard ratio for WoW item buttons)
local borderSize = buttonSize * 64 / 37
local btnNormalTex = getglobal(btn:GetName() .. "NormalTexture")
if btnNormalTex then
btnNormalTex:SetWidth(borderSize)
btnNormalTex:SetHeight(borderSize)
end
-- Resize empty slot background
local btnEmptyBg = getglobal(btn:GetName() .. "_EmptySlotBg")
if btnEmptyBg then
btnEmptyBg:SetWidth(buttonSize)
btnEmptyBg:SetHeight(buttonSize)
end
btn:Show()
if Guda_ItemButton_UpdateCooldown then
Guda_ItemButton_UpdateCooldown(btn)
end
+82
View File
@@ -122,6 +122,8 @@ function Guda_SettingsPopup_OnShow(self)
local bgTransparency = Guda.Modules.DB:GetSetting("bgTransparency") or 0.15
local bagViewType = Guda.Modules.DB:GetSetting("bagViewType") or "single"
local bankViewType = Guda.Modules.DB:GetSetting("bankViewType") or "single"
local questBarSize = Guda.Modules.DB:GetSetting("questBarSize") or 36
local trackedBarSize = Guda.Modules.DB:GetSetting("trackedBarSize") or 36
-- Update sliders and checkboxes
local bagSlider = getglobal("Guda_SettingsPopup_BagColumnsSlider")
@@ -130,6 +132,8 @@ function Guda_SettingsPopup_OnShow(self)
local iconFontSizeSlider = getglobal("Guda_SettingsPopup_IconFontSizeSlider")
local iconSpacingSlider = getglobal("Guda_SettingsPopup_IconSpacingSlider")
local bgTransparencySlider = getglobal("Guda_SettingsPopup_BgTransparencySlider")
local questBarSizeSlider = getglobal("Guda_SettingsPopup_QuestBarSizeSlider")
local trackedBarSizeSlider = getglobal("Guda_SettingsPopup_TrackedBarSizeSlider")
local lockCheckbox = getglobal("Guda_SettingsPopup_LockBagsCheckbox")
local hideBordersCheckbox = getglobal("Guda_SettingsPopup_HideBordersCheckbox")
local qualityBorderEquipmentCheckbox = getglobal("Guda_SettingsPopup_QualityBorderEquipmentCheckbox")
@@ -171,6 +175,14 @@ function Guda_SettingsPopup_OnShow(self)
bgTransparencySlider:SetValue(bgTransparency)
end
if questBarSizeSlider then
questBarSizeSlider:SetValue(questBarSize)
end
if trackedBarSizeSlider then
trackedBarSizeSlider:SetValue(trackedBarSize)
end
if lockCheckbox then
lockCheckbox:SetChecked(lockBags and 1 or 0)
end
@@ -514,6 +526,76 @@ function Guda_SettingsPopup_IconSpacingSlider_OnValueChanged(self)
end
end
-- Quest Bar Size Slider OnLoad
function Guda_SettingsPopup_QuestBarSizeSlider_OnLoad(self)
getglobal(self:GetName().."Low"):SetText("22px")
getglobal(self:GetName().."High"):SetText("64px")
local text = getglobal(self:GetName().."Text")
text:SetText("Quest bar size")
-- Increase font size
local font, _, flags = text:GetFont()
if font then
text:SetFont(font, 12, flags)
end
self:SetMinMaxValues(22, 64)
self:SetValueStep(1)
local currentValue = Guda.Modules.DB:GetSetting("questBarSize") or 36
self:SetValue(currentValue)
end
-- Quest Bar Size Slider OnValueChanged
function Guda_SettingsPopup_QuestBarSizeSlider_OnValueChanged(self)
local value = math.floor(self:GetValue() + 0.5)
getglobal(self:GetName().."Text"):SetText("Quest bar size: " .. value .. "px")
Guda.Modules.DB:SetSetting("questBarSize", value)
-- Update quest item bar
if Guda.Modules.QuestItemBar and Guda.Modules.QuestItemBar.Update then
Guda.Modules.QuestItemBar:Update()
end
end
-- Tracked Bar Size Slider OnLoad
function Guda_SettingsPopup_TrackedBarSizeSlider_OnLoad(self)
getglobal(self:GetName().."Low"):SetText("22px")
getglobal(self:GetName().."High"):SetText("64px")
local text = getglobal(self:GetName().."Text")
text:SetText("Tracked bar size")
-- Increase font size
local font, _, flags = text:GetFont()
if font then
text:SetFont(font, 12, flags)
end
self:SetMinMaxValues(22, 64)
self:SetValueStep(1)
local currentValue = Guda.Modules.DB:GetSetting("trackedBarSize") or 36
self:SetValue(currentValue)
end
-- Tracked Bar Size Slider OnValueChanged
function Guda_SettingsPopup_TrackedBarSizeSlider_OnValueChanged(self)
local value = math.floor(self:GetValue() + 0.5)
getglobal(self:GetName().."Text"):SetText("Tracked bar size: " .. value .. "px")
Guda.Modules.DB:SetSetting("trackedBarSize", value)
-- Update tracked item bar
if Guda.Modules.TrackedItemBar and Guda.Modules.TrackedItemBar.Update then
Guda.Modules.TrackedItemBar:Update()
end
end
-- Lock Bags Checkbox OnLoad
function Guda_SettingsPopup_LockBagsCheckbox_OnLoad(self)
local text = getglobal(self:GetName().."Text")
+45 -1
View File
@@ -478,10 +478,54 @@
</Scripts>
</Slider>
<!-- Quest Item Bar Size Slider -->
<Slider name="Guda_SettingsPopup_QuestBarSizeSlider" inherits="OptionsSliderTemplate">
<Size>
<AbsDimension x="450" y="17"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="Guda_SettingsPopup_IconSpacingSlider">
<Offset>
<AbsDimension x="0" y="-40"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
Guda_SettingsPopup_QuestBarSizeSlider_OnLoad(this)
</OnLoad>
<OnValueChanged>
Guda_SettingsPopup_QuestBarSizeSlider_OnValueChanged(this)
</OnValueChanged>
</Scripts>
</Slider>
<!-- Tracked Item Bar Size Slider -->
<Slider name="Guda_SettingsPopup_TrackedBarSizeSlider" inherits="OptionsSliderTemplate">
<Size>
<AbsDimension x="450" y="17"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="Guda_SettingsPopup_QuestBarSizeSlider">
<Offset>
<AbsDimension x="0" y="-40"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
Guda_SettingsPopup_TrackedBarSizeSlider_OnLoad(this)
</OnLoad>
<OnValueChanged>
Guda_SettingsPopup_TrackedBarSizeSlider_OnValueChanged(this)
</OnValueChanged>
</Scripts>
</Slider>
<!-- Quality Border Equipment Checkbox -->
<CheckButton name="Guda_SettingsPopup_QualityBorderEquipmentCheckbox" inherits="OptionsCheckButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="Guda_SettingsPopup_IconSpacingSlider">
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="Guda_SettingsPopup_TrackedBarSizeSlider">
<Offset>
<AbsDimension x="0" y="-30"/>
</Offset>
+31 -3
View File
@@ -74,10 +74,13 @@ function TrackedItemBar:Update()
frame:Show()
self:ScanForTrackedItems()
local buttonSize = 37
local buttonSize = addon.Modules.DB:GetSetting("trackedBarSize") or 36
local spacing = 2
local xOffset = 5
-- Update frame height based on button size
frame:SetHeight(buttonSize + 8)
-- Hide all buttons initially
for _, btn in ipairs(buttons) do
@@ -162,9 +165,34 @@ function TrackedItemBar:Update()
button:ClearAllPoints()
button:SetPoint("LEFT", frame, "LEFT", xOffset + (i-1) * (buttonSize + spacing), 0)
button:SetWidth(buttonSize)
button:SetHeight(buttonSize)
-- Resize all button textures to match button size
local icon = getglobal(button:GetName() .. "IconTexture")
if icon then
icon:SetWidth(buttonSize)
icon:SetHeight(buttonSize)
end
-- Scale border proportionally (64/37 is the standard ratio for WoW item buttons)
local borderSize = buttonSize * 64 / 37
local normalTex = getglobal(button:GetName() .. "NormalTexture")
if normalTex then
normalTex:SetWidth(borderSize)
normalTex:SetHeight(borderSize)
end
-- Resize empty slot background
local emptyBg = getglobal(button:GetName() .. "_EmptySlotBg")
if emptyBg then
emptyBg:SetWidth(buttonSize)
emptyBg:SetHeight(buttonSize)
end
button:Show()
end
local numItems = table.getn(trackedItemsInfo)
if numItems > 0 then
local newWidth = xOffset * 2 + numItems * (buttonSize + spacing) - spacing
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB