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

@@ -152,4 +152,32 @@ function M.get_pivot_offset(pivot)
end
--- Check if device is mobile (Android or iOS)
-- @function helper..is_mobile
function M.is_mobile()
local system_name = sys.get_sys_info().system_name
return system_name == const.OS.IOS or system_name == const.OS.ANDROID
end
--- Check if device is HTML5
-- @function helper.is_web
function M.is_web()
local system_name = sys.get_sys_info().system_name
return system_name == const.OS.BROWSER
end
function M.get_border(node)
local pivot = gui.get_pivot(node)
local pivot_offset = M.get_pivot_offset(pivot)
local size = vmath.mul_per_elem(gui.get_size(node), gui.get_scale(node))
return vmath.vector4(
-size.x*(0.5 - pivot_offset.x),
size.y*(0.5 + pivot_offset.y),
size.x*(0.5 + pivot_offset.x),
-size.y*(0.5 - pivot_offset.y)
)
end
return M