mirror of
https://github.com/Insality/druid
synced 2025-06-27 18:37:45 +02:00
Scroll refactoring progress
This commit is contained in:
parent
f77fa8e8a8
commit
7d3429f252
@ -22,11 +22,11 @@ local function start_touch(self, touch)
|
|||||||
self.is_touch = true
|
self.is_touch = true
|
||||||
self.is_drag = false
|
self.is_drag = false
|
||||||
|
|
||||||
self.touch_start_pos.x = touch.screen_x
|
self.touch_start_pos.x = touch.x
|
||||||
self.touch_start_pos.y = touch.screen_y
|
self.touch_start_pos.y = touch.y
|
||||||
|
|
||||||
self.screen_x = touch.screen_x
|
self.x = touch.x
|
||||||
self.screen_y = touch.screen_y
|
self.y = touch.y
|
||||||
|
|
||||||
self.on_touch_start:trigger(self:get_context())
|
self.on_touch_start:trigger(self:get_context())
|
||||||
end
|
end
|
||||||
@ -40,22 +40,24 @@ local function end_touch(self)
|
|||||||
self.is_drag = false
|
self.is_drag = false
|
||||||
self.is_touch = false
|
self.is_touch = false
|
||||||
self.on_touch_end:trigger(self:get_context())
|
self.on_touch_end:trigger(self:get_context())
|
||||||
|
self:reset_input_priority()
|
||||||
self.touch_id = 0
|
self.touch_id = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function process_touch(self, touch)
|
local function process_touch(self, touch)
|
||||||
if not self.can_x then
|
if not self.can_x then
|
||||||
self.touch_start_pos.x = touch.screen_x
|
self.touch_start_pos.x = touch.x
|
||||||
end
|
end
|
||||||
if not self.can_y then
|
if not self.can_y then
|
||||||
self.touch_start_pos.y = touch.screen_y
|
self.touch_start_pos.y = touch.y
|
||||||
end
|
end
|
||||||
|
|
||||||
local distance = helper.distance(touch.screen_x, touch.screen_y, self.touch_start_pos.x, self.touch_start_pos.y)
|
local distance = helper.distance(touch.x, touch.y, self.touch_start_pos.x, self.touch_start_pos.y)
|
||||||
if not self.is_drag and distance >= self.drag_deadzone then
|
if not self.is_drag and distance >= self.drag_deadzone then
|
||||||
self.is_drag = true
|
self.is_drag = true
|
||||||
self.on_drag_start:trigger(self:get_context())
|
self.on_drag_start:trigger(self:get_context())
|
||||||
|
self:increase_input_priority()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -93,8 +95,8 @@ local function on_touch_release(self, action_id, action)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if next_touch then
|
if next_touch then
|
||||||
self.screen_x = next_touch.screen_x
|
self.x = next_touch.x
|
||||||
self.screen_y = next_touch.screen_y
|
self.y = next_touch.y
|
||||||
self.touch_id = next_touch.id
|
self.touch_id = next_touch.id
|
||||||
else
|
else
|
||||||
end_touch(self)
|
end_touch(self)
|
||||||
@ -116,8 +118,8 @@ function M.init(self, node, on_drag_callback)
|
|||||||
self.dx = 0
|
self.dx = 0
|
||||||
self.dy = 0
|
self.dy = 0
|
||||||
self.touch_id = 0
|
self.touch_id = 0
|
||||||
self.screen_x = 0
|
self.x = 0
|
||||||
self.screen_y = 0
|
self.y = 0
|
||||||
self.is_touch = false
|
self.is_touch = false
|
||||||
self.is_drag = false
|
self.is_drag = false
|
||||||
self.touch_start_pos = vmath.vector3(0)
|
self.touch_start_pos = vmath.vector3(0)
|
||||||
@ -185,13 +187,13 @@ function M.on_input(self, action_id, action)
|
|||||||
|
|
||||||
local touch_modified = find_touch(action_id, action, self.touch_id)
|
local touch_modified = find_touch(action_id, action, self.touch_id)
|
||||||
if touch_modified and self.is_drag then
|
if touch_modified and self.is_drag then
|
||||||
self.dx = touch_modified.screen_x - self.screen_x
|
self.dx = touch_modified.x - self.x
|
||||||
self.dy = touch_modified.screen_y - self.screen_y
|
self.dy = touch_modified.y - self.y
|
||||||
end
|
end
|
||||||
|
|
||||||
if touch_modified then
|
if touch_modified then
|
||||||
self.screen_x = touch_modified.screen_x
|
self.x = touch_modified.x
|
||||||
self.screen_y = touch_modified.screen_y
|
self.y = touch_modified.y
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.is_drag then
|
if self.is_drag then
|
||||||
|
@ -22,7 +22,7 @@ local function on_scroll_drag(self, dx, dy)
|
|||||||
dy = -dy
|
dy = -dy
|
||||||
local t = self.target_pos
|
local t = self.target_pos
|
||||||
local b = self.available_soft_pos
|
local b = self.available_soft_pos
|
||||||
local soft = 100
|
local extra_size = self.style.EXTRA_STRECH_SIZE
|
||||||
|
|
||||||
-- Handle soft zones
|
-- Handle soft zones
|
||||||
-- Percent - multiplier for delta. Less if outside of scroll zone
|
-- Percent - multiplier for delta. Less if outside of scroll zone
|
||||||
@ -30,10 +30,10 @@ local function on_scroll_drag(self, dx, dy)
|
|||||||
local y_perc = 1
|
local y_perc = 1
|
||||||
|
|
||||||
if t.x < b.x and dx < 0 then
|
if t.x < b.x and dx < 0 then
|
||||||
x_perc = (soft - (b.x - t.x)) / soft
|
x_perc = (-extra_size.x - (b.x - t.x)) / -extra_size.x
|
||||||
end
|
end
|
||||||
if t.x > b.z and dx > 0 then
|
if t.x > b.z and dx > 0 then
|
||||||
x_perc = (soft - (t.x - b.z)) / soft
|
x_perc = (extra_size.z - (t.x - b.z)) / extra_size.z
|
||||||
end
|
end
|
||||||
-- If disabled scroll by x
|
-- If disabled scroll by x
|
||||||
if not self.can_x then
|
if not self.can_x then
|
||||||
@ -41,24 +41,16 @@ local function on_scroll_drag(self, dx, dy)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if t.y > b.y and dy < 0 then
|
if t.y > b.y and dy < 0 then
|
||||||
y_perc = (soft - (t.y - b.y)) / soft
|
y_perc = (extra_size.y - (t.y - b.y)) / extra_size.y
|
||||||
end
|
end
|
||||||
if t.y < b.w and dy > 0 then
|
if t.y < b.w and dy > 0 then
|
||||||
y_perc = (soft - (b.w - t.y)) / soft
|
y_perc = (-extra_size.w - (b.w - t.y)) / -extra_size.w
|
||||||
end
|
end
|
||||||
-- If disabled scroll by y
|
-- If disabled scroll by y
|
||||||
if not self.can_y then
|
if not self.can_y then
|
||||||
y_perc = 0
|
y_perc = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Reset inert if outside of scroll zone
|
|
||||||
if x_perc ~= 1 then
|
|
||||||
self.inertion.x = 0
|
|
||||||
end
|
|
||||||
if y_perc ~= 1 then
|
|
||||||
self.inertion.y = 0
|
|
||||||
end
|
|
||||||
|
|
||||||
t.x = t.x + dx * x_perc
|
t.x = t.x + dx * x_perc
|
||||||
t.y = t.y - dy * y_perc
|
t.y = t.y - dy * y_perc
|
||||||
end
|
end
|
||||||
@ -79,21 +71,8 @@ local function update_hand_scroll(self, dt)
|
|||||||
local dx = self.target_pos.x - self.current_pos.x
|
local dx = self.target_pos.x - self.current_pos.x
|
||||||
local dy = self.target_pos.y - self.current_pos.y
|
local dy = self.target_pos.y - self.current_pos.y
|
||||||
|
|
||||||
if helper.sign(dx) ~= helper.sign(self.inertion.x) then
|
self.inertion.x = (self.inertion.x + dx) * self.style.FRICT_HOLD
|
||||||
self.inertion.x = 0
|
self.inertion.y = (self.inertion.y + dy) * self.style.FRICT_HOLD
|
||||||
end
|
|
||||||
if helper.sign(dy) ~= helper.sign(self.inertion.y) then
|
|
||||||
self.inertion.y = 0
|
|
||||||
end
|
|
||||||
|
|
||||||
self.inertion.x = self.inertion.x + dx
|
|
||||||
self.inertion.y = self.inertion.y + dy
|
|
||||||
|
|
||||||
self.inertion.x = math.abs(self.inertion.x) * helper.sign(dx)
|
|
||||||
self.inertion.y = math.abs(self.inertion.y) * helper.sign(dy)
|
|
||||||
|
|
||||||
self.inertion.x = self.inertion.x * self.style.FRICT_HOLD
|
|
||||||
self.inertion.y = self.inertion.y * self.style.FRICT_HOLD
|
|
||||||
|
|
||||||
set_pos(self, self.target_pos)
|
set_pos(self, self.target_pos)
|
||||||
end
|
end
|
||||||
@ -119,8 +98,10 @@ end
|
|||||||
|
|
||||||
|
|
||||||
local function check_threshold(self)
|
local function check_threshold(self)
|
||||||
if vmath.length(self.inertion) < self.style.INERT_THRESHOLD then
|
if math.abs(self.inertion.x) < self.style.INERT_THRESHOLD then
|
||||||
self.inertion.x = 0
|
self.inertion.x = 0
|
||||||
|
end
|
||||||
|
if math.abs(self.inertion.y) < self.style.INERT_THRESHOLD then
|
||||||
self.inertion.y = 0
|
self.inertion.y = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -221,7 +202,7 @@ function M.init(self, view_zone, content_zone)
|
|||||||
|
|
||||||
self.current_pos = gui.get_position(self.content_node)
|
self.current_pos = gui.get_position(self.content_node)
|
||||||
self.target_pos = vmath.vector3(self.current_pos)
|
self.target_pos = vmath.vector3(self.current_pos)
|
||||||
self.inertion = vmath.vector3()
|
self.inertion = vmath.vector3(0)
|
||||||
|
|
||||||
self.drag = self.druid:new_drag(view_zone, on_scroll_drag)
|
self.drag = self.druid:new_drag(view_zone, on_scroll_drag)
|
||||||
self.drag.on_touch_start:subscribe(on_touch_start)
|
self.drag.on_touch_start:subscribe(on_touch_start)
|
||||||
|
@ -52,14 +52,14 @@ M["scroll"] = {
|
|||||||
ANIM_SPEED = 0.3, -- gui.animation speed to point
|
ANIM_SPEED = 0.3, -- gui.animation speed to point
|
||||||
SCROLL_WHEEL_SPEED = 10,
|
SCROLL_WHEEL_SPEED = 10,
|
||||||
|
|
||||||
FRICT = 0.93, -- mult for free inert
|
FRICT = 0.94, -- mult for free inert
|
||||||
FRICT_HOLD = 0.8, -- mult. for inert, while touching
|
FRICT_HOLD = 0.75, -- mult. for inert, while touching
|
||||||
INERT_THRESHOLD = 2, -- speed to stop inertion
|
INERT_THRESHOLD = 2, -- speed to stop inertion
|
||||||
INERT_SPEED = 25, -- koef. of inert speed
|
INERT_SPEED = 27, -- koef. of inert speed
|
||||||
EXTRA_STRECH_SIZE = vmath.vector4(-100, 100, 100, -100), -- size of outside zone (back move)
|
|
||||||
|
|
||||||
BACK_SPEED = 0.2, -- lerp speed
|
BACK_SPEED = 0.35, -- Lerp speed of return to soft position
|
||||||
LERP_SPEED = 1,
|
|
||||||
|
EXTRA_STRECH_SIZE = vmath.vector4(-100, 100, 100, -100), -- size of outside zone (back move)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ nodes {
|
|||||||
nodes {
|
nodes {
|
||||||
position {
|
position {
|
||||||
x: 0.0
|
x: 0.0
|
||||||
y: 1200.0
|
y: 450.0
|
||||||
z: 0.0
|
z: 0.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
@ -2882,7 +2882,7 @@ nodes {
|
|||||||
nodes {
|
nodes {
|
||||||
position {
|
position {
|
||||||
x: 0.0
|
x: 0.0
|
||||||
y: -1890.0
|
y: -890.0
|
||||||
z: 0.0
|
z: 0.0
|
||||||
w: 1.0
|
w: 1.0
|
||||||
}
|
}
|
||||||
@ -3225,179 +3225,6 @@ nodes {
|
|||||||
text_leading: 1.0
|
text_leading: 1.0
|
||||||
text_tracking: 0.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 {
|
nodes {
|
||||||
position {
|
position {
|
||||||
x: 600.0
|
x: 600.0
|
||||||
@ -6962,6 +6789,179 @@ nodes {
|
|||||||
text_leading: 1.0
|
text_leading: 1.0
|
||||||
text_tracking: 0.0
|
text_tracking: 0.0
|
||||||
}
|
}
|
||||||
|
nodes {
|
||||||
|
position {
|
||||||
|
x: 0.0
|
||||||
|
y: -1400.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: 550.0
|
||||||
|
y: 500.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: "scroll_smaller_view"
|
||||||
|
xanchor: XANCHOR_NONE
|
||||||
|
yanchor: YANCHOR_NONE
|
||||||
|
pivot: PIVOT_CENTER
|
||||||
|
adjust_mode: ADJUST_MODE_FIT
|
||||||
|
parent: "scroll_page_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: 0.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: 200.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: "scroll_smaller_content"
|
||||||
|
xanchor: XANCHOR_NONE
|
||||||
|
yanchor: YANCHOR_NONE
|
||||||
|
pivot: PIVOT_CENTER
|
||||||
|
adjust_mode: ADJUST_MODE_FIT
|
||||||
|
parent: "scroll_smaller_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: 0.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: "scroll_smaller_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 {
|
nodes {
|
||||||
position {
|
position {
|
||||||
x: 2400.0
|
x: 2400.0
|
||||||
|
@ -21,12 +21,8 @@ local pages = {
|
|||||||
|
|
||||||
local function on_control_button(self, delta)
|
local function on_control_button(self, delta)
|
||||||
self.page = self.page + delta
|
self.page = self.page + delta
|
||||||
if self.page < 1 then
|
self.page = math.max(1, self.page)
|
||||||
self.page = #pages
|
self.page = math.min(self.page, #pages)
|
||||||
end
|
|
||||||
if self.page > #pages then
|
|
||||||
self.page = 1
|
|
||||||
end
|
|
||||||
|
|
||||||
self.header:translate(pages[self.page])
|
self.header:translate(pages[self.page])
|
||||||
local node = gui.get_node("C_Anchor")
|
local node = gui.get_node("C_Anchor")
|
||||||
|
@ -98,7 +98,6 @@ end
|
|||||||
|
|
||||||
local function setup_scroll(self)
|
local function setup_scroll(self)
|
||||||
self.druid:new_scroll("main_page", "scroll_content")
|
self.druid:new_scroll("main_page", "scroll_content")
|
||||||
self.scroll = self.druid:new_scroll("scroll2_view", "scroll2_content")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,6 +47,8 @@ function M.setup_page(self)
|
|||||||
self.druid:new_scroll("children_scroll_2", "children_scroll_content_2")
|
self.druid:new_scroll("children_scroll_2", "children_scroll_content_2")
|
||||||
self.druid:new_scroll("children_scroll_3", "children_scroll_content_3")
|
self.druid:new_scroll("children_scroll_3", "children_scroll_content_3")
|
||||||
|
|
||||||
|
self.druid:new_scroll("scroll_smaller_view", "scroll_smaller_content")
|
||||||
|
|
||||||
init_grid(self)
|
init_grid(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user