mirror of
https://github.com/Insality/druid
synced 2025-06-27 10:27:48 +02:00
Add self:get_node assert, add no_auto_template flag, fix idents
This commit is contained in:
parent
a3e5ff1116
commit
669b525c15
@ -262,7 +262,6 @@ function StaticGrid.get_size(self)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function StaticGrid.get_size_for(self, count)
|
||||
if not count or count == 0 then
|
||||
return vmath.vector3(0)
|
||||
@ -475,5 +474,4 @@ function StaticGrid:_get_zero_offset_x(row_index)
|
||||
end
|
||||
|
||||
|
||||
|
||||
return StaticGrid
|
||||
|
@ -12,6 +12,8 @@ local helper = require("druid.helper")
|
||||
|
||||
local BaseComponent = class("druid.component")
|
||||
|
||||
local IS_AUTO_TEMPLATE = not (sys.get_config("druid.no_auto_template") == "1")
|
||||
|
||||
|
||||
--- Component Interests
|
||||
BaseComponent.ON_INPUT = const.ON_INPUT
|
||||
@ -79,7 +81,7 @@ function BaseComponent.set_template(self, template)
|
||||
template = template or const.EMPTY_STRING
|
||||
|
||||
local parent = self:get_parent_component()
|
||||
if parent then
|
||||
if parent and IS_AUTO_TEMPLATE then
|
||||
local parent_template = parent:get_template()
|
||||
if #parent_template > 0 then
|
||||
if #template > 0 then
|
||||
@ -138,7 +140,6 @@ function BaseComponent.increase_input_priority(self)
|
||||
end
|
||||
|
||||
|
||||
|
||||
--- Get node for component by name.
|
||||
-- If component has nodes, node_or_name should be string
|
||||
-- It auto pick node by template name or from nodes by clone_tree
|
||||
@ -154,18 +155,25 @@ function BaseComponent.get_node(self, node_or_name)
|
||||
template_name = template_name .. "/"
|
||||
end
|
||||
|
||||
local node
|
||||
local node_type = type(node_or_name)
|
||||
if nodes then
|
||||
assert(node_type == const.STRING, "You should pass node name instead of node")
|
||||
return nodes[template_name .. node_or_name]
|
||||
node = nodes[template_name .. node_or_name]
|
||||
else
|
||||
if node_type == const.STRING then
|
||||
return gui.get_node(template_name .. node_or_name)
|
||||
node = gui.get_node(template_name .. node_or_name)
|
||||
else
|
||||
-- Assume it's already node from gui.get_node
|
||||
return node_or_name
|
||||
node = node_or_name
|
||||
end
|
||||
end
|
||||
|
||||
if not node then
|
||||
assert(node, "No component with name: " .. template_name .. node_or_name)
|
||||
end
|
||||
|
||||
return node
|
||||
end
|
||||
|
||||
|
||||
|
@ -312,7 +312,6 @@ function DataList._check_elements_from(self, index, step)
|
||||
end
|
||||
|
||||
|
||||
|
||||
--- Update actual data params
|
||||
-- @tparam DataList self @{DataList}
|
||||
-- @local
|
||||
|
@ -410,7 +410,6 @@ function DynamicGrid._get_next_node_pos(self, origin_node_index, new_node, place
|
||||
end
|
||||
|
||||
|
||||
|
||||
function DynamicGrid._get_node_size(self, node)
|
||||
return vmath.mul_per_elem(gui.get_size(node), gui.get_scale(node))
|
||||
end
|
||||
|
@ -173,7 +173,6 @@ function M.is_enabled(node)
|
||||
end
|
||||
|
||||
|
||||
|
||||
--- Return closest non inverted clipping parent node for node
|
||||
-- @function helper.get_closest_stencil_node
|
||||
-- @tparam node node Gui node
|
||||
|
@ -140,7 +140,6 @@ local function check_sort_input_stack(self, components)
|
||||
end
|
||||
|
||||
|
||||
|
||||
--- Check whitelists and blacklists for input components
|
||||
local function can_use_input_component(self, component)
|
||||
local can_by_whitelist = true
|
||||
|
@ -28,6 +28,7 @@ use_accelerometer = 0
|
||||
[druid]
|
||||
no_auto_input = 0
|
||||
stencil_check = 0
|
||||
no_auto_template = 0
|
||||
input_text = text
|
||||
input_touch = touch
|
||||
input_marked_text = marked_text
|
||||
|
Loading…
x
Reference in New Issue
Block a user