feat: bagline shorten
This commit is contained in:
@@ -43,11 +43,15 @@ function DB:Initialize()
|
||||
showQualityBorderOther = true,
|
||||
showSearchBar = true,
|
||||
showQuestBar = true,
|
||||
hoverBagline = false,
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
-- Ensure new settings exist for existing installations
|
||||
if Guda_CharDB.settings.hoverBagline == nil then
|
||||
Guda_CharDB.settings.hoverBagline = false
|
||||
end
|
||||
if Guda_CharDB.settings.showQuestBar == nil then
|
||||
Guda_CharDB.settings.showQuestBar = true
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
## Title: Guda
|
||||
## Notes: All-in-one bag and bank addon for Turtle WoW
|
||||
## Author: Vati
|
||||
## Version: 1.1.9
|
||||
## Version: 1.2.0
|
||||
## SavedVariables: Guda_DB
|
||||
## SavedVariablesPerCharacter: Guda_CharDB
|
||||
|
||||
|
||||
+138
@@ -150,6 +150,104 @@ function BagFrame:UpdateLockStates()
|
||||
end
|
||||
end
|
||||
|
||||
-- Update bagline layout (hover option)
|
||||
function BagFrame:UpdateBaglineLayout()
|
||||
local hoverBagline = addon.Modules.DB:GetSetting("hoverBagline")
|
||||
local toolbar = getglobal("Guda_BagFrame_Toolbar")
|
||||
if not toolbar then return end
|
||||
|
||||
local bag0 = getglobal("Guda_BagFrame_Toolbar_BagSlot0")
|
||||
local bag1 = getglobal("Guda_BagFrame_Toolbar_BagSlot1")
|
||||
local bag2 = getglobal("Guda_BagFrame_Toolbar_BagSlot2")
|
||||
local bag3 = getglobal("Guda_BagFrame_Toolbar_BagSlot3")
|
||||
local bag4 = getglobal("Guda_BagFrame_Toolbar_BagSlot4")
|
||||
local keyring = getglobal("Guda_BagFrame_Toolbar_KeyringButton")
|
||||
local info = getglobal("Guda_BagFrame_Toolbar_BagSlotsInfo")
|
||||
|
||||
if hoverBagline then
|
||||
-- Hide extra bags by default if not hovering
|
||||
if not toolbar.isHovered then
|
||||
if bag1 then bag1:Hide() end
|
||||
if bag2 then bag2:Hide() end
|
||||
if bag3 then bag3:Hide() end
|
||||
if bag4 then bag4:Hide() end
|
||||
end
|
||||
|
||||
-- Re-anchor Keyring to BagSlot0
|
||||
if keyring and bag0 then
|
||||
keyring:ClearAllPoints()
|
||||
keyring:SetPoint("LEFT", bag0, "RIGHT", 2, 0)
|
||||
end
|
||||
|
||||
-- Keep info visible and anchor it to Keyring
|
||||
if info then
|
||||
info:Show()
|
||||
info:ClearAllPoints()
|
||||
info:SetPoint("LEFT", keyring, "RIGHT", 8, 0)
|
||||
end
|
||||
|
||||
-- If hovered, show and position vertically above Bag0
|
||||
if toolbar.isHovered then
|
||||
if bag1 then
|
||||
bag1:Show()
|
||||
bag1:SetFrameLevel(bag0:GetFrameLevel() + 10)
|
||||
bag1:ClearAllPoints()
|
||||
bag1:SetPoint("BOTTOM", bag0, "TOP", 0, 2)
|
||||
end
|
||||
if bag2 then
|
||||
bag2:Show()
|
||||
bag2:SetFrameLevel(bag0:GetFrameLevel() + 10)
|
||||
bag2:ClearAllPoints()
|
||||
bag2:SetPoint("BOTTOM", bag1, "TOP", 0, 2)
|
||||
end
|
||||
if bag3 then
|
||||
bag3:Show()
|
||||
bag3:SetFrameLevel(bag0:GetFrameLevel() + 10)
|
||||
bag3:ClearAllPoints()
|
||||
bag3:SetPoint("BOTTOM", bag2, "TOP", 0, 2)
|
||||
end
|
||||
if bag4 then
|
||||
bag4:Show()
|
||||
bag4:SetFrameLevel(bag0:GetFrameLevel() + 10)
|
||||
bag4:ClearAllPoints()
|
||||
bag4:SetPoint("BOTTOM", bag3, "TOP", 0, 2)
|
||||
end
|
||||
end
|
||||
else
|
||||
-- Restore standard horizontal layout
|
||||
if bag1 then
|
||||
bag1:Show()
|
||||
bag1:ClearAllPoints()
|
||||
bag1:SetPoint("LEFT", bag0, "RIGHT", 2, 0)
|
||||
end
|
||||
if bag2 then
|
||||
bag2:Show()
|
||||
bag2:ClearAllPoints()
|
||||
bag2:SetPoint("LEFT", bag1, "RIGHT", 2, 0)
|
||||
end
|
||||
if bag3 then
|
||||
bag3:Show()
|
||||
bag3:ClearAllPoints()
|
||||
bag3:SetPoint("LEFT", bag2, "RIGHT", 2, 0)
|
||||
end
|
||||
if bag4 then
|
||||
bag4:Show()
|
||||
bag4:ClearAllPoints()
|
||||
bag4:SetPoint("LEFT", bag3, "RIGHT", 2, 0)
|
||||
end
|
||||
if keyring then
|
||||
keyring:Show()
|
||||
keyring:ClearAllPoints()
|
||||
keyring:SetPoint("LEFT", bag4, "RIGHT", 2, 0)
|
||||
end
|
||||
if info then
|
||||
info:Show()
|
||||
info:ClearAllPoints()
|
||||
info:SetPoint("LEFT", keyring, "RIGHT", 8, 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Update display
|
||||
function BagFrame:Update()
|
||||
if not Guda_BagFrame:IsShown() then
|
||||
@@ -212,6 +310,9 @@ function BagFrame:Update()
|
||||
-- Update bag slots info
|
||||
self:UpdateBagSlotsInfo(bagData, isOtherChar)
|
||||
|
||||
-- Update bagline layout (hover option)
|
||||
self:UpdateBaglineLayout()
|
||||
|
||||
-- Clean up unused buttons AFTER display is complete (prevents drag/drop issues)
|
||||
for _, bagParent in pairs(bagParents) do
|
||||
if bagParent then
|
||||
@@ -1719,6 +1820,17 @@ end
|
||||
|
||||
-- OnEnter handler for tooltip
|
||||
function Guda_BagSlot_OnEnter(button, bagID)
|
||||
-- Handle hover bagline
|
||||
local hoverBagline = addon.Modules.DB:GetSetting("hoverBagline")
|
||||
if hoverBagline then
|
||||
local toolbar = getglobal("Guda_BagFrame_Toolbar")
|
||||
if toolbar then
|
||||
toolbar.isHovered = true
|
||||
toolbar.hoverTimer = nil -- Cancel any pending hide
|
||||
BagFrame:UpdateBaglineLayout()
|
||||
end
|
||||
end
|
||||
|
||||
GameTooltip:SetOwner(button, "ANCHOR_TOP")
|
||||
|
||||
if bagID == 0 then
|
||||
@@ -1759,6 +1871,32 @@ function Guda_BagSlot_OnEnter(button, bagID)
|
||||
GameTooltip:Show()
|
||||
end
|
||||
|
||||
-- OnLeave handler for tooltip
|
||||
function Guda_BagSlot_OnLeave(button, bagID)
|
||||
-- Handle hover bagline
|
||||
local hoverBagline = addon.Modules.DB:GetSetting("hoverBagline")
|
||||
if hoverBagline then
|
||||
local toolbar = getglobal("Guda_BagFrame_Toolbar")
|
||||
if toolbar then
|
||||
-- Start a small timer to hide, so we can move mouse between bags
|
||||
toolbar.hoverTimer = 0.1
|
||||
if not toolbar.hasOnUpdate then
|
||||
toolbar:SetScript("OnUpdate", function()
|
||||
if this.hoverTimer then
|
||||
this.hoverTimer = this.hoverTimer - arg1
|
||||
if this.hoverTimer <= 0 then
|
||||
this.hoverTimer = nil
|
||||
this.isHovered = false
|
||||
BagFrame:UpdateBaglineLayout()
|
||||
end
|
||||
end
|
||||
end)
|
||||
toolbar.hasOnUpdate = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Highlight all item slots belonging to a specific bag by dimming others
|
||||
function Guda_BagFrame_HighlightBagSlots(bagID)
|
||||
-- Use the tracked itemButtons list because actual buttons are parented under per-bag parents
|
||||
|
||||
@@ -298,6 +298,7 @@
|
||||
<OnLeave>
|
||||
GameTooltip:Hide()
|
||||
Guda_BagFrame_ClearHighlightedSlots()
|
||||
Guda_BagSlot_OnLeave(this, 0)
|
||||
</OnLeave>
|
||||
<OnEvent>
|
||||
Guda_BagSlot_OnEvent(this, event, arg1)
|
||||
@@ -338,6 +339,7 @@
|
||||
<OnLeave>
|
||||
GameTooltip:Hide()
|
||||
Guda_BagFrame_ClearHighlightedSlots()
|
||||
Guda_BagSlot_OnLeave(this, 1)
|
||||
</OnLeave>
|
||||
<OnEvent>
|
||||
Guda_BagSlot_OnEvent(this, event, arg1)
|
||||
@@ -378,6 +380,7 @@
|
||||
<OnLeave>
|
||||
GameTooltip:Hide()
|
||||
Guda_BagFrame_ClearHighlightedSlots()
|
||||
Guda_BagSlot_OnLeave(this, 2)
|
||||
</OnLeave>
|
||||
<OnEvent>
|
||||
Guda_BagSlot_OnEvent(this, event, arg1)
|
||||
@@ -418,6 +421,7 @@
|
||||
<OnLeave>
|
||||
GameTooltip:Hide()
|
||||
Guda_BagFrame_ClearHighlightedSlots()
|
||||
Guda_BagSlot_OnLeave(this, 3)
|
||||
</OnLeave>
|
||||
<OnEvent>
|
||||
Guda_BagSlot_OnEvent(this, event, arg1)
|
||||
@@ -458,6 +462,7 @@
|
||||
<OnLeave>
|
||||
GameTooltip:Hide()
|
||||
Guda_BagFrame_ClearHighlightedSlots()
|
||||
Guda_BagSlot_OnLeave(this, 4)
|
||||
</OnLeave>
|
||||
<OnEvent>
|
||||
Guda_BagSlot_OnEvent(this, event, arg1)
|
||||
@@ -507,10 +512,12 @@
|
||||
GameTooltip:AddLine("(Click to toggle)", 0.5, 0.8, 0.5)
|
||||
GameTooltip:Show()
|
||||
Guda_BagFrame_HighlightBagSlots(-2)
|
||||
Guda_BagSlot_OnEnter(this, -2)
|
||||
</OnEnter>
|
||||
<OnLeave>
|
||||
GameTooltip:Hide()
|
||||
Guda_BagFrame_ClearHighlightedSlots()
|
||||
Guda_BagSlot_OnLeave(this, -2)
|
||||
</OnLeave>
|
||||
</Scripts>
|
||||
</Button>
|
||||
|
||||
+47
-3
@@ -153,6 +153,36 @@ function QuestItemBar:Update()
|
||||
button.bagID = item.bagID
|
||||
button.slotID = item.slotID
|
||||
button.itemData = { link = GetContainerItemLink(item.bagID, item.slotID) }
|
||||
|
||||
button.hasItem = true
|
||||
button.isBank = false
|
||||
button.otherChar = nil
|
||||
|
||||
-- Custom click handler for Quest Item Bar
|
||||
button:SetScript("OnClick", function()
|
||||
if arg1 == "LeftButton" then
|
||||
if IsShiftKeyDown() then
|
||||
local link = GetContainerItemLink(this.bagID, this.slotID)
|
||||
if link then
|
||||
HandleModifiedItemClick(link)
|
||||
end
|
||||
else
|
||||
UseContainerItem(this.bagID, this.slotID)
|
||||
end
|
||||
elseif arg1 == "RightButton" then
|
||||
-- Right click also uses it or maybe open socketing?
|
||||
-- UseContainerItem handles both depending on context usually.
|
||||
UseContainerItem(this.bagID, this.slotID)
|
||||
end
|
||||
end)
|
||||
|
||||
button:SetScript("OnEnter", function()
|
||||
Guda_ItemButton_OnEnter(this)
|
||||
end)
|
||||
|
||||
button:SetScript("OnLeave", function()
|
||||
Guda_ItemButton_OnLeave(this)
|
||||
end)
|
||||
|
||||
local icon = getglobal(button:GetName() .. "IconTexture")
|
||||
icon:SetTexture(item.texture)
|
||||
@@ -168,9 +198,11 @@ function QuestItemBar:Update()
|
||||
button:ClearAllPoints()
|
||||
button:SetPoint("LEFT", frame, "LEFT", xOffset + (i-1) * (buttonSize + spacing), 0)
|
||||
button:Show()
|
||||
|
||||
-- Set custom data for tooltip handling
|
||||
button.hasItem = true
|
||||
|
||||
-- Update visual overlays (cooldown, etc)
|
||||
if Guda_ItemButton_UpdateCooldown then
|
||||
Guda_ItemButton_UpdateCooldown(button)
|
||||
end
|
||||
|
||||
-- Allow dragging the bar via buttons
|
||||
button:RegisterForDrag("LeftButton")
|
||||
@@ -196,6 +228,14 @@ function QuestItemBar:Update()
|
||||
frame:SetWidth(math.max(newWidth, 40))
|
||||
end
|
||||
|
||||
function QuestItemBar:UpdateCooldowns()
|
||||
for _, button in ipairs(buttons) do
|
||||
if button:IsShown() and Guda_ItemButton_UpdateCooldown then
|
||||
Guda_ItemButton_UpdateCooldown(button)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function QuestItemBar:Initialize()
|
||||
local frame = CreateFrame("Frame", "Guda_QuestItemBar", UIParent)
|
||||
frame:SetWidth(40)
|
||||
@@ -229,6 +269,10 @@ function QuestItemBar:Initialize()
|
||||
addon.Modules.Events:Register("BAG_UPDATE", function()
|
||||
QuestItemBar:Update()
|
||||
end, "QuestItemBar")
|
||||
|
||||
addon.Modules.Events:Register("BAG_UPDATE_COOLDOWN", function()
|
||||
QuestItemBar:UpdateCooldowns()
|
||||
end, "QuestItemBar")
|
||||
|
||||
addon.Modules.Events:Register("PLAYER_ENTERING_WORLD", function()
|
||||
QuestItemBar:Update()
|
||||
|
||||
@@ -58,6 +58,10 @@ function Guda_SettingsPopup_OnShow(self)
|
||||
if showQuestBar == nil then
|
||||
showQuestBar = true
|
||||
end
|
||||
local hoverBagline = Guda.Modules.DB:GetSetting("hoverBagline")
|
||||
if hoverBagline == nil then
|
||||
hoverBagline = false
|
||||
end
|
||||
|
||||
-- Update sliders and checkboxes
|
||||
local bagSlider = getglobal("Guda_SettingsPopup_BagColumnsSlider")
|
||||
@@ -71,6 +75,7 @@ function Guda_SettingsPopup_OnShow(self)
|
||||
local qualityBorderOtherCheckbox = getglobal("Guda_SettingsPopup_QualityBorderOtherCheckbox")
|
||||
local showSearchBarCheckbox = getglobal("Guda_SettingsPopup_ShowSearchBarCheckbox")
|
||||
local showQuestBarCheckbox = getglobal("Guda_SettingsPopup_ShowQuestBarCheckbox")
|
||||
local hoverBaglineCheckbox = getglobal("Guda_SettingsPopup_HoverBaglineCheckbox")
|
||||
|
||||
if bagSlider then
|
||||
bagSlider:SetValue(bagColumns)
|
||||
@@ -115,6 +120,16 @@ function Guda_SettingsPopup_OnShow(self)
|
||||
if showQuestBarCheckbox then
|
||||
showQuestBarCheckbox:SetChecked(showQuestBar and 1 or 0)
|
||||
end
|
||||
|
||||
if hoverBaglineCheckbox then
|
||||
hoverBaglineCheckbox:SetChecked(hoverBagline and 1 or 0)
|
||||
end
|
||||
|
||||
-- Update display (might be too tall for current frame size)
|
||||
local frame = getglobal("Guda_SettingsPopup")
|
||||
if frame then
|
||||
frame:SetHeight(560)
|
||||
end
|
||||
end
|
||||
|
||||
-- Toggle visibility
|
||||
@@ -603,6 +618,46 @@ function Guda_SettingsPopup_ShowQuestBarCheckbox_OnClick(self)
|
||||
end
|
||||
end
|
||||
|
||||
-- Hover Bagline Checkbox OnLoad
|
||||
function Guda_SettingsPopup_HoverBaglineCheckbox_OnLoad(self)
|
||||
local text = getglobal(self:GetName().."Text")
|
||||
if text then
|
||||
text:SetText("Hover Bagline")
|
||||
|
||||
-- Increase font size
|
||||
local font, _, flags = text:GetFont()
|
||||
if font then
|
||||
text:SetFont(font, 13, flags)
|
||||
end
|
||||
end
|
||||
|
||||
local hoverBagline = false
|
||||
if Guda and Guda.Modules and Guda.Modules.DB then
|
||||
hoverBagline = Guda.Modules.DB:GetSetting("hoverBagline")
|
||||
if hoverBagline == nil then
|
||||
hoverBagline = false
|
||||
end
|
||||
end
|
||||
|
||||
self:SetChecked(hoverBagline and 1 or 0)
|
||||
end
|
||||
|
||||
-- Hover Bagline Checkbox OnClick
|
||||
function Guda_SettingsPopup_HoverBaglineCheckbox_OnClick(self)
|
||||
local isChecked = self:GetChecked() == 1
|
||||
|
||||
-- Save setting
|
||||
if Guda and Guda.Modules and Guda.Modules.DB then
|
||||
Guda.Modules.DB:SetSetting("hoverBagline", isChecked)
|
||||
end
|
||||
|
||||
-- Update bag frame
|
||||
local bagFrame = getglobal("Guda_BagFrame")
|
||||
if bagFrame and bagFrame:IsShown() then
|
||||
Guda.Modules.BagFrame:Update()
|
||||
end
|
||||
end
|
||||
|
||||
-- Initialize
|
||||
function SettingsPopup:Initialize()
|
||||
Guda:Debug("Settings popup initialized")
|
||||
|
||||
@@ -283,6 +283,25 @@
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</CheckButton>
|
||||
|
||||
<!-- Hover Bagline Checkbox -->
|
||||
<CheckButton name="$parent_HoverBaglineCheckbox" inherits="OptionsCheckButtonTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOP" relativePoint="BOTTOM" relativeTo="$parent_ShowSearchBarCheckbox">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="-8"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
Guda_SettingsPopup_HoverBaglineCheckbox_OnLoad(this)
|
||||
</OnLoad>
|
||||
<OnClick>
|
||||
Guda_SettingsPopup_HoverBaglineCheckbox_OnClick(this)
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</CheckButton>
|
||||
</Frames>
|
||||
|
||||
<Scripts>
|
||||
|
||||
Reference in New Issue
Block a user