Create CirclePoster to address MaskGroup not scaling with resolution

This commit is contained in:
Brahim Hadriche committed 2023-09-17 11:47:09 -04:00
1 parent 6e84809923
commit d99151ff21
4 files changed
+58 -18

No files matched your search

@@ -0,0 +1,24 @@
function Init()
m.top.poster = m.top.findNode("Poster")
m.top.maskGroup = m.top.findNode("MaskGroup")
end function
function UpdateMaskSize()
width = m.top.poster.width
height = m.top.poster.height
maskSize = [width * GetScaleFactor(), height * GetScaleFactor()]
m.top.maskGroup.maskSize = maskSize
end function
' MaskGroup component do not scale with with UI resolution
function GetScaleFactor() as float
if m.scaleFactor <> invalid
return m.scaleFactor
end if
deviceInfo = CreateObject("roDeviceInfo")
uiResolutionWidth = deviceInfo.GetUIResolution().width
' divide by 1280 because we have ui_resolutions=hd in manifest
m.scaleFactor = uiResolutionWidth / 1280
return m.scaleFactor
end function