From 3c063313debd118ab81559cf5eee8977b1a2acc9 Mon Sep 17 00:00:00 2001 From: Insality Date: Tue, 18 Mar 2025 21:41:09 +0200 Subject: [PATCH] Update private annotations --- druid/base/button.lua | 15 ++++++++++----- druid/custom/rich_input/rich_input.lua | 4 ++++ druid/extended/container.lua | 7 +++++-- druid/extended/data_list.lua | 2 +- druid/extended/hotkey.lua | 3 +++ druid/extended/input.lua | 2 ++ druid/extended/lang_text.lua | 1 + druid/extended/progress.lua | 3 +++ druid/extended/slider.lua | 10 +++++++--- 9 files changed, 36 insertions(+), 11 deletions(-) diff --git a/druid/base/button.lua b/druid/base/button.lua index 120d651..3dd9375 100755 --- a/druid/base/button.lua +++ b/druid/base/button.lua @@ -94,13 +94,16 @@ function M:on_style_change(style) end +---Remove default button style animations ---@return druid.button self The current button instance function M:set_animations_disabled() - self.style.on_click = function() end - self.style.on_click_disabled = function() end - self.style.on_mouse_hover = function() end - self.style.on_hover = function() end - self.style.on_set_enabled = function() end + local empty_function = function() end + + self.style.on_click = empty_function + self.style.on_hover = empty_function + self.style.on_mouse_hover = empty_function + self.style.on_set_enabled = empty_function + self.style.on_click_disabled = empty_function return self end @@ -117,6 +120,7 @@ function M:on_late_init() end +---@private ---@param action_id hash The action id ---@param action table The action table ---@return boolean is_consumed True if the input was consumed @@ -201,6 +205,7 @@ function M:on_input(action_id, action) end +---@private function M:on_input_interrupt() self.can_action = false self.hover:set_hover(false) diff --git a/druid/custom/rich_input/rich_input.lua b/druid/custom/rich_input/rich_input.lua index e4d73f3..b244004 100644 --- a/druid/custom/rich_input/rich_input.lua +++ b/druid/custom/rich_input/rich_input.lua @@ -191,6 +191,10 @@ function M:init(template, nodes) 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) if action_id == const.ACTION_LSHIFT then if action.pressed then diff --git a/druid/extended/container.lua b/druid/extended/container.lua index 46024c7..803311e 100644 --- a/druid/extended/container.lua +++ b/druid/extended/container.lua @@ -94,6 +94,7 @@ function M:init(node, mode, callback) end +---@private function M:on_late_init() if not gui.get_parent(self.node) then -- TODO: Scale issue here, in fit into window! @@ -102,6 +103,7 @@ function M:on_late_init() end +---@private function M:on_remove() self:clear_draggable_corners() end @@ -124,8 +126,8 @@ function M:set_pivot(pivot) end ----Set the style of the container ----@param style druid.container.style The style to set +---@private +---@param style druid.container.style function M:on_style_change(style) self.style = { DRAGGABLE_CORNER_SIZE = style.DRAGGABLE_CORNER_SIZE or vmath.vector3(24, 24, 0), @@ -231,6 +233,7 @@ function M:fit_into_window() end +---@private function M:on_window_resized() local x_koef, y_koef = helper.get_screen_aspect_koef() self.x_koef = x_koef diff --git a/druid/extended/data_list.lua b/druid/extended/data_list.lua index 795ac6a..d2940aa 100644 --- a/druid/extended/data_list.lua +++ b/druid/extended/data_list.lua @@ -50,7 +50,7 @@ function M:init(scroll, grid, create_function) end ----Druid System on_remove function +---@private function M:on_remove() self:clear() self.scroll.on_scroll:unsubscribe(self._refresh, self) diff --git a/druid/extended/hotkey.lua b/druid/extended/hotkey.lua index 27db333..0d17d05 100644 --- a/druid/extended/hotkey.lua +++ b/druid/extended/hotkey.lua @@ -34,6 +34,7 @@ function M:init(keys, callback, callback_argument) end +---@private ---@param style druid.hotkey.style function M:on_style_change(style) self.style = { @@ -103,6 +104,7 @@ function M:is_processing() end +---@private function M:on_focus_gained() for k, v in pairs(self._modificators) do self._modificators[k] = false @@ -110,6 +112,7 @@ function M:on_focus_gained() end +---@private ---@param action_id hash|nil The action id ---@param action action The action ---@return boolean is_consume True if the action is consumed diff --git a/druid/extended/input.lua b/druid/extended/input.lua index 693142e..1ee1a2e 100755 --- a/druid/extended/input.lua +++ b/druid/extended/input.lua @@ -230,11 +230,13 @@ function M:on_input(action_id, action) end +---@private function M:on_focus_lost() self:unselect() end +---@private function M:on_input_interrupt() --self:unselect() end diff --git a/druid/extended/lang_text.lua b/druid/extended/lang_text.lua index 7af5dec..654dafc 100755 --- a/druid/extended/lang_text.lua +++ b/druid/extended/lang_text.lua @@ -30,6 +30,7 @@ function M:init(node, locale_id, adjust_type) end +---@private function M:on_language_change() if self.last_locale then self:translate(self.last_locale, unpack(self.last_locale_args)) diff --git a/druid/extended/progress.lua b/druid/extended/progress.lua index 3a43dfe..eb2a3c8 100644 --- a/druid/extended/progress.lua +++ b/druid/extended/progress.lua @@ -45,6 +45,7 @@ function M:init(node, key, init_value) end +---@private ---@param style druid.progress.style function M:on_style_change(style) self.style = { @@ -54,11 +55,13 @@ function M:on_style_change(style) end +---@private function M:on_layout_change() self:set_to(self.last_value) end +---@private function M:on_remove() gui.set_size(self.node, self.max_size) end diff --git a/druid/extended/slider.lua b/druid/extended/slider.lua index 67521f9..e10b874 100644 --- a/druid/extended/slider.lua +++ b/druid/extended/slider.lua @@ -43,17 +43,20 @@ function M:init(node, end_pos, callback) end +---@private function M:on_layout_change() self:set(self.value) end +---@private function M:on_remove() -- Return pin to start position gui.set_position(self.node, self.start_pos) end +---@private function M:on_window_resized() local x_koef, y_koef = helper.get_screen_aspect_koef() self._x_koef = x_koef @@ -62,9 +65,10 @@ function M:on_window_resized() end ----@param action_id number The action id ----@param action action The action table ----@return boolean is_consumed True if the input was consumed +---@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) if action_id ~= const.ACTION_TOUCH then return false