Switch to letting roku scale the Poster Image with scaleToFit

This commit is contained in:
Neil Burrows 2022-04-19 17:50:34 +01:00
parent 1fe6fd06f3
commit 5e2ebba8f6
2 changed files with 8 additions and 20 deletions

View File

@ -30,31 +30,19 @@ sub updateSize()
' Always reserve the bottom for the Poster Title ' Always reserve the bottom for the Poster Title
m.title.maxWidth = maxSize[0] m.title.maxWidth = maxSize[0]
m.title.height = 70 m.title.height = 40
m.title.translation = [0, int(maxSize[1]) - (m.title.height-30)] m.title.translation = [0, int(maxSize[1]) - m.title.height + 5]
print "[0," int(maxSize[1]) - m.title.height"]" print "[0," int(maxSize[1]) - m.title.height"]"
m.staticTitle.width = maxSize[0] m.staticTitle.width = maxSize[0]
m.staticTitle.height = 70 m.staticTitle.height = m.title.height
m.staticTitle.translation = [0, int(maxSize[1]) - (m.title.height-30)] m.staticTitle.translation = m.title.translation
ratio = 1.5
if image <> invalid and image.width <> 0 and image.height <> 0
ratio = image.height / image.width
end if
m.poster.width = int(maxSize[0]) - 4 m.poster.width = int(maxSize[0]) - 4
m.poster.height = m.poster.width * ratio m.poster.height = int(maxSize[1]) - m.title.height 'Set poster height to available space
posterVertSpace = int(maxSize[1]) - m.title.height - 20
if m.poster.height > posterVertSpace
' Do a thing to shrink the image if it is too tall
end if
m.poster.translation = [2, (posterVertSpace - m.poster.height) / 3]
m.backdrop.translation = [2, (posterVertSpace - m.poster.height) / 2]
m.backdrop.width = m.poster.width m.backdrop.width = m.poster.width
m.backdrop.height = m.poster.height m.backdrop.height = m.poster.height

View File

@ -2,7 +2,7 @@
<component name="ListPoster" extends="Group"> <component name="ListPoster" extends="Group">
<children> <children>
<Rectangle id="backdrop" /> <Rectangle id="backdrop" />
<Poster id="poster" translation="[2, 25]" /> <Poster id="poster" translation="[2,0]" loadDisplayMode="scaleToFit" />
<ScrollingLabel id="title" <ScrollingLabel id="title"
horizAlign="center" horizAlign="center"
font="font:SmallSystemFont" font="font:SmallSystemFont"