Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit b9a8e75

Browse files
committed
[[ Tutorial ]] Try to load smaller image on smaller screens
Look for a file 'imgName'_small.'imgExtension' if the height of the tutorial stack's screen is <= 1080
1 parent 5680dc9 commit b9a8e75

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

Toolset/palettes/tutorial/revtutorial.livecodescript

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2124,7 +2124,7 @@ on revTutorialConfigureMessage pData
21242124
local tImageFile
21252125
if pData["image"] is not empty then
21262126
local tImageWidth
2127-
put revIDETutorialInternalResource(pData["image"]) into tImageFile
2127+
put revTutorialImageForScreenSize(pData["image"]) into tImageFile
21282128
set the filename of image "Image" of stack "revTutorial" to tImageFile
21292129
put the formattedWidth of image "Image" of stack "revTutorial" + 2 * kMargin into tImageWidth
21302130
put max(tWidthOverride, tImageWidth) into tWidthOverride
@@ -2162,6 +2162,23 @@ on revTutorialConfigureMessage pData
21622162
revTutorialPositionStack "", "", tWidthOverride, false
21632163
end revTutorialConfigureMessage
21642164

2165+
function revTutorialImageForScreenSize pImage
2166+
local tScreen, tScreenRect
2167+
put the screen of stack "revTutorial" into tScreen
2168+
put line tScreen of the the screenrects into tScreenRect
2169+
if item 4 of tScreenRect - item 2 of tScreenRect <= 1080 then
2170+
local tSmallImage, tFile
2171+
put pImage into tSmallImage
2172+
set the itemdelimiter to "."
2173+
put "_small" after item -2 of tSmallImage
2174+
put revIDETutorialInternalResource(tSmallImage) into tFile
2175+
if there is a file tFile then
2176+
return tFile
2177+
end if
2178+
end if
2179+
return revIDETutorialInternalResource(pImage)
2180+
end revTutorialImageForScreenSize
2181+
21652182
function revTutorialScriptRetry pCurrent
21662183
local tText
21672184
put "Your script is not quite right. You have:" & return & return after tText

0 commit comments

Comments
 (0)