mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 10:02:18 +02:00
Add reinit data_list example, add debug mode for druid/components. Refactor scroll is_in_view. Use late remove while scroll update
This commit is contained in:
@@ -190,7 +190,16 @@ end
|
||||
-- @tparam BaseComponent self @{BaseComponent}
|
||||
-- @treturn string The component name
|
||||
function BaseComponent.get_name(self)
|
||||
return self._component.name
|
||||
return self._component.name .. self:get_uid()
|
||||
end
|
||||
|
||||
|
||||
--- Return parent component name
|
||||
-- @tparam BaseComponent self @{BaseComponent}
|
||||
-- @treturn string|nil The parent component name if exist or bil
|
||||
function BaseComponent.get_parent_name(self)
|
||||
local parent = self:get_parent_component()
|
||||
return parent and parent:get_name()
|
||||
end
|
||||
|
||||
|
||||
@@ -313,12 +322,33 @@ function BaseComponent.initialize(self, name, input_priority)
|
||||
name = name,
|
||||
input_priority = input_priority or const.PRIORITY_INPUT,
|
||||
default_input_priority = input_priority or const.PRIORITY_INPUT,
|
||||
is_debug = false,
|
||||
_is_input_priority_changed = true, -- Default true for sort once time after GUI init
|
||||
_uid = BaseComponent.get_uid()
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
--- Print log information if debug mode is enabled (protected)
|
||||
-- @tparam BaseComponent self @{BaseComponent}
|
||||
-- @tparam string message
|
||||
-- @tparam table context
|
||||
function BaseComponent.log_message(self, message, context)
|
||||
if not self._component.is_debug then
|
||||
return
|
||||
end
|
||||
print("[" .. self:get_name() .. "]:", message, helper.table_to_string(context))
|
||||
end
|
||||
|
||||
|
||||
--- Set debug logs for component enabled or disabled
|
||||
-- @tparam BaseComponent self @{BaseComponent}
|
||||
-- @tparam bool is_debug
|
||||
function BaseComponent.set_debug(self, is_debug)
|
||||
self._component.is_debug = is_debug
|
||||
end
|
||||
|
||||
|
||||
--- Return true, if input priority was changed
|
||||
-- @tparam BaseComponent self @{BaseComponent}
|
||||
-- @local
|
||||
|
Reference in New Issue
Block a user