Finished installer

Small bugfixes
This commit is contained in:
Robert Jelic
2025-02-23 11:11:36 +01:00
parent 8e2580c4f6
commit 96ff3ddedb
7 changed files with 402 additions and 110 deletions

View File

@@ -102,6 +102,7 @@ end
--- @param child table The child to check
--- @return boolean boolean the child is visible
function Container:isChildVisible(child)
if(child.get("visible") == false)then return false end
local containerW, containerH = self.get("width"), self.get("height")
local offsetX, offsetY = self.get("offsetX"), self.get("offsetY")
@@ -585,6 +586,7 @@ function Container:destroy()
child:destroy()
end
VisualElement.destroy(self)
return self
end
return Container

View File

@@ -106,7 +106,7 @@ function Dropdown:render()
if #text == 0 then
local selectedItems = self:getSelectedItems()
if #selectedItems > 0 then
local selectedItem = selectedItems[1].item
local selectedItem = selectedItems[1]
text = selectedItem.text or ""
end
end

View File

@@ -92,7 +92,9 @@ function List:getSelectedItems()
local selected = {}
for i, item in ipairs(self.get("items")) do
if type(item) == "table" and item.selected then
table.insert(selected, {index = i, item = item})
local selectedItem = item
selectedItem.index = i
table.insert(selected, selectedItem)
end
end
return selected
@@ -211,21 +213,21 @@ function List:render()
local bg = item.background or self.get("background")
self:textBg(1, i, string.rep(" ", width), bg)
self:textFg(1, i, separatorText, fg)
self:textFg(1, i, separatorText:sub(1, width), fg)
else
local text = item.text
local isSelected = item.selected
local bg = isSelected and
local bg = isSelected and
(item.selectedBackground or self.get("selectedBackground")) or
(item.background or self.get("background"))
local fg = isSelected and
local fg = isSelected and
(item.selectedForeground or self.get("selectedForeground")) or
(item.foreground or self.get("foreground"))
self:textBg(1, i, string.rep(" ", width), bg)
self:textFg(1, i, text, fg)
self:textFg(1, i, text:sub(1, width), fg)
end
end
end

View File

@@ -107,7 +107,6 @@ function Menu:mouse_click(button, x, y)
self.get("items")[i] = item
end
-- Wenn kein Multi-Selection, alle anderen deselektieren
if not self.get("multiSelection") then
for _, otherItem in ipairs(self.get("items")) do
if type(otherItem) == "table" then
@@ -116,7 +115,6 @@ function Menu:mouse_click(button, x, y)
end
end
-- Toggle Selection
item.selected = not item.selected
if item.callback then

View File

@@ -63,6 +63,9 @@ VisualElement.defineProperty(VisualElement, "visible", {default = true, type = "
self.parent.set("childrenSorted", false)
self.parent.set("childrenEventsSorted", false)
end
if(value==false)then
self.set("clicked", false)
end
return value
end})

View File

@@ -169,18 +169,17 @@ local function updateEvent(event, ...)
if lazyElementsEventHandler(event, ...) then return end
if(mainFrame)then
if(mainFrame:dispatchEvent(event, ...))then
return
end
mainFrame:dispatchEvent(event, ...)
end
for _, func in ipairs(basalt._schedule) do
if(event==func.filter)then
for k, func in ipairs(basalt._schedule) do
if(event==func.filter)or(func.filter==nil)then
local ok, result = coroutine.resume(func.coroutine, event, ...)
if(not ok)then
errorManager.header = "Basalt Schedule Error"
errorManager.error(result)
end
func.filter = result
end
if(coroutine.status(func.coroutine)=="dead")then
basalt.removeSchedule(func.coroutine)
@@ -213,9 +212,9 @@ end
--- @shortDescription Stops the Basalt runtime
--- @usage basalt.stop()
function basalt.stop()
updaterActive = false
term.clear()
term.setCursorPos(1,1)
updaterActive = false
end
--- Starts the Basalt runtime
@@ -230,7 +229,9 @@ function basalt.run(isActive)
renderFrames()
while updaterActive do
updateEvent(os.pullEventRaw())
renderFrames()
if(updaterActive)then
renderFrames()
end
end
end
while updaterActive do