Skip to content

Commit

Permalink
Client|Console: Improved log widget behavior
Browse files Browse the repository at this point in the history
When opening the log for the first time, don't waste time scrolling
through all the messages since launch. Instead, open as normally with
a clear log.

The problem was that the log wrapper wasn't told the width of the
widget until it was drawn (visible) for the first time.
  • Loading branch information
skyjake committed Jul 23, 2013
1 parent 0ce7916 commit c257b0f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions doomsday/client/src/ui/widgets/consolewidget.cpp
Expand Up @@ -88,7 +88,7 @@ DENG2_PIMPL(ConsoleWidget)
}

void expandLog(int delta, bool useOffsetAnimation)
{
{
// Cannot expand if the user is grabbing the top edge.
if(grabbed == TopEdge) return;

Expand All @@ -103,7 +103,7 @@ DENG2_PIMPL(ConsoleWidget)
height->setStyle(style);
height->set(height->animation().target() + delta, .25f);

if(useOffsetAnimation)
if(useOffsetAnimation && opened)
{
// Sync the log content with the height animation.
log->setContentYOffset(Animation::range(style,
Expand Down
2 changes: 1 addition & 1 deletion doomsday/client/src/ui/widgets/logwidget.cpp
Expand Up @@ -858,6 +858,7 @@ void LogWidget::update()
{
ScrollAreaWidget::update();

d->sink.setWidth(d->contentWidth());
d->fetchNewCachedEntries();

// The log widget's geometry is fully dynamic -- regenerated on every frame.
Expand All @@ -866,7 +867,6 @@ void LogWidget::update()

void LogWidget::drawContent()
{
d->sink.setWidth(d->contentWidth());
d->draw();
}

Expand Down

0 comments on commit c257b0f

Please sign in to comment.