diff options
author | Richard Linden <none@none> | 2012-03-06 16:49:58 -0800 |
---|---|---|
committer | Richard Linden <none@none> | 2012-03-06 16:49:58 -0800 |
commit | 93aa231a18b9b5c9b3ab2ff162fa4928ac60d62b (patch) | |
tree | 196229dfd76340cdbd3efc1e0b01d6f8883f0d1a /indra/llui/lllayoutstack.cpp | |
parent | d3f1c6d77f0415d40a2eed6b62c98dbdb930689d (diff) |
EXP-1767 WIP Received Items panel state does not persist between sessions
ensure that layout stack has updated its layout before manually resizing one of its elements
(which was causing the manual resize to be stomped on by the newly triggered layout update)
made layout stack animation occur even when layout stack not visible (inventory will appear in proper open/closed state)
LLView::setShape() now only calls handleReshape() when dimensions change
removed extraneous calls to LLLayoutStack::updateClass() so that it should be called only
once per frame now, allowing it to limit animation updates to layout stacks to one per frame.
fixed rendering glitches arising from reshaping LLFolderView while in the middle of its draw() method
Diffstat (limited to 'indra/llui/lllayoutstack.cpp')
-rw-r--r-- | indra/llui/lllayoutstack.cpp | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index ae262f794e..988595f72a 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -172,12 +172,15 @@ void LLLayoutPanel::handleReshape(const LLRect& new_rect, bool by_user) LLLayoutStack* stackp = dynamic_cast<LLLayoutStack*>(getParent()); if (stackp) { - stackp->mNeedsLayout = true; if (by_user) - { - // tell layout stack to account for new shape + { // tell layout stack to account for new shape + + // make sure that panels have already been auto resized + stackp->updateLayout(); + // now apply requested size to panel stackp->updatePanelRect(this, new_rect); } + stackp->mNeedsLayout = true; } LLPanel::handleReshape(new_rect, by_user); } @@ -241,7 +244,6 @@ void LLLayoutStack::draw() drawChild(panelp, 0, 0, !clip_rect.isEmpty()); } } - mAnimatedThisFrame = false; } void LLLayoutStack::removeChild(LLView* view) @@ -310,7 +312,7 @@ void LLLayoutStack::updateLayout() if (!mNeedsLayout) return; - bool animation_in_progress = animatePanels(); + bool continue_animating = animatePanels(); F32 total_visible_fraction = 0.f; S32 space_to_distribute = (mOrientation == HORIZONTAL) ? getRect().getWidth() @@ -415,7 +417,7 @@ void LLLayoutStack::updateLayout() // clear animation flag at end, since panel resizes will set it // and leave it set if there is any animation in progress - mNeedsLayout = animation_in_progress; + mNeedsLayout = continue_animating; } // end LLLayoutStack::updateLayout LLLayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const @@ -488,6 +490,7 @@ void LLLayoutStack::updateClass() for (instance_iter it = beginInstances(); it != endInstances(); ++it) { it->updateLayout(); + it->mAnimatedThisFrame = false; } } @@ -557,7 +560,7 @@ void LLLayoutStack::normalizeFractionalSizes() bool LLLayoutStack::animatePanels() { - bool animation_in_progress = false; + bool continue_animating = false; // // animate visibility @@ -577,14 +580,15 @@ bool LLLayoutStack::animatePanels() } } - animation_in_progress = true; + mAnimatedThisFrame = true; + continue_animating = true; } else { if (panelp->mVisibleAmt != 1.f) { panelp->mVisibleAmt = 1.f; - animation_in_progress = true; + mAnimatedThisFrame = true; } } } @@ -601,14 +605,15 @@ bool LLLayoutStack::animatePanels() } } - animation_in_progress = true; + continue_animating = true; + mAnimatedThisFrame = true; } else { if (panelp->mVisibleAmt != 0.f) { panelp->mVisibleAmt = 0.f; - animation_in_progress = true; + mAnimatedThisFrame = true; } } } @@ -616,22 +621,31 @@ bool LLLayoutStack::animatePanels() F32 collapse_state = panelp->mCollapsed ? 1.f : 0.f; if (panelp->mCollapseAmt != collapse_state) { - if (!mAnimatedThisFrame) + if (mAnimate) { - panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLCriticalDamp::getInterpolant(mCloseTimeConstant)); - } - animation_in_progress = true; + if (!mAnimatedThisFrame) + { + panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLCriticalDamp::getInterpolant(mCloseTimeConstant)); + } - if (llabs(panelp->mCollapseAmt - collapse_state) < 0.001f) + if (llabs(panelp->mCollapseAmt - collapse_state) < 0.001f) + { + panelp->mCollapseAmt = collapse_state; + } + + mAnimatedThisFrame = true; + continue_animating = true; + } + else { panelp->mCollapseAmt = collapse_state; + mAnimatedThisFrame = true; } } } - mAnimatedThisFrame = true; - - return animation_in_progress; + if (mAnimatedThisFrame) mNeedsLayout = true; + return continue_animating; } void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect& new_rect ) |