mirror of
https://github.com/Insality/druid.git
synced 2025-06-27 10:27:47 +02:00
Solve #165 Add set_in_row function for StaticGrid
This commit is contained in:
parent
bd0c5545ae
commit
129a102cc8
@ -12,7 +12,7 @@
|
|||||||
--- On item remove callback(self, index)
|
--- On item remove callback(self, index)
|
||||||
-- @tfield druid_event on_remove_item
|
-- @tfield druid_event on_remove_item
|
||||||
|
|
||||||
--- On item add or remove callback(self, index)
|
--- On item add, remove or change in_row callback(self, index|nil)
|
||||||
-- @tfield druid_event on_change_items
|
-- @tfield druid_event on_change_items
|
||||||
|
|
||||||
--- On grid clear callback(self)
|
--- On grid clear callback(self)
|
||||||
@ -353,6 +353,20 @@ function StaticGrid:get_offset()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Set new in_row elements for grid
|
||||||
|
-- @tparam StaticGrid self
|
||||||
|
-- @tparam number in_row The new in_row value
|
||||||
|
-- @treturn druid.static_grid Current grid instance
|
||||||
|
function StaticGrid:set_in_row(in_row)
|
||||||
|
self.in_row = in_row
|
||||||
|
self._grid_horizonal_offset = self.node_size.x * (self.in_row - 1) * self.anchor.x
|
||||||
|
self:_update(true)
|
||||||
|
self.on_change_items:trigger(self:get_context())
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Update grid inner state
|
--- Update grid inner state
|
||||||
-- @tparam StaticGrid self
|
-- @tparam StaticGrid self
|
||||||
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
|
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
|
||||||
|
Loading…
x
Reference in New Issue
Block a user