mirror of
https://github.com/Insality/druid.git
synced 2025-09-28 02:22:18 +02:00
Scroll refactoring process
This commit is contained in:
@@ -97,7 +97,8 @@ end
|
||||
|
||||
|
||||
local function setup_scroll(self)
|
||||
self.scroll = self.druid:new_scroll("scroll_content", "main_page")
|
||||
self.druid:new_scroll("main_page", "scroll_content")
|
||||
self.scroll = self.druid:new_scroll("scroll2_view", "scroll2_content")
|
||||
end
|
||||
|
||||
|
||||
|
@@ -4,7 +4,7 @@ local M = {}
|
||||
local function init_grid(self)
|
||||
local prefab = gui.get_node("grid_prefab")
|
||||
|
||||
local grid_scroll = self.druid:new_scroll("grid_content", "scroll_with_grid_size")
|
||||
local grid_scroll = self.druid:new_scroll("scroll_with_grid_size", "grid_content")
|
||||
local grid = self.druid:new_grid("grid_content", "grid_prefab", 20)
|
||||
|
||||
for i = 1, 40 do
|
||||
@@ -23,29 +23,29 @@ local function init_grid(self)
|
||||
|
||||
gui.set_enabled(prefab, false)
|
||||
|
||||
grid_scroll:set_border(grid:get_size())
|
||||
grid_scroll:set_size(grid:get_size())
|
||||
|
||||
local scroll_slider = self.druid:new_slider("grid_scroll_pin", vmath.vector3(300, 0, 0), function(_, value)
|
||||
grid_scroll:scroll_to_percent(vmath.vector3(value, 0, 0), true)
|
||||
-- grid_scroll:scroll_to_percent(vmath.vector3(value, 0, 0), true)
|
||||
end)
|
||||
|
||||
grid_scroll.on_scroll:subscribe(function(_, point)
|
||||
scroll_slider:set(grid_scroll:get_scroll_percent().x, true)
|
||||
scroll_slider:set(grid_scroll:get_percent().x, true)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
function M.setup_page(self)
|
||||
self.druid:new_scroll("scroll_page_content", "scroll_page")
|
||||
self.druid:new_scroll("simple_scroll_content", "simple_scroll_input")
|
||||
self.druid:new_scroll("scroll_page", "scroll_page_content")
|
||||
self.druid:new_scroll("simple_scroll_input", "simple_scroll_content")
|
||||
|
||||
-- scroll contain scrolls:
|
||||
-- parent first
|
||||
self.druid:new_scroll("children_scroll_content", "children_scroll")
|
||||
self.druid:new_scroll("children_scroll", "children_scroll_content")
|
||||
-- chilren next
|
||||
self.druid:new_scroll("children_scroll_content_1", "children_scroll_1")
|
||||
self.druid:new_scroll("children_scroll_content_2", "children_scroll_2")
|
||||
self.druid:new_scroll("children_scroll_content_3", "children_scroll_3")
|
||||
self.druid:new_scroll("children_scroll_1", "children_scroll_content_1")
|
||||
self.druid:new_scroll("children_scroll_2", "children_scroll_content_2")
|
||||
self.druid:new_scroll("children_scroll_3", "children_scroll_content_3")
|
||||
|
||||
init_grid(self)
|
||||
end
|
||||
|
Reference in New Issue
Block a user