Focus fix for list
This commit is contained in:
@@ -147,8 +147,8 @@ function List:mouse_click(button, x, y)
|
||||
self:fireEvent("mouse_click", button, x, y)
|
||||
self:fireEvent("select", adjustedIndex, item)
|
||||
self:updateRender()
|
||||
return true
|
||||
end
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
42
src/elements/Switch.lua
Normal file
42
src/elements/Switch.lua
Normal file
@@ -0,0 +1,42 @@
|
||||
local elementManager = require("elementManager")
|
||||
local VisualElement = elementManager.getElement("VisualElement")
|
||||
---@cofnigDescription The Switch is a standard Switch element with click handling and state management.
|
||||
|
||||
--- The Switch is a standard Switch element with click handling and state management.
|
||||
---@class Switch : VisualElement
|
||||
local Switch = setmetatable({}, VisualElement)
|
||||
Switch.__index = Switch
|
||||
|
||||
---@property checked boolean Whether switch is checked
|
||||
Switch.defineProperty(Switch, "checked", {default = false, type = "boolean", canTriggerRender = true})
|
||||
|
||||
Switch.defineEvent(Switch, "mouse_click")
|
||||
Switch.defineEvent(Switch, "mouse_up")
|
||||
|
||||
--- @shortDescription Creates a new Switch instance
|
||||
--- @return table self The created instance
|
||||
--- @private
|
||||
function Switch.new()
|
||||
local self = setmetatable({}, Switch):__init()
|
||||
self.set("width", 2)
|
||||
self.set("height", 1)
|
||||
self.set("z", 5)
|
||||
return self
|
||||
end
|
||||
|
||||
--- @shortDescription Initializes the Switch instance
|
||||
--- @param props table The properties to initialize the element with
|
||||
--- @param basalt table The basalt instance
|
||||
--- @protected
|
||||
function Switch:init(props, basalt)
|
||||
VisualElement.init(self, props, basalt)
|
||||
self.set("type", "Switch")
|
||||
end
|
||||
|
||||
--- @shortDescription Renders the Switch
|
||||
--- @protected
|
||||
function Switch:render()
|
||||
VisualElement.render(self)
|
||||
end
|
||||
|
||||
return Switch
|
||||
Reference in New Issue
Block a user