mirror of
https://github.com/Insality/druid.git
synced 2025-06-27 10:27:47 +02:00
Add grid node anchor correct for calculate borders
This commit is contained in:
parent
7a6e8bbef3
commit
f027d4ac96
@ -43,7 +43,10 @@ function M.init(self, parent, element, in_row)
|
||||
self.anchor = vmath.vector3(0.5 + pivot.x, 0.5 - pivot.y, 0)
|
||||
|
||||
self.in_row = in_row or 1
|
||||
self.node_size = gui.get_size(self:get_node(element))
|
||||
local node = self:get_node(element)
|
||||
self.node_size = gui.get_size(node)
|
||||
self.node_pivot = const.PIVOTS[gui.get_pivot(node)]
|
||||
|
||||
self.border = vmath.vector4(0)
|
||||
self.border_offset = vmath.vector3(0)
|
||||
|
||||
@ -58,11 +61,12 @@ end
|
||||
|
||||
local function _update_border(self, pos, border)
|
||||
local size = self.node_size
|
||||
local pivot = self.node_pivot
|
||||
|
||||
local left = pos.x - size.x/2 + self.border_offset.x
|
||||
local right = pos.x + size.x/2 + self.border_offset.x
|
||||
local top = pos.y + size.y/2 + self.border_offset.y
|
||||
local bottom = pos.y - size.y/2 + self.border_offset.y
|
||||
local left = pos.x - size.x/2 - (size.x * pivot.x) + self.border_offset.x
|
||||
local right = pos.x + size.x/2 - (size.x * pivot.x) + self.border_offset.x
|
||||
local top = pos.y + size.y/2 - (size.y * pivot.y) + self.border_offset.y
|
||||
local bottom = pos.y - size.y/2 - (size.y * pivot.y)+ self.border_offset.y
|
||||
|
||||
border.x = math.min(border.x, left)
|
||||
border.y = math.max(border.y, top)
|
||||
|
@ -10676,7 +10676,7 @@ nodes {
|
||||
nodes {
|
||||
position {
|
||||
x: 0.0
|
||||
y: 3.0
|
||||
y: 4.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ end
|
||||
|
||||
local function setup_infinity_list(self)
|
||||
local data = {}
|
||||
for i = 1, 2500 do
|
||||
for i = 1, 250 do
|
||||
table.insert(data, i)
|
||||
end
|
||||
|
||||
@ -27,7 +27,7 @@ local function setup_infinity_list(self)
|
||||
end)
|
||||
|
||||
-- scroll to some index
|
||||
local pos = self.infinity_grid:get_pos(950)
|
||||
local pos = self.infinity_grid:get_pos(100)
|
||||
self.infinity_scroll:scroll_to(pos, true)
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user