Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 21 additions & 18 deletions components/home/HomeRows.bs
Original file line number Diff line number Diff line change
Expand Up @@ -148,27 +148,30 @@ sub updateSize()
'Set width of Rows to cut off at edge of Safe Zone
m.top.itemSize = [1703, itemHeight]

' spacing between rows (modern reserves space for the focused card info block)
if isModernHomeRows()
' The stored pixel value doesn't map 1:1 to row spacing, so it gets scaled below
modernRows = isModernHomeRows()
if modernRows
paddingKey = "ui.home.modernRowsPadding"
compactSpacing = 360
spaciousSpacing = 560
defaultSpacing = 460
minPadding = 360
maxPadding = 560
defaultPadding = 460
else
paddingKey = "ui.home.classicRowsPadding"
compactSpacing = 10
spaciousSpacing = 90
defaultSpacing = 30
end if

' Padding arrives as either a pixel value or a named preset
padding = m.global.session.user.settings[paddingKey]
paddingStr = isValid(padding) ? padding.ToStr() : ""
verticalSpacing = Val(paddingStr)
if verticalSpacing <= 0
if isStringEqual(paddingStr, "compact") then verticalSpacing = compactSpacing
if isStringEqual(paddingStr, "spacious") then verticalSpacing = spaciousSpacing
if verticalSpacing <= 0 then verticalSpacing = defaultSpacing
minPadding = 10
maxPadding = 130
defaultPadding = 30
end if

' A stored value isn't guaranteed to be a number in range, and the formula turns anything
' below the minimum into zero or negative spacing, so fall back instead
storedPadding = m.global.session.user.settings[paddingKey]
padding = Val(isValid(storedPadding) ? storedPadding.ToStr() : "")
if padding < minPadding or padding > maxPadding then padding = defaultPadding

if modernRows
verticalSpacing = (padding - 200) * (padding / 360)
else
verticalSpacing = padding * 2
end if

m.top.itemSpacing = [0, verticalSpacing]
Expand Down
84 changes: 42 additions & 42 deletions settings/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,48 +334,6 @@
"type": "bool",
"default": "false"
},
{
"title": "Classic Layout Home Rows Padding",
"description": "Adjust vertical padding between home screen rows in classic layout",
"settingName": "ui.home.classicRowsPadding",
"type": "radio",
"default": "30",
"options": [
{ "title": "10 px", "id": "10" },
{ "title": "20 px", "id": "20" },
{ "title": "30 px (Default)", "id": "30" },
{ "title": "40 px", "id": "40" },
{ "title": "50 px", "id": "50" },
{ "title": "60 px", "id": "60" },
{ "title": "70 px", "id": "70" },
{ "title": "80 px", "id": "80" },
{ "title": "90 px", "id": "90" },
{ "title": "100 px", "id": "100" },
{ "title": "110 px", "id": "110" },
{ "title": "120 px", "id": "120" },
{ "title": "130 px", "id": "130" }
]
},
{
"title": "Modern Layout Home Rows Padding",
"description": "Adjust vertical padding between home screen rows in modern layout",
"settingName": "ui.home.modernRowsPadding",
"type": "radio",
"default": "460",
"options": [
{ "title": "360 px", "id": "360" },
{ "title": "380 px", "id": "380" },
{ "title": "400 px", "id": "400" },
{ "title": "420 px", "id": "420" },
{ "title": "440 px", "id": "440" },
{ "title": "460 px (Default)", "id": "460" },
{ "title": "480 px", "id": "480" },
{ "title": "500 px", "id": "500" },
{ "title": "520 px", "id": "520" },
{ "title": "540 px", "id": "540" },
{ "title": "560 px", "id": "560" }
]
},
{
"title": "Recommendation Engine Source",
"description": "Select the recommendation engine source for home screen recommendations",
Expand Down Expand Up @@ -884,6 +842,48 @@
}
]
},
{
"title": "Classic Layout Home Rows Padding",
"description": "Adjust vertical padding between home screen rows in classic layout",
"settingName": "ui.home.classicRowsPadding",
"type": "radio",
"default": "30",
"options": [
{ "title": "10 px", "id": "10" },
{ "title": "20 px", "id": "20" },
{ "title": "30 px (Default)", "id": "30" },
{ "title": "40 px", "id": "40" },
{ "title": "50 px", "id": "50" },
{ "title": "60 px", "id": "60" },
{ "title": "70 px", "id": "70" },
{ "title": "80 px", "id": "80" },
{ "title": "90 px", "id": "90" },
{ "title": "100 px", "id": "100" },
{ "title": "110 px", "id": "110" },
{ "title": "120 px", "id": "120" },
{ "title": "130 px", "id": "130" }
]
},
{
"title": "Modern Layout Home Rows Padding",
"description": "Adjust vertical padding between home screen rows in modern layout",
"settingName": "ui.home.modernRowsPadding",
"type": "radio",
"default": "460",
"options": [
{ "title": "360 px", "id": "360" },
{ "title": "380 px", "id": "380" },
{ "title": "400 px", "id": "400" },
{ "title": "420 px", "id": "420" },
{ "title": "440 px", "id": "440" },
{ "title": "460 px (Default)", "id": "460" },
{ "title": "480 px", "id": "480" },
{ "title": "500 px", "id": "500" },
{ "title": "520 px", "id": "520" },
{ "title": "540 px", "id": "540" },
{ "title": "560 px", "id": "560" }
]
},
{
"title": "Since You Watched Rows Settings",
"description": "Customize the Since You Watched rows.",
Expand Down