This commit is contained in:
2025-05-04 21:38:01 +02:00
parent c8f9d81b3e
commit f05156b257
2 changed files with 19 additions and 3 deletions

2
Meta

Submodule Meta updated: ba3bf263d6...e5f4ad0cbc

View File

@@ -141,6 +141,7 @@ GridFrame = {
if bestColumn then
frame:SetParent(self.frame)
---@diagnostic disable-next-line: inject-field
frame.gridData = {
row = bestRow,
column = bestColumn,
@@ -148,6 +149,7 @@ GridFrame = {
rowspan = rowspan,
parent = self,
}
---@diagnostic disable-next-line: inject-field, redefined-local
frame.SetPos = function(self)
if not self.gridData then return end
local parent = self.gridData.parent
@@ -176,24 +178,36 @@ GridFrame = {
end
end
end,
---@param self GridFrame
---@param width number
SetWidth = function(self, width)
self.frame:SetWidth(width)
self.cellWidth = width / self.columns
self:Recalculate()
end,
---@param self GridFrame
---@param height number
SetHeight = function(self, height)
self.frame:SetHeight(height)
local tallestRow = 0
for _, height in pairs(self.columnHeights) do
tallestRow = math.max(tallestRow, height)
for _, columnHeight in pairs(self.columnHeights) do
tallestRow = math.max(tallestRow, columnHeight)
end
if tallestRow > 0 then self.cellHeight = height / tallestRow end
self:Recalculate()
end,
---@param self GridFrame
---@param point string
---@param relativeTo Frame
---@param relativePoint string
---@param offsetX number
---@param offsetY number
SetPoint = function(self, point, relativeTo, relativePoint, offsetX, offsetY)
self.frame:SetPoint(point, relativeTo, relativePoint, offsetX, offsetY)
self:Recalculate()
end,
---@param self GridFrame
---@param parent Frame
SetParent = function(self, parent)
self.frame:SetParent(parent)
self:Recalculate()
@@ -274,7 +288,9 @@ StaticGridFrame = {
if canPlace then
local x = (col - 1) * self.cellWidth
local y = -(row - 1) * self.cellHeight
---@diagnostic disable-next-line: inject-field
frame.colspan = colspan
---@diagnostic disable-next-line: inject-field
frame.rowspan = rowspan
frame:SetWidth(self.cellWidth * colspan)
frame:SetHeight(self.cellHeight * rowspan)