mirror of
https://github.com/Insality/druid
synced 2025-09-27 18:12:21 +02:00
Better grid example hints
This commit is contained in:
@@ -66,19 +66,18 @@ local function init_static_grid(self)
|
||||
self.druid:new_button("button_add/button", function()
|
||||
add_node(self)
|
||||
end)
|
||||
self.druid:new_button("button_clear/button", clear_nodes)
|
||||
|
||||
local remove_button = self.druid:new_button("button_remove/button", remove_node)
|
||||
gui.set_enabled(remove_button.node, false)
|
||||
self.druid:new_button("button_clear/button", function()
|
||||
clear_nodes(self)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
local function remove_dynamic_node(self, button)
|
||||
local function remove_dynamic_node(self, button, is_shift_left)
|
||||
gui.delete_node(button.node)
|
||||
|
||||
self.druid:remove(button)
|
||||
local index = self.grid_dynamic_grid:get_index_by_node(button.node)
|
||||
self.grid_dynamic_grid:remove(index)
|
||||
self.grid_dynamic_grid:remove(index, is_shift_left)
|
||||
for i = 1, #self.dynamic_node_buttons do
|
||||
if self.dynamic_node_buttons[i] == button then
|
||||
table.remove(self.dynamic_node_buttons, i)
|
||||
@@ -97,6 +96,9 @@ local function add_node_dynamic(self, index, is_shift_left)
|
||||
local button = self.druid:new_button(node, function(_, params, button)
|
||||
remove_dynamic_node(self, button)
|
||||
end)
|
||||
button.on_long_click:subscribe(function()
|
||||
remove_dynamic_node(self, button, true)
|
||||
end)
|
||||
button:set_click_zone(self.grid_dynamic_scroll.view_node)
|
||||
table.insert(self.dynamic_node_buttons, button)
|
||||
end
|
||||
|
@@ -27,7 +27,7 @@ local function setup_texts(self)
|
||||
timer.delay(0.3, true, function()
|
||||
anchoring:set_pivot(pivots[pivot_index])
|
||||
|
||||
pivot_index = pivot_index + 1
|
||||
pivot_index = pivot_index + 1
|
||||
if pivot_index > #pivots then
|
||||
pivot_index = 1
|
||||
end
|
||||
|
Reference in New Issue
Block a user