Remove colors from rich text

This commit is contained in:
Insality
2025-05-28 22:13:44 +03:00
parent 0cf5ba30db
commit 97942965cd
4 changed files with 22 additions and 30 deletions

View File

@@ -51,7 +51,6 @@ local rich_text = require("druid.custom.rich_text.module.rt")
---@field height number
---@class druid.rich_text.style
---@field COLORS table<string, vector4>
---@field ADJUST_STEPS number
---@field ADJUST_SCALE_DELTA number
@@ -105,7 +104,6 @@ end
---@param style druid.rich_text.style
function M:on_style_change(style)
self.style = {
COLORS = style.COLORS or {},
ADJUST_STEPS = style.ADJUST_STEPS or 20,
ADJUST_SCALE_DELTA = style.ADJUST_SCALE_DELTA or 0.02,
}

View File

@@ -148,12 +148,4 @@ M["hotkey"] = {
}
M["rich_text"] = {
COLORS = {
white = "#FFFFFF",
black = "#000000"
}
}
return M

View File

@@ -205,26 +205,28 @@ end
function M:update(dt)
if self.is_dirty then
self.is_dirty = false
if not self.is_dirty then
return
end
self:clear_created_properties()
self.is_dirty = false
local properties_count = #self.properties_constructors
self:clear_created_properties()
-- Render all current properties
local start_index = (self.current_page - 1) * self.properties_per_page + 1
local end_index = start_index + self.properties_per_page - 1
end_index = math.min(end_index, properties_count)
local properties_count = #self.properties_constructors
local is_paginator_visible = properties_count > self.properties_per_page
gui.set_enabled(self.paginator.root, is_paginator_visible)
self.paginator:set_number_type(1, math.ceil(properties_count / self.properties_per_page), true)
self.paginator.text_value:set_text(self.current_page .. " / " .. math.ceil(properties_count / self.properties_per_page))
-- Render all current properties
local start_index = (self.current_page - 1) * self.properties_per_page + 1
local end_index = start_index + self.properties_per_page - 1
end_index = math.min(end_index, properties_count)
for index = start_index, end_index do
self.properties_constructors[index]()
end
local is_paginator_visible = properties_count > self.properties_per_page
gui.set_enabled(self.paginator.root, is_paginator_visible)
self.paginator:set_number_type(1, math.ceil(properties_count / self.properties_per_page), true)
self.paginator.text_value:set_text(self.current_page .. " / " .. math.ceil(properties_count / self.properties_per_page))
for index = start_index, end_index do
self.properties_constructors[index]()
end
end