Scroll refactoring process

This commit is contained in:
Insality
2020-04-28 18:13:43 +03:00
parent 6f8190f1a6
commit 05425fb76c
11 changed files with 1196 additions and 439 deletions

View File

@@ -180,7 +180,7 @@ nodes {
nodes {
position {
x: 0.0
y: 450.0
y: 1200.0
z: 0.0
w: 1.0
}
@@ -198,7 +198,7 @@ nodes {
}
size {
x: 600.0
y: 1250.0
y: 1500.0
z: 0.0
w: 1.0
}
@@ -2882,7 +2882,7 @@ nodes {
nodes {
position {
x: 0.0
y: -890.0
y: -1890.0
z: 0.0
w: 1.0
}
@@ -3225,6 +3225,179 @@ nodes {
text_leading: 1.0
text_tracking: 0.0
}
nodes {
position {
x: 0.0
y: -1150.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 400.0
y: 400.0
z: 0.0
w: 1.0
}
color {
x: 0.5019608
y: 0.2
z: 0.3019608
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: ""
id: "scroll2_view"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "scroll_content"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_MANUAL
}
nodes {
position {
x: 0.0
y: 200.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 400.0
y: 800.0
z: 0.0
w: 1.0
}
color {
x: 0.4
y: 0.3019608
z: 0.7019608
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: ""
id: "scroll2_content"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_N
adjust_mode: ADJUST_MODE_FIT
parent: "scroll2_view"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 0.5
template_node_child: false
size_mode: SIZE_MODE_MANUAL
}
nodes {
position {
x: 0.0
y: -200.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 200.0
y: 100.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "Content"
font: "game"
id: "text"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
outline {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: false
parent: "scroll2_content"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.0
shadow_alpha: 0.0
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
}
nodes {
position {
x: 600.0
@@ -5334,7 +5507,7 @@ nodes {
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_STENCIL
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
@@ -5389,7 +5562,7 @@ nodes {
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_mode: CLIPPING_MODE_STENCIL
clipping_visible: true
clipping_inverted: false
alpha: 1.0

View File

@@ -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

View File

@@ -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