Skip to content

Commit

Permalink
added resize handle for bag windows (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cidan committed Nov 30, 2023
1 parent 7bd1c05 commit 85824a7
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
2 changes: 2 additions & 0 deletions BetterBags.toc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ theme\masque.lua

data\items.lua

util\resize.lua

frames\money.lua
frames\context.lua
frames\column.lua
Expand Down
5 changes: 4 additions & 1 deletion frames/bag.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ local money = addon:GetModule('MoneyFrame')
---@class Views: AceModule
local views = addon:GetModule('Views')

---@class Resize: AceModule
local resize = addon:GetModule('Resize')

---@class Debug: AceModule
local debug = addon:GetModule('Debug')

Expand Down Expand Up @@ -412,7 +415,7 @@ function bagFrame:Create(kind)
b:ToggleReagentBank()
end
end)

resize:MakeResizable(b.frame)
return b
end

Expand Down
30 changes: 30 additions & 0 deletions util/resize.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
local addonName = ... ---@type string

---@class BetterBags: AceAddon
local addon = LibStub('AceAddon-3.0'):GetAddon(addonName)

---@class Resize: AceModule
local resize = addon:NewModule('Resize')

---@param frame Frame
function resize:MakeResizable(frame)
frame:SetResizable(true)
frame:SetResizeBounds(300, 300)
local resizeHandle = CreateFrame("Button", nil, frame)
resizeHandle:EnableMouse(true)
resizeHandle:SetPoint("BOTTOMRIGHT")
resizeHandle:SetSize(16, 16)
resizeHandle:SetNormalTexture("Interface\\ChatFrame\\UI-ChatIM-SizeGrabber-Down")
resizeHandle:SetHighlightTexture("Interface\\ChatFrame\\UI-ChatIM-SizeGrabber-Highlight")
resizeHandle:SetPushedTexture("Interface\\ChatFrame\\UI-ChatIM-SizeGrabber-Up")
resizeHandle:SetScript("OnMouseDown", function(p)
p:GetParent():StartSizing("BOTTOMRIGHT")
end)
resizeHandle:SetScript("OnMouseUp", function(p)
p:GetParent():StopMovingOrSizing("BOTTOMRIGHT")
end)
end

function resize:HideResize(frame)

end

0 comments on commit 85824a7

Please sign in to comment.