Resize item poster base on alpha/grid focus

This commit is contained in:
candry7731 2022-06-03 00:25:00 -05:00
parent 9c33c6b580
commit 8e0493de7d
3 changed files with 17 additions and 8 deletions

View File

@ -17,16 +17,16 @@ sub init()
if m.alwaysShowTitles then m.itemText.maxWidth = 250
'Parent is MarkupGrid and it's parent is the ItemGrid
topParent = m.top.GetParent().GetParent()
m.topParent = m.top.GetParent().GetParent()
'Get the imageDisplayMode for these grid items
if topParent.imageDisplayMode <> invalid
m.itemPoster.loadDisplayMode = topParent.imageDisplayMode
if m.topParent.imageDisplayMode <> invalid
m.itemPoster.loadDisplayMode = m.topParent.imageDisplayMode
end if
end sub
sub itemContentChanged()
' Set Random background colors from pallet
posterBackgrounds = m.global.constants.poster_bg_pallet
m.backdrop.blendColor = posterBackgrounds[rnd(posterBackgrounds.count()) - 1]
@ -74,20 +74,26 @@ end sub
'
'Use FocusPercent to animate scaling of Poser Image
sub focusChanging()
scaleFactor = 0.85 + (m.top.focusPercent * 0.15)
m.posterMask.scale = [scaleFactor, scaleFactor]
if m.topParent.alphaActive = "true"
m.posterMask.scale = [0.85, 0.85]
else
scaleFactor = 0.85 + (m.top.focusPercent * 0.15)
m.posterMask.scale = [scaleFactor, scaleFactor]
end if
end sub
'
'Display or hide title Visibility on focus change
sub focusChanged()
if m.top.itemHasFocus = true
m.itemText.visible = true
m.itemText.repeatCount = -1
scaleFactor = 0.85 + (m.top.focusPercent * 0.15)
m.posterMask.scale = [scaleFactor, scaleFactor]
else
m.itemText.visible = m.alwaysShowTitles
m.itemText.repeatCount = 0
m.posterMask.scale = [0.85, 0.85]
end if
end sub

View File

@ -255,7 +255,7 @@ end sub
'
'Handle loaded data, and add to Grid
sub ItemDataLoaded(msg)
m.top.alphaActive = "false"
itemData = msg.GetData()
m.loadItemsTask.unobserveField("content")
m.loadItemsTask.content = []
@ -530,11 +530,13 @@ function onKeyEvent(key as string, press as boolean) as boolean
topGrp.setFocus(false)
alpha = m.Alpha.getChild(0).findNode("Alphamenu")
alpha.setFocus(true)
m.top.alphaActive = "true"
return true
else if key = "right" and m.Alpha.isinFocusChain()
m.Alpha.setFocus(false)
m.Alpha.visible = true
topGrp.setFocus(true)
m.top.alphaActive = "false"
return true
end if
return false

View File

@ -39,6 +39,7 @@
<field id="quickPlayNode" type="node" alwaysNotify="true" />
<field id="imageDisplayMode" type="string" value="scaleToZoom" />
<field id="AlphaSelected" type="string" alias="AlphaMenu.itemAlphaSelected" alwaysNotify="true" onChange="onItemAlphaSelected" />
<field id="alphaActive" type="string" value="false" />
</interface>
<script type="text/brightscript" uri="pkg:/source/utils/misc.brs" />
<script type="text/brightscript" uri="pkg:/source/utils/config.brs" />