Remove on_message_input functional

This commit is contained in:
Insality 2024-11-21 00:51:35 +02:00
parent bc0ada7098
commit 9c03c950ad
5 changed files with 1 additions and 52 deletions

View File

@ -444,31 +444,6 @@ function M:on_input_interrupt()
end end
function M:on_message_input(node_id, message)
if node_id ~= self.node_id or self.disabled or not gui.is_enabled(self.node) then
return false
end
if message.action == const.MESSAGE_INPUT.BUTTON_CLICK then
on_button_click(self)
end
if message.action == const.MESSAGE_INPUT.BUTTON_LONG_CLICK then
on_button_long_click(self)
end
if message.action == const.MESSAGE_INPUT.BUTTON_DOUBLE_CLICK then
on_button_double_click(self)
end
if message.action == const.MESSAGE_INPUT.BUTTON_REPEATED_CLICK then
on_button_repeated_click(self)
self.is_repeated_started = false
self.last_pressed_time = socket.gettime()
end
end
--- Set button enabled state. --- Set button enabled state.
-- The style.on_set_enabled will be triggered. -- The style.on_set_enabled will be triggered.
-- Disabled button is not clickable. -- Disabled button is not clickable.

View File

@ -357,17 +357,6 @@ function M:on_layout_change()
end end
function M:on_message_input(node_id, message)
if node_id ~= self.node_id then
return false
end
if message.action == const.MESSAGE_INPUT.TEXT_SET then
M.set_text(self, message.value)
end
end
--- Calculate text width with font with respect to trailing space --- Calculate text width with font with respect to trailing space
---@param text string|nil ---@param text string|nil
---@return number Width ---@return number Width

View File

@ -50,7 +50,6 @@ M.ON_LATE_INIT = const.ON_LATE_INIT
M.ON_FOCUS_LOST = const.ON_FOCUS_LOST M.ON_FOCUS_LOST = const.ON_FOCUS_LOST
M.ON_FOCUS_GAINED = const.ON_FOCUS_GAINED M.ON_FOCUS_GAINED = const.ON_FOCUS_GAINED
M.ON_LAYOUT_CHANGE = const.ON_LAYOUT_CHANGE M.ON_LAYOUT_CHANGE = const.ON_LAYOUT_CHANGE
M.ON_MESSAGE_INPUT = const.ON_MESSAGE_INPUT
M.ON_WINDOW_RESIZED = const.ON_WINDOW_RESIZED M.ON_WINDOW_RESIZED = const.ON_WINDOW_RESIZED
M.ON_LANGUAGE_CHANGE = const.ON_LANGUAGE_CHANGE M.ON_LANGUAGE_CHANGE = const.ON_LANGUAGE_CHANGE
@ -62,7 +61,6 @@ M.ALL_INTERESTS = {
M.ON_FOCUS_LOST, M.ON_FOCUS_LOST,
M.ON_FOCUS_GAINED, M.ON_FOCUS_GAINED,
M.ON_LAYOUT_CHANGE, M.ON_LAYOUT_CHANGE,
M.ON_MESSAGE_INPUT,
M.ON_WINDOW_RESIZED, M.ON_WINDOW_RESIZED,
M.ON_LANGUAGE_CHANGE, M.ON_LANGUAGE_CHANGE,
} }
@ -73,7 +71,6 @@ M.SPECIFIC_UI_MESSAGES = {
[hash(M.ON_FOCUS_LOST)] = M.ON_FOCUS_LOST, [hash(M.ON_FOCUS_LOST)] = M.ON_FOCUS_LOST,
[hash(M.ON_FOCUS_GAINED)] = M.ON_FOCUS_GAINED, [hash(M.ON_FOCUS_GAINED)] = M.ON_FOCUS_GAINED,
[hash(M.ON_WINDOW_RESIZED)] = M.ON_WINDOW_RESIZED, [hash(M.ON_WINDOW_RESIZED)] = M.ON_WINDOW_RESIZED,
[hash(M.ON_MESSAGE_INPUT)] = M.ON_MESSAGE_INPUT,
[hash(M.ON_LANGUAGE_CHANGE)] = M.ON_LANGUAGE_CHANGE, [hash(M.ON_LANGUAGE_CHANGE)] = M.ON_LANGUAGE_CHANGE,
} }

View File

@ -26,7 +26,6 @@ M.ON_LATE_INIT = "on_late_init"
M.ON_FOCUS_LOST = "on_focus_lost" M.ON_FOCUS_LOST = "on_focus_lost"
M.ON_FOCUS_GAINED = "on_focus_gained" M.ON_FOCUS_GAINED = "on_focus_gained"
M.ON_LAYOUT_CHANGE = "on_layout_change" M.ON_LAYOUT_CHANGE = "on_layout_change"
M.ON_MESSAGE_INPUT = "on_message_input"
M.ON_WINDOW_RESIZED = "on_window_resized" M.ON_WINDOW_RESIZED = "on_window_resized"
M.ON_LANGUAGE_CHANGE = "on_language_change" M.ON_LANGUAGE_CHANGE = "on_language_change"

View File

@ -386,18 +386,7 @@ end
function M:on_message(message_id, message, sender) function M:on_message(message_id, message, sender)
local specific_ui_message = base_component.SPECIFIC_UI_MESSAGES[message_id] local specific_ui_message = base_component.SPECIFIC_UI_MESSAGES[message_id]
if specific_ui_message == base_component.ON_MESSAGE_INPUT then if specific_ui_message then
-- ON_MESSAGE_INPUT is special message, need to perform additional logic
local components = self.components_interest[base_component.ON_MESSAGE_INPUT]
if components then
for i = 1, #components do
local component = components[i]
if can_use_input_component(self, component) then
component[specific_ui_message](component, hash(message.node_id), message)
end
end
end
elseif specific_ui_message then
-- Resend special message to all components with the related interest -- Resend special message to all components with the related interest
local components = self.components_interest[specific_ui_message] local components = self.components_interest[specific_ui_message]
if components then if components then