mirror of
https://github.com/Insality/druid
synced 2025-09-27 10:02:19 +02:00
Refactor text setting methods and remove ldoc files
This commit is contained in:
@@ -24,7 +24,7 @@ end
|
||||
|
||||
---@param info string
|
||||
function M:set_debug_info(info)
|
||||
self.text_debug_info:set_to(info)
|
||||
self.text_debug_info:set_text(info)
|
||||
end
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ function M:set_gui_path(path)
|
||||
-- We need add "/" before path and replace .lua to .gui
|
||||
path = "/" .. path:gsub(".lua", ".gui")
|
||||
|
||||
self.text_gui_path:set_to(path)
|
||||
self.text_gui_path:set_text(path)
|
||||
end
|
||||
|
||||
|
||||
|
@@ -81,7 +81,7 @@ end
|
||||
|
||||
function M:update_memory()
|
||||
local memory = collectgarbage("count")
|
||||
self.text_memory_amount:set_to(tostring(math.ceil(memory)))
|
||||
self.text_memory_amount:set_text(tostring(math.ceil(memory)))
|
||||
|
||||
local width = helper.centrate_nodes(2, unpack(self.nodes_memory))
|
||||
for index = 1, #self.nodes_memory do
|
||||
@@ -102,8 +102,8 @@ function M:update_fps()
|
||||
end
|
||||
average_frame_time = average_frame_time / #self.fps_samples
|
||||
|
||||
self.text_fps_amount:set_to(tostring(math.ceil(1 / average_frame_time)))
|
||||
self.text_fps_min:set_to("/ " .. tostring(math.ceil(1 / max_frame_time)))
|
||||
self.text_fps_amount:set_text(tostring(math.ceil(1 / average_frame_time)))
|
||||
self.text_fps_min:set_text("/ " .. tostring(math.ceil(1 / max_frame_time)))
|
||||
|
||||
local width = helper.centrate_nodes(2, unpack(self.nodes_fps))
|
||||
self.group_fps:set_size(width, nil)
|
||||
@@ -114,14 +114,14 @@ function M:update_components()
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
local components = #self.druid.components_all
|
||||
|
||||
self.text_components_amount:set_to(tostring(components))
|
||||
self.text_components_amount:set_text(tostring(components))
|
||||
local width = helper.centrate_nodes(2, unpack(self.nodes_components))
|
||||
self.group_components:set_size(width, nil)
|
||||
end
|
||||
|
||||
|
||||
function M:update_events()
|
||||
self.text_events_amount:set_to(tostring(event.COUNTER))
|
||||
self.text_events_amount:set_text("unsupported")
|
||||
|
||||
local width = helper.centrate_nodes(2, unpack(self.nodes_events))
|
||||
for index = 1, #self.nodes_events do
|
||||
|
@@ -33,7 +33,7 @@ end
|
||||
---@param callback fun(value:number):string
|
||||
function M:set_text_function(callback)
|
||||
self._text_function = callback
|
||||
self.text_value:set_to(self._text_function(self._value))
|
||||
self.text_value:set_text(self._text_function(self._value))
|
||||
end
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ function M:set_value(value, is_instant)
|
||||
|
||||
self._value = value
|
||||
self.slider:set(value, true)
|
||||
self.text_value:set_to(self._text_function(value))
|
||||
self.text_value:set_text(self._text_function(value))
|
||||
|
||||
if not is_instant then
|
||||
gui.set_alpha(self.selected, 1)
|
||||
@@ -62,7 +62,7 @@ end
|
||||
|
||||
function M:_on_slider_change_by_user(value)
|
||||
self._value = value
|
||||
self.text_value:set_to(self._text_function(value))
|
||||
self.text_value:set_text(self._text_function(value))
|
||||
|
||||
gui.set_alpha(self.selected, 1)
|
||||
gui.animate(self.selected, "color.w", 0, gui.EASING_INSINE, 0.16)
|
||||
|
@@ -51,7 +51,7 @@ end
|
||||
---@param instance button_component
|
||||
---@param data table
|
||||
function M:on_element_add(index, node, instance, data)
|
||||
instance.text:set_to("Data Item " .. index)
|
||||
instance.text:set_text("Data Item " .. index)
|
||||
instance.button.on_click:subscribe(self.on_button_click, self)
|
||||
instance:set_data(index)
|
||||
end
|
||||
|
@@ -88,7 +88,7 @@ end
|
||||
|
||||
---@private
|
||||
function M:refresh_content(node, hint_text, pivot_point, content_pivot)
|
||||
self.text_hint:set_to(hint_text)
|
||||
self.text_hint:set_text(hint_text)
|
||||
local text_width, text_height = self.text_hint:get_text_size()
|
||||
|
||||
local panel_width = math.max(text_width, MIN_PANEL_WIDTH) + PANEL_MARGIN
|
||||
|
Reference in New Issue
Block a user