Update private annotations

This commit is contained in:
Insality 2025-03-18 21:41:09 +02:00
parent 19ea7fcff9
commit 3c063313de
9 changed files with 36 additions and 11 deletions

View File

@ -94,13 +94,16 @@ function M:on_style_change(style)
end end
---Remove default button style animations
---@return druid.button self The current button instance ---@return druid.button self The current button instance
function M:set_animations_disabled() function M:set_animations_disabled()
self.style.on_click = function() end local empty_function = function() end
self.style.on_click_disabled = function() end
self.style.on_mouse_hover = function() end self.style.on_click = empty_function
self.style.on_hover = function() end self.style.on_hover = empty_function
self.style.on_set_enabled = function() end self.style.on_mouse_hover = empty_function
self.style.on_set_enabled = empty_function
self.style.on_click_disabled = empty_function
return self return self
end end
@ -117,6 +120,7 @@ function M:on_late_init()
end end
---@private
---@param action_id hash The action id ---@param action_id hash The action id
---@param action table The action table ---@param action table The action table
---@return boolean is_consumed True if the input was consumed ---@return boolean is_consumed True if the input was consumed
@ -201,6 +205,7 @@ function M:on_input(action_id, action)
end end
---@private
function M:on_input_interrupt() function M:on_input_interrupt()
self.can_action = false self.can_action = false
self.hover:set_hover(false) self.hover:set_hover(false)

View File

@ -191,6 +191,10 @@ function M:init(template, nodes)
end end
---@private
---@param action_id hash Action id from on_input
---@param action table Action table from on_input
---@return boolean is_consumed True if input was consumed
function M:on_input(action_id, action) function M:on_input(action_id, action)
if action_id == const.ACTION_LSHIFT then if action_id == const.ACTION_LSHIFT then
if action.pressed then if action.pressed then

View File

@ -94,6 +94,7 @@ function M:init(node, mode, callback)
end end
---@private
function M:on_late_init() function M:on_late_init()
if not gui.get_parent(self.node) then if not gui.get_parent(self.node) then
-- TODO: Scale issue here, in fit into window! -- TODO: Scale issue here, in fit into window!
@ -102,6 +103,7 @@ function M:on_late_init()
end end
---@private
function M:on_remove() function M:on_remove()
self:clear_draggable_corners() self:clear_draggable_corners()
end end
@ -124,8 +126,8 @@ function M:set_pivot(pivot)
end end
---Set the style of the container ---@private
---@param style druid.container.style The style to set ---@param style druid.container.style
function M:on_style_change(style) function M:on_style_change(style)
self.style = { self.style = {
DRAGGABLE_CORNER_SIZE = style.DRAGGABLE_CORNER_SIZE or vmath.vector3(24, 24, 0), DRAGGABLE_CORNER_SIZE = style.DRAGGABLE_CORNER_SIZE or vmath.vector3(24, 24, 0),
@ -231,6 +233,7 @@ function M:fit_into_window()
end end
---@private
function M:on_window_resized() function M:on_window_resized()
local x_koef, y_koef = helper.get_screen_aspect_koef() local x_koef, y_koef = helper.get_screen_aspect_koef()
self.x_koef = x_koef self.x_koef = x_koef

View File

@ -50,7 +50,7 @@ function M:init(scroll, grid, create_function)
end end
---Druid System on_remove function ---@private
function M:on_remove() function M:on_remove()
self:clear() self:clear()
self.scroll.on_scroll:unsubscribe(self._refresh, self) self.scroll.on_scroll:unsubscribe(self._refresh, self)

View File

@ -34,6 +34,7 @@ function M:init(keys, callback, callback_argument)
end end
---@private
---@param style druid.hotkey.style ---@param style druid.hotkey.style
function M:on_style_change(style) function M:on_style_change(style)
self.style = { self.style = {
@ -103,6 +104,7 @@ function M:is_processing()
end end
---@private
function M:on_focus_gained() function M:on_focus_gained()
for k, v in pairs(self._modificators) do for k, v in pairs(self._modificators) do
self._modificators[k] = false self._modificators[k] = false
@ -110,6 +112,7 @@ function M:on_focus_gained()
end end
---@private
---@param action_id hash|nil The action id ---@param action_id hash|nil The action id
---@param action action The action ---@param action action The action
---@return boolean is_consume True if the action is consumed ---@return boolean is_consume True if the action is consumed

View File

@ -230,11 +230,13 @@ function M:on_input(action_id, action)
end end
---@private
function M:on_focus_lost() function M:on_focus_lost()
self:unselect() self:unselect()
end end
---@private
function M:on_input_interrupt() function M:on_input_interrupt()
--self:unselect() --self:unselect()
end end

View File

@ -30,6 +30,7 @@ function M:init(node, locale_id, adjust_type)
end end
---@private
function M:on_language_change() function M:on_language_change()
if self.last_locale then if self.last_locale then
self:translate(self.last_locale, unpack(self.last_locale_args)) self:translate(self.last_locale, unpack(self.last_locale_args))

View File

@ -45,6 +45,7 @@ function M:init(node, key, init_value)
end end
---@private
---@param style druid.progress.style ---@param style druid.progress.style
function M:on_style_change(style) function M:on_style_change(style)
self.style = { self.style = {
@ -54,11 +55,13 @@ function M:on_style_change(style)
end end
---@private
function M:on_layout_change() function M:on_layout_change()
self:set_to(self.last_value) self:set_to(self.last_value)
end end
---@private
function M:on_remove() function M:on_remove()
gui.set_size(self.node, self.max_size) gui.set_size(self.node, self.max_size)
end end

View File

@ -43,17 +43,20 @@ function M:init(node, end_pos, callback)
end end
---@private
function M:on_layout_change() function M:on_layout_change()
self:set(self.value) self:set(self.value)
end end
---@private
function M:on_remove() function M:on_remove()
-- Return pin to start position -- Return pin to start position
gui.set_position(self.node, self.start_pos) gui.set_position(self.node, self.start_pos)
end end
---@private
function M:on_window_resized() function M:on_window_resized()
local x_koef, y_koef = helper.get_screen_aspect_koef() local x_koef, y_koef = helper.get_screen_aspect_koef()
self._x_koef = x_koef self._x_koef = x_koef
@ -62,9 +65,10 @@ function M:on_window_resized()
end end
---@param action_id number The action id ---@private
---@param action action The action table ---@param action_id hash Action id from on_input
---@return boolean is_consumed True if the input was consumed ---@param action table Action table from on_input
---@return boolean is_consumed True if input was consumed
function M:on_input(action_id, action) function M:on_input(action_id, action)
if action_id ~= const.ACTION_TOUCH then if action_id ~= const.ACTION_TOUCH then
return false return false