PeaAshMeter d4e351b080 Introduce Rect class and UIElement base class for layout
Refactor skill button and row to use UIElement with Rect bounds and
transform Update layout references and coordinate calculations
accordingly
2025-11-04 06:59:03 +03:00

25 lines
547 B
Lua

--- @class Rect
--- @field x number
--- @field y number
--- @field width number
--- @field height number
local rect = {}
rect.__index = rect
--- @param table {x: number, y: number, width: number, height: number}
function rect.new(table)
local r = {
x = table.x or 0,
y = table.y or 0,
width = table.width or 0,
height = table.height or 0
}
return setmetatable(r, rect)
end
function rect:hasPoint(x, y)
return x >= self.x and x < self.width and y >= self.y and y < self.height
end
return rect.new