Merge branch 'main' of https://github.com/Pyroxenium/Basalt2
This commit is contained in:
@@ -1,9 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
## [v0.0.1](https://github.com/Pyroxenium/Basalt2/tree/v0.0.1) (2025-02-10)
|
||||
|
||||
[Full Changelog](https://github.com/Pyroxenium/Basalt2/compare/b058811bd052a89d616035f40721cd8100a766f8...v0.0.1)
|
||||
|
||||
|
||||
|
||||
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
||||
|
||||
517
config.lua
517
config.lua
@@ -1,320 +1,351 @@
|
||||
return {
|
||||
["metadata"] = {
|
||||
["version"] = "2.0",
|
||||
["generated"] = "Fri Feb 21 18:26:34 2025",
|
||||
["generated"] = "Sat Feb 22 10:26:48 2025",
|
||||
},
|
||||
["categories"] = {
|
||||
["libraries"] = {
|
||||
["description"] = "Libraries",
|
||||
["files"] = {
|
||||
["utils"] = {
|
||||
["description"] = "",
|
||||
["requires"] = {
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "libraries/utils.lua",
|
||||
},
|
||||
["colorHex"] = {
|
||||
["description"] = "",
|
||||
["requires"] = {
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "libraries/colorHex.lua",
|
||||
},
|
||||
["expect"] = {
|
||||
["description"] = "",
|
||||
["requires"] = {
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "libraries/expect.lua",
|
||||
},
|
||||
},
|
||||
},
|
||||
["core"] = {
|
||||
["description"] = "Core Files",
|
||||
["files"] = {
|
||||
["init"] = {
|
||||
["log"] = {
|
||||
["description"] = "",
|
||||
["size"] = 3140,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "init.lua",
|
||||
},
|
||||
["render"] = {
|
||||
["description"] = "",
|
||||
["requires"] = {
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "render.lua",
|
||||
["path"] = "log.lua",
|
||||
},
|
||||
["elementManager"] = {
|
||||
["description"] = "",
|
||||
["size"] = 6290,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "elementManager.lua",
|
||||
},
|
||||
["main"] = {
|
||||
["description"] = "",
|
||||
["requires"] = {
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "main.lua",
|
||||
},
|
||||
["errorManager"] = {
|
||||
["description"] = "",
|
||||
["size"] = 3789,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "errorManager.lua",
|
||||
},
|
||||
["log"] = {
|
||||
["init"] = {
|
||||
["description"] = "",
|
||||
["size"] = 519,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "log.lua",
|
||||
["path"] = "init.lua",
|
||||
},
|
||||
["LuaLS"] = {
|
||||
["main"] = {
|
||||
["description"] = "",
|
||||
["size"] = 7781,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
},
|
||||
["path"] = "main.lua",
|
||||
},
|
||||
["render"] = {
|
||||
["description"] = "",
|
||||
["size"] = 10919,
|
||||
["default"] = true,
|
||||
["path"] = "LuaLS.lua",
|
||||
["requires"] = {
|
||||
},
|
||||
["path"] = "render.lua",
|
||||
},
|
||||
["propertySystem"] = {
|
||||
["description"] = "",
|
||||
["size"] = 15220,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "propertySystem.lua",
|
||||
},
|
||||
},
|
||||
},
|
||||
["plugins"] = {
|
||||
["description"] = "Plugins",
|
||||
["files"] = {
|
||||
["state"] = {
|
||||
["description"] = "",
|
||||
["requires"] = {
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "plugins/state.lua",
|
||||
},
|
||||
["theme"] = {
|
||||
["description"] = "",
|
||||
["requires"] = {
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "plugins/theme.lua",
|
||||
},
|
||||
["animation"] = {
|
||||
["description"] = "",
|
||||
["requires"] = {
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "plugins/animation.lua",
|
||||
},
|
||||
["reactive"] = {
|
||||
["description"] = "",
|
||||
["requires"] = {
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "plugins/reactive.lua",
|
||||
},
|
||||
["benchmark"] = {
|
||||
["description"] = "",
|
||||
["requires"] = {
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "plugins/benchmark.lua",
|
||||
},
|
||||
["xml"] = {
|
||||
["description"] = "",
|
||||
["requires"] = {
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "plugins/xml.lua",
|
||||
},
|
||||
["debug"] = {
|
||||
["description"] = "",
|
||||
["requires"] = {
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "plugins/debug.lua",
|
||||
},
|
||||
["pluginTemplate"] = {
|
||||
["description"] = "",
|
||||
["requires"] = {
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "plugins/pluginTemplate.lua",
|
||||
},
|
||||
},
|
||||
["description"] = "Core Files",
|
||||
},
|
||||
["elements"] = {
|
||||
["description"] = "UI Elements",
|
||||
["files"] = {
|
||||
["Frame"] = {
|
||||
["description"] = "",
|
||||
["requires"] = {
|
||||
[1] = "Container",
|
||||
},
|
||||
["Container"] = {
|
||||
["description"] = "The container class. It is a visual element that can contain other elements. It is the base class for all containers",
|
||||
["size"] = 21693,
|
||||
["default"] = true,
|
||||
["path"] = "elements/Frame.lua",
|
||||
},
|
||||
["Input"] = {
|
||||
["description"] = "A text input field with various features",
|
||||
["requires"] = {
|
||||
[1] = "VisualElement",
|
||||
},
|
||||
["path"] = "elements/Container.lua",
|
||||
},
|
||||
["Label"] = {
|
||||
["description"] = "",
|
||||
["size"] = 2848,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
[1] = "VisualElement",
|
||||
},
|
||||
["path"] = "elements/Label.lua",
|
||||
},
|
||||
["Button"] = {
|
||||
["description"] = "Standard button element with click handling and state management",
|
||||
["size"] = 1837,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
[1] = "VisualElement",
|
||||
},
|
||||
["path"] = "elements/Button.lua",
|
||||
},
|
||||
["Checkbox"] = {
|
||||
["description"] = "",
|
||||
["size"] = 2874,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
[1] = "VisualElement",
|
||||
},
|
||||
["path"] = "elements/Checkbox.lua",
|
||||
},
|
||||
["Table"] = {
|
||||
["description"] = "",
|
||||
["size"] = 8475,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
[1] = "VisualElement",
|
||||
},
|
||||
["path"] = "elements/Table.lua",
|
||||
},
|
||||
["BaseElement"] = {
|
||||
["description"] = "The base class for all UI elements in Basalt",
|
||||
["size"] = 8969,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
},
|
||||
["path"] = "elements/BaseElement.lua",
|
||||
},
|
||||
["Slider"] = {
|
||||
["description"] = "",
|
||||
["size"] = 4465,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
[1] = "VisualElement",
|
||||
},
|
||||
["path"] = "elements/Slider.lua",
|
||||
},
|
||||
["ProgressBar"] = {
|
||||
["description"] = "",
|
||||
["size"] = 2348,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
[1] = "VisualElement",
|
||||
},
|
||||
["path"] = "elements/ProgressBar.lua",
|
||||
},
|
||||
["Scrollbar"] = {
|
||||
["description"] = "",
|
||||
["size"] = 7793,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
[1] = "VisualElement",
|
||||
},
|
||||
["path"] = "elements/Scrollbar.lua",
|
||||
},
|
||||
["Program"] = {
|
||||
["description"] = "",
|
||||
["size"] = 5589,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
[1] = "VisualElement",
|
||||
},
|
||||
["path"] = "elements/Program.lua",
|
||||
},
|
||||
["Input"] = {
|
||||
["description"] = "A text input field with various features",
|
||||
["size"] = 7180,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
[1] = "VisualElement",
|
||||
},
|
||||
["path"] = "elements/Input.lua",
|
||||
},
|
||||
["Menu"] = {
|
||||
["description"] = "A horizontal menu bar with selectable",
|
||||
["BaseFrame"] = {
|
||||
["description"] = "This is the base frame class. It is the root element of all elements and the only element without a parent.",
|
||||
["size"] = 5188,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
[1] = "Container",
|
||||
},
|
||||
["path"] = "elements/BaseFrame.lua",
|
||||
},
|
||||
["Frame"] = {
|
||||
["description"] = "",
|
||||
["size"] = 1053,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
[1] = "Container",
|
||||
},
|
||||
["path"] = "elements/Frame.lua",
|
||||
},
|
||||
["Dropdown"] = {
|
||||
["description"] = "A dropdown menu that shows a list of selectable items",
|
||||
["size"] = 5981,
|
||||
["default"] = false,
|
||||
["requires"] = {
|
||||
[1] = "List",
|
||||
},
|
||||
["path"] = "elements/Dropdown.lua",
|
||||
},
|
||||
["VisualElement"] = {
|
||||
["description"] = "The Visual Element class which is the base class for all visual UI elements",
|
||||
["size"] = 14388,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
[1] = "BaseElement",
|
||||
},
|
||||
["path"] = "elements/VisualElement.lua",
|
||||
},
|
||||
["List"] = {
|
||||
["description"] = "A scrollable list of selectable items",
|
||||
["size"] = 8326,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
[1] = "VisualElement",
|
||||
},
|
||||
["path"] = "elements/List.lua",
|
||||
},
|
||||
["TextBox"] = {
|
||||
["description"] = "A multi-line text editor component with cursor support and text manipulation features",
|
||||
["size"] = 8976,
|
||||
["default"] = false,
|
||||
["requires"] = {
|
||||
[1] = "VisualElement",
|
||||
},
|
||||
["path"] = "elements/TextBox.lua",
|
||||
},
|
||||
["Flexbox"] = {
|
||||
["description"] = "",
|
||||
["size"] = 10132,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
[1] = "Container",
|
||||
},
|
||||
["path"] = "elements/Flexbox.lua",
|
||||
},
|
||||
["Menu"] = {
|
||||
["description"] = "A horizontal menu bar with selectable",
|
||||
["size"] = 4823,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
[1] = "List",
|
||||
},
|
||||
["path"] = "elements/Menu.lua",
|
||||
},
|
||||
["Tree"] = {
|
||||
["description"] = "",
|
||||
["size"] = 7284,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
[1] = "VisualElement",
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "elements/Tree.lua",
|
||||
},
|
||||
["Container"] = {
|
||||
["description"] = "The container class. It is a visual element that can contain other elements. It is the base class for all containers",
|
||||
["requires"] = {
|
||||
[1] = "VisualElement",
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "elements/Container.lua",
|
||||
},
|
||||
["Checkbox"] = {
|
||||
},
|
||||
["description"] = "UI Elements",
|
||||
},
|
||||
["libraries"] = {
|
||||
["files"] = {
|
||||
["colorHex"] = {
|
||||
["description"] = "",
|
||||
["requires"] = {
|
||||
[1] = "VisualElement",
|
||||
},
|
||||
["size"] = 132,
|
||||
["default"] = true,
|
||||
["path"] = "elements/Checkbox.lua",
|
||||
["requires"] = {
|
||||
},
|
||||
["path"] = "libraries/colorHex.lua",
|
||||
},
|
||||
["Program"] = {
|
||||
["utils"] = {
|
||||
["description"] = "",
|
||||
["requires"] = {
|
||||
[1] = "VisualElement",
|
||||
},
|
||||
["size"] = 2661,
|
||||
["default"] = true,
|
||||
["path"] = "elements/Program.lua",
|
||||
["requires"] = {
|
||||
},
|
||||
["path"] = "libraries/utils.lua",
|
||||
},
|
||||
["Flexbox"] = {
|
||||
["expect"] = {
|
||||
["description"] = "",
|
||||
["requires"] = {
|
||||
[1] = "Container",
|
||||
},
|
||||
["size"] = 880,
|
||||
["default"] = true,
|
||||
["path"] = "elements/Flexbox.lua",
|
||||
},
|
||||
["BaseFrame"] = {
|
||||
["description"] = "This is the base frame class. It is the root element of all elements and the only element without a parent.",
|
||||
["requires"] = {
|
||||
[1] = "Container",
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "elements/BaseFrame.lua",
|
||||
},
|
||||
["List"] = {
|
||||
["description"] = "A scrollable list of selectable items",
|
||||
["requires"] = {
|
||||
[1] = "VisualElement",
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "elements/List.lua",
|
||||
},
|
||||
["Label"] = {
|
||||
["description"] = "",
|
||||
["requires"] = {
|
||||
[1] = "VisualElement",
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "elements/Label.lua",
|
||||
},
|
||||
["BaseElement"] = {
|
||||
["description"] = "The base class for all UI elements in Basalt",
|
||||
["requires"] = {
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "elements/BaseElement.lua",
|
||||
},
|
||||
["Dropdown"] = {
|
||||
["description"] = "A dropdown menu that shows a list of selectable items",
|
||||
["requires"] = {
|
||||
[1] = "List",
|
||||
},
|
||||
["default"] = false,
|
||||
["path"] = "elements/Dropdown.lua",
|
||||
},
|
||||
["Scrollbar"] = {
|
||||
["description"] = "",
|
||||
["requires"] = {
|
||||
[1] = "VisualElement",
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "elements/Scrollbar.lua",
|
||||
},
|
||||
["TextBox"] = {
|
||||
["description"] = "A multi-line text editor component with cursor support and text manipulation features",
|
||||
["requires"] = {
|
||||
[1] = "VisualElement",
|
||||
},
|
||||
["default"] = false,
|
||||
["path"] = "elements/TextBox.lua",
|
||||
},
|
||||
["Table"] = {
|
||||
["description"] = "",
|
||||
["requires"] = {
|
||||
[1] = "VisualElement",
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "elements/Table.lua",
|
||||
},
|
||||
["Slider"] = {
|
||||
["description"] = "",
|
||||
["requires"] = {
|
||||
[1] = "VisualElement",
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "elements/Slider.lua",
|
||||
},
|
||||
["VisualElement"] = {
|
||||
["description"] = "The Visual Element class which is the base class for all visual UI elements",
|
||||
["requires"] = {
|
||||
[1] = "BaseElement",
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "elements/VisualElement.lua",
|
||||
},
|
||||
["Button"] = {
|
||||
["description"] = "Standard button element with click handling and state management",
|
||||
["requires"] = {
|
||||
[1] = "VisualElement",
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "elements/Button.lua",
|
||||
},
|
||||
["ProgressBar"] = {
|
||||
["description"] = "",
|
||||
["requires"] = {
|
||||
[1] = "VisualElement",
|
||||
},
|
||||
["default"] = true,
|
||||
["path"] = "elements/ProgressBar.lua",
|
||||
["path"] = "libraries/expect.lua",
|
||||
},
|
||||
},
|
||||
["description"] = "Libraries",
|
||||
},
|
||||
["plugins"] = {
|
||||
["files"] = {
|
||||
["state"] = {
|
||||
["description"] = "",
|
||||
["size"] = 5867,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
},
|
||||
["path"] = "plugins/state.lua",
|
||||
},
|
||||
["debug"] = {
|
||||
["description"] = "",
|
||||
["size"] = 6175,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
},
|
||||
["path"] = "plugins/debug.lua",
|
||||
},
|
||||
["reactive"] = {
|
||||
["description"] = "",
|
||||
["size"] = 6989,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
},
|
||||
["path"] = "plugins/reactive.lua",
|
||||
},
|
||||
["pluginTemplate"] = {
|
||||
["description"] = "",
|
||||
["size"] = 695,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
},
|
||||
["path"] = "plugins/pluginTemplate.lua",
|
||||
},
|
||||
["theme"] = {
|
||||
["description"] = "",
|
||||
["size"] = 5879,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
},
|
||||
["path"] = "plugins/theme.lua",
|
||||
},
|
||||
["xml"] = {
|
||||
["description"] = "",
|
||||
["size"] = 6371,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
},
|
||||
["path"] = "plugins/xml.lua",
|
||||
},
|
||||
["benchmark"] = {
|
||||
["description"] = "",
|
||||
["size"] = 12515,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
},
|
||||
["path"] = "plugins/benchmark.lua",
|
||||
},
|
||||
["animation"] = {
|
||||
["description"] = "",
|
||||
["size"] = 14116,
|
||||
["default"] = true,
|
||||
["requires"] = {
|
||||
},
|
||||
["path"] = "plugins/animation.lua",
|
||||
},
|
||||
},
|
||||
["description"] = "Plugins",
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -838,14 +838,15 @@ project["elements/ProgressBar.lua"] = function(...) local c=require("elements/Vi
|
||||
local d=setmetatable({},c)d.__index=d
|
||||
d.defineProperty(d,"progress",{default=0,type="number",canTriggerRender=true})
|
||||
d.defineProperty(d,"showPercentage",{default=false,type="boolean"})
|
||||
d.defineProperty(d,"progressColor",{default=colors.lime,type="number"})
|
||||
d.defineProperty(d,"progressColor",{default=colors.black,type="number"})
|
||||
function d.new()local _a=setmetatable({},d):__init()
|
||||
_a.set("width",10)_a.set("height",1)return _a end
|
||||
function d:init(_a,aa)c.init(self,_a,aa)self.set("type","ProgressBar")end
|
||||
function d:render()c.render(self)local _a=self.get("width")
|
||||
local aa=math.min(100,math.max(0,self.get("progress")))local ba=math.floor((_a*aa)/100)
|
||||
self:textBg(1,1,string.rep(" ",ba),self.get("progressColor"))if self.get("showPercentage")then local ca=tostring(aa).."%"local da=math.floor(
|
||||
(_a-#ca)/2)+1
|
||||
local aa=math.min(100,math.max(0,self.get("progress")))local ba=math.floor((_a*aa)/100)for i=1,self.get("height")do
|
||||
self:textBg(1,i,string.rep(" ",ba),self.get("progressColor"))end;if self.get("showPercentage")then local ca=
|
||||
tostring(aa).."%"
|
||||
local da=math.floor((_a-#ca)/2)+1
|
||||
self:textFg(da,1,ca,self.get("foreground"))end end;return d end
|
||||
project["elements/Menu.lua"] = function(...) local _a=require("elements/VisualElement")
|
||||
local aa=require("elements/List")local ba=require("libraries/colorHex")
|
||||
@@ -1578,15 +1579,17 @@ local da=math.max(0,#
|
||||
self.get("items")-self.get("height"))ca=math.min(da,math.max(0,ca+_a))
|
||||
self.set("offset",ca)return true end;return false end
|
||||
function d:onSelect(_a)self:registerCallback("select",_a)return self end
|
||||
function d:render()c.render(self)local _a=self.get("items")
|
||||
local aa=self.get("height")local ba=self.get("offset")local ca=self.get("width")
|
||||
for i=1,aa do local da=i+ba
|
||||
local _b=_a[da]
|
||||
if _b then if type(_b)=="string"then _b={text=_b}_a[da]=_b end
|
||||
if
|
||||
_b.separator then local ab=(_b.text or"-"):sub(1,1)
|
||||
local bb=string.rep(ab,ca)local cb=_b.foreground or self.get("foreground")local db=
|
||||
_b.background or self.get("background")
|
||||
function d:scrollToBottom()
|
||||
local _a=math.max(0,#self.get("items")-self.get("height"))self.set("offset",_a)return self end;function d:scrollToTop()self.set("offset",0)return self end
|
||||
function d:render()
|
||||
c.render(self)local _a=self.get("items")local aa=self.get("height")
|
||||
local ba=self.get("offset")local ca=self.get("width")
|
||||
for i=1,aa do local da=i+ba;local _b=_a[da]
|
||||
if _b then if
|
||||
type(_b)=="string"then _b={text=_b}_a[da]=_b end
|
||||
if _b.separator then
|
||||
local ab=(_b.text or"-"):sub(1,1)local bb=string.rep(ab,ca)
|
||||
local cb=_b.foreground or self.get("foreground")local db=_b.background or self.get("background")
|
||||
self:textBg(1,i,string.rep(" ",ca),db)self:textFg(1,i,bb,cb)else local ab=_b.text;local bb=_b.selected
|
||||
local cb=bb and(_b.selectedBackground or
|
||||
self.get("selectedBackground"))or(_b.background or
|
||||
@@ -1752,8 +1755,15 @@ if cb==1 then
|
||||
self.set("isOpen",not self.get("isOpen"))if not self.get("isOpen")then self.set("height",1)else
|
||||
self.set("height",1 +math.min(self.get("dropdownHeight"),
|
||||
#self.get("items")))end
|
||||
return true elseif self.get("isOpen")and cb>1 then
|
||||
aa.mouse_click(self,da,_b,ab)self.set("isOpen",false)self.set("height",1)return true end;return false end
|
||||
return true elseif
|
||||
self.get("isOpen")and cb>1 and self.get("selectable")then local db=(cb-1)+self.get("offset")
|
||||
local _c=self.get("items")
|
||||
if db<=#_c then local ac=_c[db]
|
||||
if type(ac)=="string"then ac={text=ac}_c[db]=ac end
|
||||
if not self.get("multiSelection")then for bc,cc in ipairs(_c)do if type(cc)=="table"then
|
||||
cc.selected=false end end end;ac.selected=not ac.selected
|
||||
if ac.callback then ac.callback(self)end;self:fireEvent("select",db,ac)
|
||||
self.set("isOpen",false)self.set("height",1)self:updateRender()return true end end;return false end
|
||||
function ca:render()_a.render(self)local da=self.get("selectedText")
|
||||
if
|
||||
#da==0 then local _b=self:getSelectedItems()if#_b>0 then local ab=_b[1].item
|
||||
@@ -1761,8 +1771,23 @@ da=ab.text or""end end
|
||||
self:blit(1,1,da..
|
||||
|
||||
string.rep(" ",self.get("width")-#da-1).. (self.get("isOpen")and"\31"or"\17"),string.rep(ba[self.get("foreground")],self.get("width")),string.rep(ba[self.get("background")],self.get("width")))
|
||||
if self.get("isOpen")then local _b=self.get("offset")
|
||||
self.set("offset",_b+1)aa.render(self)self.set("offset",_b)end end;return ca end
|
||||
if self.get("isOpen")then local _b=self.get("items")
|
||||
local ab=self.get("height")-1;local bb=self.get("offset")local cb=self.get("width")
|
||||
for i=1,ab do local db=i+bb
|
||||
local _c=_b[db]
|
||||
if _c then if type(_c)=="string"then _c={text=_c}_b[db]=_c end
|
||||
if
|
||||
_c.separator then local ac=(_c.text or"-"):sub(1,1)
|
||||
local bc=string.rep(ac,cb)local cc=_c.foreground or self.get("foreground")local dc=
|
||||
_c.background or self.get("background")self:textBg(1,
|
||||
i+1,string.rep(" ",cb),dc)
|
||||
self:textFg(1,i+1,bc,cc)else local ac=_c.text;local bc=_c.selected
|
||||
local cc=bc and
|
||||
(_c.selectedBackground or self.get("selectedBackground"))or
|
||||
(_c.background or self.get("background"))
|
||||
local dc=
|
||||
bc and(_c.selectedForeground or self.get("selectedForeground"))or(_c.foreground or self.get("foreground"))self:textBg(1,i+1,string.rep(" ",cb),cc)self:textFg(1,
|
||||
i+1,ac,dc)end end end end end;return ca end
|
||||
project["render.lua"] = function(...) local _a=require("libraries/colorHex")local aa=require("log")
|
||||
local ba={}ba.__index=ba;local ca=string.sub
|
||||
function ba.new(da)local _b=setmetatable({},ba)
|
||||
|
||||
Reference in New Issue
Block a user