Solve #182 add table pool for events

This commit is contained in:
Insality
2022-04-05 18:57:40 +03:00
parent 2779f9cf7a
commit dff522fbaa
24 changed files with 244 additions and 6 deletions

View File

@@ -67,6 +67,12 @@ function Checkbox.on_layout_change(self)
end
function Checkbox.on_internal_remove(self)
component.on_internal_remove(self)
self.on_change_state:clear()
end
--- Set checkbox state
-- @tparam Checkbox self @{Checkbox}
-- @tparam bool state Checkbox state

View File

@@ -41,6 +41,13 @@ function CheckboxGroup.init(self, nodes, callback, click_nodes)
end
function CheckboxGroup.on_internal_remove(self)
component.on_internal_remove(self)
self.on_checkbox_click:clear()
end
--- Set checkbox group state
-- @tparam CheckboxGroup self @{CheckboxGroup}
-- @tparam bool[] indexes Array of checkbox state

View File

@@ -76,6 +76,12 @@ function DataList.on_remove(self)
end
function DataList.on_internal_remove(self)
component.on_internal_remove(self)
self.on_scroll_progress_change:clear()
end
--- Set new data set for DataList component
-- @tparam DataList self @{DataList}
-- @tparam table data The new data array

View File

@@ -89,6 +89,16 @@ function DynamicGrid.init(self, parent)
end
function DynamicGrid.on_internal_remove(self)
component.on_internal_remove(self)
self.on_add_item:clear()
self.on_remove_item:clear()
self.on_change_items:clear()
self.on_clear:clear()
self.on_update_positions:clear()
end
function DynamicGrid.on_layout_change(self)
self:_update(true)
end

View File

@@ -154,6 +154,17 @@ function Input.init(self, click_node, text_node, keyboard_type)
end
function Input.on_internal_remove(self)
component.on_internal_remove(self)
self.on_input_select:clear()
self.on_input_unselect:clear()
self.on_input_text:clear()
self.on_input_empty:clear()
self.on_input_full:clear()
self.on_input_wrong:clear()
end
function Input.on_input(self, action_id, action)
if self.is_selected then
local input_text = nil

View File

@@ -41,6 +41,12 @@ function LangText.init(self, node, locale_id, no_adjust)
end
function LangText.on_internal_remove(self)
component.on_internal_remove(self)
self.on_change:clear()
end
function LangText.on_language_change(self)
if self.last_locale then
self:translate(self.last_locale, unpack(self.last_locale_args))

View File

@@ -39,6 +39,12 @@ function Layout:init(node, mode, on_size_changed_callback)
end
function Layout.on_internal_remove(self)
component.on_internal_remove(self)
self.on_size_changed:clear()
end
function Layout:on_window_resized()
local window_x, window_y = window.get_size()
local stretch_x = window_x / self.window_size.x

View File

@@ -121,6 +121,12 @@ function Progress.init(self, node, key, init_value)
end
function Progress.on_internal_remove(self)
component.on_internal_remove(self)
self.on_change:clear()
end
-- @tparam Progress self @{Progress}
function Progress.on_late_init(self)
self:set_to(self._init_value)

View File

@@ -50,6 +50,12 @@ function RadioGroup.init(self, nodes, callback, click_nodes)
end
function RadioGroup.on_internal_remove(self)
component.on_internal_remove(self)
self.on_radio_click:clear()
end
--- Set radio group state
-- @tparam RadioGroup self @{RadioGroup}
-- @tparam number index Index in radio group

View File

@@ -77,6 +77,12 @@ function Slider.init(self, node, end_pos, callback)
end
function Slider.on_internal_remove(self)
component.on_internal_remove(self)
self.on_change_value:clear()
end
function Slider.on_layout_change(self)
self:set(self.value)
end

View File

@@ -65,6 +65,14 @@ function Timer.init(self, node, seconds_from, seconds_to, callback)
end
function Timer.on_internal_remove(self)
component.on_internal_remove(self)
self.on_tick:clear()
self.on_set_enabled:clear()
self.on_timer_end:clear()
end
function Timer.update(self, dt)
if not self.is_on then
return