mirror of
https://github.com/Insality/druid.git
synced 2025-06-27 10:27:47 +02:00
Add correct static grid node spawn
This commit is contained in:
parent
40af3f6181
commit
c0bd3e599b
@ -151,11 +151,13 @@ function StaticGrid:add(item, index)
|
||||
|
||||
gui.set_parent(item, self.parent)
|
||||
|
||||
local pos = self:get_pos(index)
|
||||
-- Add new item instantly in new pos
|
||||
gui.set_position(item, pos)
|
||||
-- Add new item instantly in new pos. Break update function for correct positioning
|
||||
self:_update_indexes()
|
||||
self:_update_borders()
|
||||
|
||||
self:_update()
|
||||
gui.set_position(item, self:get_pos(index) + self:get_zero_offset())
|
||||
|
||||
self:_update_pos()
|
||||
|
||||
self.on_add_item:trigger(self:get_context(), item, index)
|
||||
self.on_change_items:trigger(self:get_context(), index)
|
||||
|
@ -67,7 +67,9 @@ local function init_static_grid(self)
|
||||
add_node(self, i)
|
||||
end
|
||||
|
||||
self.druid:new_button("button_add/button", add_node)
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user