Module DynamicGrid
Component to handle placing components in row
Example Link
_get_side_vector(self, side, is_forward) |
Return side vector to correct node shifting |
add(self, node, index, shift_policy, is_instant) |
Add new node to the grid |
clear(self) |
Clear grid nodes array. |
get_all_pos(self) |
Return array of all node positions |
get_borders(self) |
Return grid content borders |
get_index_by_node(self, node) |
Return grid index by node |
get_offset(self) |
Return DynamicGrid offset, where DynamicGrid content starts. |
get_pos(self, index, node, origin_index) |
Return pos for grid node index |
get_size(self, border) |
Return grid content size |
init(self, parent) |
The DynamicGrid constructor |
remove(self, index, shift_policy, is_instant) |
Remove the item from the grid. |
set_position_function(self, callback) |
Change set position function for grid nodes. |
-
_get_side_vector(self, side, is_forward)
-
Return side vector to correct node shifting
Parameters:
-
add(self, node, index, shift_policy, is_instant)
-
Add new node to the grid
Parameters:
- self
DynamicGrid
DynamicGrid
- node
node
Gui node
- index
number or nil
The node position. By default add as last node
- shift_policy
number or nil
How shift nodes, if required. Default: const.SHIFT.RIGHT
- is_instant
boolean or nil
If true, update node positions instantly
-
clear(self)
-
Clear grid nodes array. GUI nodes will be not deleted!
If you want to delete GUI nodes, use dynamic_grid.nodes array before grid:clear
Parameters:
Returns:
druid.dynamic_grid
Current grid instance
-
get_all_pos(self)
-
Return array of all node positions
Parameters:
Returns:
vector3[]
All grid node positions
-
get_borders(self)
-
Return grid content borders
Parameters:
Returns:
vector3
The grid content borders
-
get_index_by_node(self, node)
-
Return grid index by node
Parameters:
- self
DynamicGrid
DynamicGrid
- node
node
The gui node in the grid
Returns:
number
The node index
-
get_offset(self)
-
Return DynamicGrid offset, where DynamicGrid content starts.
Parameters:
Returns:
vector3
The DynamicGrid offset
-
get_pos(self, index, node, origin_index)
-
Return pos for grid node index
Parameters:
- self
DynamicGrid
DynamicGrid
- index
number
The grid element index
- node
node
The node to be placed
- origin_index
number or nil
Index of nearby node
Returns:
vector3
node position
-
get_size(self, border)
-
Return grid content size
Parameters:
Returns:
vector3
The grid content size
-
init(self, parent)
-
The DynamicGrid constructor
Parameters:
- self
DynamicGrid
DynamicGrid
- parent
node
The gui node parent, where items will be placed
-
remove(self, index, shift_policy, is_instant)
-
Remove the item from the grid. Note that gui node will be not deleted
Parameters:
- self
DynamicGrid
DynamicGrid
- index
number
The grid node index to remove
- shift_policy
number or nil
How shift nodes, if required. Default: const.SHIFT.RIGHT
- is_instant
boolean or nil
If true, update node positions instantly
Returns:
node
The deleted gui node from grid
-
set_position_function(self, callback)
-
Change set position function for grid nodes. It will call on
update poses on grid elements. Default: gui.set_position
Parameters:
- self
DynamicGrid
DynamicGrid
- callback
function
Function on node set position
Returns:
druid.dynamic_grid
Current grid instance
-
border
-
The size of item content
-
first_index
-
The first index of node in grid
-
last_index
-
The last index of node in grid
-
node_size
-
Item size
-
nodes
-
List of all grid elements. Contains from node, pos, size, pivot
-
on_add_item
-
On item add callback(self, node, index)
-
on_change_items
-
On item add or remove callback(self, index)
-
on_clear
-
On grid clear callback(self)
-
on_remove_item
-
On item remove callback(self, index)
-
on_update_positions
-
On update item positions callback(self)
-
parent
-
Parent gui node