Skip to content

Commit

Permalink
Fixed|UI|Home: Check visible columns when resizing the window
Browse files Browse the repository at this point in the history
Fixes the problem where the scroll position would extend into blank
space on the right when making the window larger.
  • Loading branch information
skyjake committed Jul 18, 2016
1 parent 2612c3d commit cfd5a9d
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions doomsday/apps/client/src/ui/home/homewidget.cpp
Expand Up @@ -321,9 +321,9 @@ DENG_GUI_PIMPL(HomeWidget)

void calculateColumnCount()
{
visibleColumnCount = de::min(de::max(1, self.rule().width().valuei() /
rule("home.column.width").valuei()),
int(tabs->items().size()));
visibleColumnCount = de::min(de::max(dsize(1), dsize(self.rule().width().valuei() /
rule("home.column.width").valuei())),
tabs->items().size());
}

void updateLayout()
Expand All @@ -346,7 +346,20 @@ DENG_GUI_PIMPL(HomeWidget)
}
}
}

updateHighlightedTab();

// Make sure we stay within the valid range.
if (visibleTabRange().end >= columns.size())
{
currentOffsetTab = columns.size() - int(visibleColumnCount);
setScrollOffset(currentOffsetTab, 0.0);
}
if (!visibleTabRange().contains(int(tabs->current())))
{
currentOffsetTab = int(tabs->current());
setScrollOffset(currentOffsetTab, 0.0);
}
}

Rangei visibleTabRange() const
Expand Down

0 comments on commit cfd5a9d

Please sign in to comment.