Tweaked list theming

This commit is contained in:
Sasha Koshka 2023-04-21 17:49:27 -04:00
parent 1c0dee1b95
commit fc4b2eb36d
2 changed files with 3 additions and 1 deletions

View File

@ -276,6 +276,8 @@ func (Default) Padding (id tomo.Pattern, c tomo.Case) artist.Inset {
case tomo.PatternSunken: case tomo.PatternSunken:
if c.Match("tomo", "progressBar", "") { if c.Match("tomo", "progressBar", "") {
return artist.I(2, 1, 1, 2) return artist.I(2, 1, 1, 2)
} else if c.Match("tomo", "list", "") {
return artist.I(2)
} else { } else {
return artist.I(8) return artist.I(8)
} }

View File

@ -284,7 +284,7 @@ func (element *List) selectNone () {
func (element *List) scrollToSelected () { func (element *List) scrollToSelected () {
if element.selected < 0 { return } if element.selected < 0 { return }
target := element.entity.Child(element.selected).Entity().Bounds() target := element.entity.Child(element.selected).Entity().Bounds()
padding := element.theme.Padding(tomo.PatternBackground) padding := element.theme.Padding(tomo.PatternSunken)
bounds := padding.Apply(element.entity.Bounds()) bounds := padding.Apply(element.entity.Bounds())
if target.Min.Y < bounds.Min.Y { if target.Min.Y < bounds.Min.Y {
element.scroll.Y -= bounds.Min.Y - target.Min.Y element.scroll.Y -= bounds.Min.Y - target.Min.Y