Updated color properties
Small container fix
This commit is contained in:
@@ -278,6 +278,8 @@ function Container:unregisterChildEvent(child, eventName)
|
|||||||
self.parent:unregisterChildEvent(self, eventName)
|
self.parent:unregisterChildEvent(self, eventName)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
self.set("childrenEventsSorted", false)
|
||||||
|
self:updateRender()
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -298,6 +300,8 @@ function Container:removeChild(child)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
self:removeChildrenEvents(child)
|
self:removeChildrenEvents(child)
|
||||||
|
self:updateRender()
|
||||||
|
self.set("childrenSorted", false)
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ Image.__index = Image
|
|||||||
Image.defineProperty(Image, "bimg", {default = {{}}, type = "table", canTriggerRender = true})
|
Image.defineProperty(Image, "bimg", {default = {{}}, type = "table", canTriggerRender = true})
|
||||||
---@property currentFrame number 1 Current animation frame
|
---@property currentFrame number 1 Current animation frame
|
||||||
Image.defineProperty(Image, "currentFrame", {default = 1, type = "number", canTriggerRender = true})
|
Image.defineProperty(Image, "currentFrame", {default = 1, type = "number", canTriggerRender = true})
|
||||||
---@property metadata table {} Image metadata (version, palette, etc)
|
|
||||||
Image.defineProperty(Image, "metadata", {default = {}, type = "table"})
|
|
||||||
---@property autoResize boolean false Whether to automatically resize the image when content exceeds bounds
|
---@property autoResize boolean false Whether to automatically resize the image when content exceeds bounds
|
||||||
Image.defineProperty(Image, "autoResize", {default = false, type = "boolean"})
|
Image.defineProperty(Image, "autoResize", {default = false, type = "boolean"})
|
||||||
---@property offsetX number 0 Horizontal offset for viewing larger images
|
---@property offsetX number 0 Horizontal offset for viewing larger images
|
||||||
@@ -51,35 +49,6 @@ function Image:init(props, basalt)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Loads a bimg format image
|
|
||||||
--- @shortDescription Loads a bimg format image
|
|
||||||
--- @param bimgData table The bimg image data
|
|
||||||
--- @return Image self The Image instance
|
|
||||||
function Image:loadBimg(bimgData)
|
|
||||||
if type(bimgData) ~= "table" then return self end
|
|
||||||
|
|
||||||
local frames = {}
|
|
||||||
local metadata = {}
|
|
||||||
|
|
||||||
for k, v in pairs(bimgData) do
|
|
||||||
if type(k) == "number" then
|
|
||||||
frames[k] = v
|
|
||||||
else
|
|
||||||
metadata[k] = v
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
self.set("bimg", frames)
|
|
||||||
self.set("metadata", metadata)
|
|
||||||
|
|
||||||
if frames[1] and frames[1][1] then
|
|
||||||
self.set("width", #frames[1][1][2])
|
|
||||||
self.set("height", #frames[1])
|
|
||||||
end
|
|
||||||
|
|
||||||
return self
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Resizes the image to the specified width and height
|
--- Resizes the image to the specified width and height
|
||||||
--- @shortDescription Resizes the image to the specified width and height
|
--- @shortDescription Resizes the image to the specified width and height
|
||||||
--- @param width number The new width of the image
|
--- @param width number The new width of the image
|
||||||
@@ -197,6 +166,10 @@ end
|
|||||||
--- @return Image self The Image instance
|
--- @return Image self The Image instance
|
||||||
function Image:setText(x, y, text)
|
function Image:setText(x, y, text)
|
||||||
if type(text) ~= "string" or #text < 1 or x < 1 or y < 1 then return self end
|
if type(text) ~= "string" or #text < 1 or x < 1 or y < 1 then return self end
|
||||||
|
if not self.get("autoResize")then
|
||||||
|
local imgWidth, imgHeight = self:getImageSize()
|
||||||
|
if y > imgHeight then return self end
|
||||||
|
end
|
||||||
local frame = ensureFrame(self, y)
|
local frame = ensureFrame(self, y)
|
||||||
|
|
||||||
if self.get("autoResize") then
|
if self.get("autoResize") then
|
||||||
@@ -214,6 +187,21 @@ function Image:setText(x, y, text)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Image:getText(x, y, length)
|
||||||
|
if not x or not y then return end
|
||||||
|
local frame = self.get("bimg")[self.get("currentFrame")]
|
||||||
|
if not frame or not frame[y] then return end
|
||||||
|
|
||||||
|
local text = frame[y][1]
|
||||||
|
if not text then return end
|
||||||
|
|
||||||
|
if length then
|
||||||
|
return text:sub(x, x + length - 1)
|
||||||
|
else
|
||||||
|
return text:sub(x, x)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--- Sets the foreground color at the specified position
|
--- Sets the foreground color at the specified position
|
||||||
--- @shortDescription Sets the foreground color at the specified position
|
--- @shortDescription Sets the foreground color at the specified position
|
||||||
--- @param x number The x position
|
--- @param x number The x position
|
||||||
@@ -222,6 +210,10 @@ end
|
|||||||
--- @return Image self The Image instance
|
--- @return Image self The Image instance
|
||||||
function Image:setFg(x, y, pattern)
|
function Image:setFg(x, y, pattern)
|
||||||
if type(pattern) ~= "string" or #pattern < 1 or x < 1 or y < 1 then return self end
|
if type(pattern) ~= "string" or #pattern < 1 or x < 1 or y < 1 then return self end
|
||||||
|
if not self.get("autoResize")then
|
||||||
|
local imgWidth, imgHeight = self:getImageSize()
|
||||||
|
if y > imgHeight then return self end
|
||||||
|
end
|
||||||
local frame = ensureFrame(self, y)
|
local frame = ensureFrame(self, y)
|
||||||
|
|
||||||
if self.get("autoResize") then
|
if self.get("autoResize") then
|
||||||
@@ -239,6 +231,21 @@ function Image:setFg(x, y, pattern)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Image:getFg(x, y, length)
|
||||||
|
if not x or not y then return end
|
||||||
|
local frame = self.get("bimg")[self.get("currentFrame")]
|
||||||
|
if not frame or not frame[y] then return end
|
||||||
|
|
||||||
|
local fg = frame[y][2]
|
||||||
|
if not fg then return end
|
||||||
|
|
||||||
|
if length then
|
||||||
|
return fg:sub(x, x + length - 1)
|
||||||
|
else
|
||||||
|
return fg:sub(x)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--- Sets the background color at the specified position
|
--- Sets the background color at the specified position
|
||||||
--- @shortDescription Sets the background color at the specified position
|
--- @shortDescription Sets the background color at the specified position
|
||||||
--- @param x number The x position
|
--- @param x number The x position
|
||||||
@@ -247,6 +254,10 @@ end
|
|||||||
--- @return Image self The Image instance
|
--- @return Image self The Image instance
|
||||||
function Image:setBg(x, y, pattern)
|
function Image:setBg(x, y, pattern)
|
||||||
if type(pattern) ~= "string" or #pattern < 1 or x < 1 or y < 1 then return self end
|
if type(pattern) ~= "string" or #pattern < 1 or x < 1 or y < 1 then return self end
|
||||||
|
if not self.get("autoResize")then
|
||||||
|
local imgWidth, imgHeight = self:getImageSize()
|
||||||
|
if y > imgHeight then return self end
|
||||||
|
end
|
||||||
local frame = ensureFrame(self, y)
|
local frame = ensureFrame(self, y)
|
||||||
|
|
||||||
if self.get("autoResize") then
|
if self.get("autoResize") then
|
||||||
@@ -264,6 +275,21 @@ function Image:setBg(x, y, pattern)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Image:getBg(x, y, length)
|
||||||
|
if not x or not y then return end
|
||||||
|
local frame = self.get("bimg")[self.get("currentFrame")]
|
||||||
|
if not frame or not frame[y] then return end
|
||||||
|
|
||||||
|
local bg = frame[y][3]
|
||||||
|
if not bg then return end
|
||||||
|
|
||||||
|
if length then
|
||||||
|
return bg:sub(x, x + length - 1)
|
||||||
|
else
|
||||||
|
return bg:sub(x)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--- Sets the pixel at the specified position
|
--- Sets the pixel at the specified position
|
||||||
--- @shortDescription Sets the pixel at the specified position
|
--- @shortDescription Sets the pixel at the specified position
|
||||||
--- @param x number The x position
|
--- @param x number The x position
|
||||||
@@ -283,7 +309,7 @@ end
|
|||||||
--- @shortDescription Advances to the next frame in the animation
|
--- @shortDescription Advances to the next frame in the animation
|
||||||
--- @return Image self The Image instance
|
--- @return Image self The Image instance
|
||||||
function Image:nextFrame()
|
function Image:nextFrame()
|
||||||
if not self.get("metadata").animation then return self end
|
if not self.get("bimg").animation then return self end
|
||||||
|
|
||||||
local frames = self.get("bimg")
|
local frames = self.get("bimg")
|
||||||
local current = self.get("currentFrame")
|
local current = self.get("currentFrame")
|
||||||
@@ -310,6 +336,43 @@ function Image:addFrame()
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Image:updateFrame(frameIndex, frame)
|
||||||
|
local frames = self.get("bimg")
|
||||||
|
frames[frameIndex] = frame
|
||||||
|
self:updateRender()
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
function Image:getFrame(frameIndex)
|
||||||
|
local frames = self.get("bimg")
|
||||||
|
return frames[frameIndex or self.get("currentFrame")]
|
||||||
|
end
|
||||||
|
|
||||||
|
function Image:getMetadata()
|
||||||
|
local metadata = {}
|
||||||
|
local bimg = self.get("bimg")
|
||||||
|
for k,v in pairs(bimg)do
|
||||||
|
if(type(v)=="string")then
|
||||||
|
metadata[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return metadata
|
||||||
|
end
|
||||||
|
|
||||||
|
function Image:setMetadata(key, value)
|
||||||
|
if(type(key)=="table")then
|
||||||
|
for k,v in pairs(key)do
|
||||||
|
self:setMetadata(k, v)
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
local bimg = self.get("bimg")
|
||||||
|
if(type(value)=="string")then
|
||||||
|
bimg[key] = value
|
||||||
|
end
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- @shortDescription Renders the Image
|
--- @shortDescription Renders the Image
|
||||||
--- @protected
|
--- @protected
|
||||||
function Image:render()
|
function Image:render()
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ Input.defineProperty(Input, "maxLength", {default = nil, type = "number"})
|
|||||||
---@property placeholder string ... Text to display when input is empty
|
---@property placeholder string ... Text to display when input is empty
|
||||||
Input.defineProperty(Input, "placeholder", {default = "...", type = "string"})
|
Input.defineProperty(Input, "placeholder", {default = "...", type = "string"})
|
||||||
---@property placeholderColor color gray Color of the placeholder text
|
---@property placeholderColor color gray Color of the placeholder text
|
||||||
Input.defineProperty(Input, "placeholderColor", {default = colors.gray, type = "number"})
|
Input.defineProperty(Input, "placeholderColor", {default = colors.gray, type = "color"})
|
||||||
---@property focusedBackground color blue Background color when input is focused
|
---@property focusedBackground color blue Background color when input is focused
|
||||||
Input.defineProperty(Input, "focusedBackground", {default = colors.blue, type = "number"})
|
Input.defineProperty(Input, "focusedBackground", {default = colors.blue, type = "color"})
|
||||||
---@property focusedForeground color white Foreground color when input is focused
|
---@property focusedForeground color white Foreground color when input is focused
|
||||||
Input.defineProperty(Input, "focusedForeground", {default = colors.white, type = "number"})
|
Input.defineProperty(Input, "focusedForeground", {default = colors.white, type = "color"})
|
||||||
---@property pattern string? nil Regular expression pattern for input validation
|
---@property pattern string? nil Regular expression pattern for input validation
|
||||||
Input.defineProperty(Input, "pattern", {default = nil, type = "string"})
|
Input.defineProperty(Input, "pattern", {default = nil, type = "string"})
|
||||||
---@property cursorColor number nil Color of the cursor
|
---@property cursorColor number nil Color of the cursor
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ function Label.new()
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Initializes the Label instance
|
|
||||||
--- @shortDescription Initializes the Label instance
|
--- @shortDescription Initializes the Label instance
|
||||||
--- @param props table The properties to initialize the element with
|
--- @param props table The properties to initialize the element with
|
||||||
--- @param basalt table The basalt instance
|
--- @param basalt table The basalt instance
|
||||||
@@ -50,6 +49,10 @@ end
|
|||||||
--- @protected
|
--- @protected
|
||||||
function Label:init(props, basalt)
|
function Label:init(props, basalt)
|
||||||
VisualElement.init(self, props, basalt)
|
VisualElement.init(self, props, basalt)
|
||||||
|
if(self.parent)then
|
||||||
|
self.set("background", self.parent.get("background"))
|
||||||
|
self.set("foreground", self.parent.get("foreground"))
|
||||||
|
end
|
||||||
self.set("type", "Label")
|
self.set("type", "Label")
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ List.defineProperty(List, "multiSelection", {default = false, type = "boolean"})
|
|||||||
---@property offset number 0 Current scroll offset for viewing long lists
|
---@property offset number 0 Current scroll offset for viewing long lists
|
||||||
List.defineProperty(List, "offset", {default = 0, type = "number", canTriggerRender = true})
|
List.defineProperty(List, "offset", {default = 0, type = "number", canTriggerRender = true})
|
||||||
---@property selectedBackground color blue Background color for selected items
|
---@property selectedBackground color blue Background color for selected items
|
||||||
List.defineProperty(List, "selectedBackground", {default = colors.blue, type = "number"})
|
List.defineProperty(List, "selectedBackground", {default = colors.blue, type = "color"})
|
||||||
---@property selectedForeground color white Text color for selected items
|
---@property selectedForeground color white Text color for selected items
|
||||||
List.defineProperty(List, "selectedForeground", {default = colors.white, type = "number"})
|
List.defineProperty(List, "selectedForeground", {default = colors.white, type = "color"})
|
||||||
|
|
||||||
---@event onSelect {index number, item any} Fired when an item is selected
|
---@event onSelect {index number, item any} Fired when an item is selected
|
||||||
List.defineEvent(List, "mouse_click")
|
List.defineEvent(List, "mouse_click")
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ local Menu = setmetatable({}, List)
|
|||||||
Menu.__index = Menu
|
Menu.__index = Menu
|
||||||
|
|
||||||
---@property separatorColor color gray The color used for separator items in the menu
|
---@property separatorColor color gray The color used for separator items in the menu
|
||||||
Menu.defineProperty(Menu, "separatorColor", {default = colors.gray, type = "number"})
|
Menu.defineProperty(Menu, "separatorColor", {default = colors.gray, type = "color"})
|
||||||
|
|
||||||
--- Creates a new Menu instance
|
--- Creates a new Menu instance
|
||||||
--- @shortDescription Creates a new Menu instance
|
--- @shortDescription Creates a new Menu instance
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ ProgressBar.defineProperty(ProgressBar, "progress", {default = 0, type = "number
|
|||||||
---@property showPercentage boolean false Whether to show the percentage text in the center
|
---@property showPercentage boolean false Whether to show the percentage text in the center
|
||||||
ProgressBar.defineProperty(ProgressBar, "showPercentage", {default = false, type = "boolean"})
|
ProgressBar.defineProperty(ProgressBar, "showPercentage", {default = false, type = "boolean"})
|
||||||
---@property progressColor color lime The color used for the filled portion of the progress bar
|
---@property progressColor color lime The color used for the filled portion of the progress bar
|
||||||
ProgressBar.defineProperty(ProgressBar, "progressColor", {default = colors.black, type = "number"})
|
ProgressBar.defineProperty(ProgressBar, "progressColor", {default = colors.black, type = "color"})
|
||||||
|
|
||||||
--- Creates a new ProgressBar instance
|
--- Creates a new ProgressBar instance
|
||||||
--- @shortDescription Creates a new ProgressBar instance
|
--- @shortDescription Creates a new ProgressBar instance
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ Scrollbar.defineProperty(Scrollbar, "dragMultiplier", {default = 1, type = "numb
|
|||||||
---@property symbol string " " Symbol used for the scrollbar handle
|
---@property symbol string " " Symbol used for the scrollbar handle
|
||||||
Scrollbar.defineProperty(Scrollbar, "symbol", {default = " ", type = "string", canTriggerRender = true})
|
Scrollbar.defineProperty(Scrollbar, "symbol", {default = " ", type = "string", canTriggerRender = true})
|
||||||
---@property backgroundSymbol string "\127" Symbol used for the scrollbar background
|
---@property backgroundSymbol string "\127" Symbol used for the scrollbar background
|
||||||
Scrollbar.defineProperty(Scrollbar, "symbolColor", {default = colors.gray, type = "number", canTriggerRender = true})
|
Scrollbar.defineProperty(Scrollbar, "symbolColor", {default = colors.gray, type = "color", canTriggerRender = true})
|
||||||
---@property symbolBackgroundColor color black Background color of the scrollbar handle
|
---@property symbolBackgroundColor color black Background color of the scrollbar handle
|
||||||
Scrollbar.defineProperty(Scrollbar, "symbolBackgroundColor", {default = colors.black, type = "number", canTriggerRender = true})
|
Scrollbar.defineProperty(Scrollbar, "symbolBackgroundColor", {default = colors.black, type = "color", canTriggerRender = true})
|
||||||
---@property backgroundSymbol string "\127" Symbol used for the scrollbar background
|
---@property backgroundSymbol string "\127" Symbol used for the scrollbar background
|
||||||
Scrollbar.defineProperty(Scrollbar, "backgroundSymbol", {default = "\127", type = "string", canTriggerRender = true})
|
Scrollbar.defineProperty(Scrollbar, "backgroundSymbol", {default = "\127", type = "string", canTriggerRender = true})
|
||||||
---@property attachedElement table? nil The element this scrollbar is attached to
|
---@property attachedElement table? nil The element this scrollbar is attached to
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ Slider.defineProperty(Slider, "max", {default = 100, type = "number"})
|
|||||||
---@property horizontal boolean true Whether the slider is horizontal (false for vertical)
|
---@property horizontal boolean true Whether the slider is horizontal (false for vertical)
|
||||||
Slider.defineProperty(Slider, "horizontal", {default = true, type = "boolean", canTriggerRender = true})
|
Slider.defineProperty(Slider, "horizontal", {default = true, type = "boolean", canTriggerRender = true})
|
||||||
---@property barColor color gray Color of the slider track
|
---@property barColor color gray Color of the slider track
|
||||||
Slider.defineProperty(Slider, "barColor", {default = colors.gray, type = "number", canTriggerRender = true})
|
Slider.defineProperty(Slider, "barColor", {default = colors.gray, type = "color", canTriggerRender = true})
|
||||||
---@property sliderColor color blue Color of the slider handle
|
---@property sliderColor color blue Color of the slider handle
|
||||||
Slider.defineProperty(Slider, "sliderColor", {default = colors.blue, type = "number", canTriggerRender = true})
|
Slider.defineProperty(Slider, "sliderColor", {default = colors.blue, type = "color", canTriggerRender = true})
|
||||||
|
|
||||||
---@event onChange {value number} Fired when the slider value changes
|
---@event onChange {value number} Fired when the slider value changes
|
||||||
Slider.defineEvent(Slider, "mouse_click")
|
Slider.defineEvent(Slider, "mouse_click")
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ Table.defineProperty(Table, "data", {default = {}, type = "table", canTriggerRen
|
|||||||
---@property selectedRow number? nil Currently selected row index
|
---@property selectedRow number? nil Currently selected row index
|
||||||
Table.defineProperty(Table, "selectedRow", {default = nil, type = "number", canTriggerRender = true})
|
Table.defineProperty(Table, "selectedRow", {default = nil, type = "number", canTriggerRender = true})
|
||||||
---@property headerColor color blue Color of the column headers
|
---@property headerColor color blue Color of the column headers
|
||||||
Table.defineProperty(Table, "headerColor", {default = colors.blue, type = "number"})
|
Table.defineProperty(Table, "headerColor", {default = colors.blue, type = "color"})
|
||||||
---@property selectedColor color lightBlue Background color of selected row
|
---@property selectedColor color lightBlue Background color of selected row
|
||||||
Table.defineProperty(Table, "selectedColor", {default = colors.lightBlue, type = "number"})
|
Table.defineProperty(Table, "selectedColor", {default = colors.lightBlue, type = "color"})
|
||||||
---@property gridColor color gray Color of grid lines
|
---@property gridColor color gray Color of grid lines
|
||||||
Table.defineProperty(Table, "gridColor", {default = colors.gray, type = "number"})
|
Table.defineProperty(Table, "gridColor", {default = colors.gray, type = "color"})
|
||||||
---@property sortColumn number? nil Currently sorted column index
|
---@property sortColumn number? nil Currently sorted column index
|
||||||
Table.defineProperty(Table, "sortColumn", {default = nil, type = "number"})
|
Table.defineProperty(Table, "sortColumn", {default = nil, type = "number"})
|
||||||
---@property sortDirection string "asc" Sort direction ("asc" or "desc")
|
---@property sortDirection string "asc" Sort direction ("asc" or "desc")
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ TextBox.defineProperty(TextBox, "editable", {default = true, type = "boolean"})
|
|||||||
---@property syntaxPatterns table {} Syntax highlighting patterns
|
---@property syntaxPatterns table {} Syntax highlighting patterns
|
||||||
TextBox.defineProperty(TextBox, "syntaxPatterns", {default = {}, type = "table"})
|
TextBox.defineProperty(TextBox, "syntaxPatterns", {default = {}, type = "table"})
|
||||||
---@property cursorColor number nil Color of the cursor
|
---@property cursorColor number nil Color of the cursor
|
||||||
TextBox.defineProperty(TextBox, "cursorColor", {default = nil, type = "number"})
|
TextBox.defineProperty(TextBox, "cursorColor", {default = nil, type = "color"})
|
||||||
|
|
||||||
TextBox.defineEvent(TextBox, "mouse_click")
|
TextBox.defineEvent(TextBox, "mouse_click")
|
||||||
TextBox.defineEvent(TextBox, "key")
|
TextBox.defineEvent(TextBox, "key")
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ Tree.defineProperty(Tree, "scrollOffset", {default = 0, type = "number", canTrig
|
|||||||
---@property horizontalOffset number 0 Current horizontal scroll position
|
---@property horizontalOffset number 0 Current horizontal scroll position
|
||||||
Tree.defineProperty(Tree, "horizontalOffset", {default = 0, type = "number", canTriggerRender = true})
|
Tree.defineProperty(Tree, "horizontalOffset", {default = 0, type = "number", canTriggerRender = true})
|
||||||
---@property nodeColor color white Color of unselected nodes
|
---@property nodeColor color white Color of unselected nodes
|
||||||
Tree.defineProperty(Tree, "nodeColor", {default = colors.white, type = "number"})
|
Tree.defineProperty(Tree, "nodeColor", {default = colors.white, type = "color"})
|
||||||
---@property selectedColor color lightBlue Background color of selected node
|
---@property selectedColor color lightBlue Background color of selected node
|
||||||
Tree.defineProperty(Tree, "selectedColor", {default = colors.lightBlue, type = "number"})
|
Tree.defineProperty(Tree, "selectedColor", {default = colors.lightBlue, type = "color"})
|
||||||
|
|
||||||
Tree.defineEvent(Tree, "mouse_click")
|
Tree.defineEvent(Tree, "mouse_click")
|
||||||
Tree.defineEvent(Tree, "mouse_scroll")
|
Tree.defineEvent(Tree, "mouse_scroll")
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ VisualElement.defineProperty(VisualElement, "width", {default = 1, type = "numbe
|
|||||||
---@property height number 1 The height of the element
|
---@property height number 1 The height of the element
|
||||||
VisualElement.defineProperty(VisualElement, "height", {default = 1, type = "number", canTriggerRender = true})
|
VisualElement.defineProperty(VisualElement, "height", {default = 1, type = "number", canTriggerRender = true})
|
||||||
---@property background color black The background color
|
---@property background color black The background color
|
||||||
VisualElement.defineProperty(VisualElement, "background", {default = colors.black, type = "number", canTriggerRender = true})
|
VisualElement.defineProperty(VisualElement, "background", {default = colors.black, type = "color", canTriggerRender = true})
|
||||||
---@property foreground color white The text/foreground color
|
---@property foreground color white The text/foreground color
|
||||||
VisualElement.defineProperty(VisualElement, "foreground", {default = colors.white, type = "number", canTriggerRender = true})
|
VisualElement.defineProperty(VisualElement, "foreground", {default = colors.white, type = "color", canTriggerRender = true})
|
||||||
---@property clicked boolean false Whether the element is currently clicked
|
---@property clicked boolean false Whether the element is currently clicked
|
||||||
VisualElement.defineProperty(VisualElement, "clicked", {default = false, type = "boolean"})
|
VisualElement.defineProperty(VisualElement, "clicked", {default = false, type = "boolean"})
|
||||||
---@property hover boolean false Whether the mouse is currently hover over the element (Craftos-PC only)
|
---@property hover boolean false Whether the mouse is currently hover over the element (Craftos-PC only)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ local function expect(position, value, expectedType)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if expectedType == "color" then
|
if expectedType == "color" then
|
||||||
if valueType == "number" and value >= 1 and value <= 32768 then
|
if valueType == "number" then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
if valueType == "string" and colors[value] then
|
if valueType == "string" and colors[value] then
|
||||||
|
|||||||
Reference in New Issue
Block a user