mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 18:12:19 +02:00
Scroll refactoring process
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user