diff options
| author | Nick Dedekind <nicholas.dedekind@gmail.com> | 2012-09-11 13:47:51 -0400 |
|---|---|---|
| committer | Tarmac <> | 2012-09-11 13:47:51 -0400 |
| commit | cbbc728bb64f7a312df9b2ec9b934cc7c89fc0ac (patch) | |
| tree | 190358868aa9c477b43195eeeac83725b11c2919 /dash | |
| parent | 33581c91eefa0edb221e6babc0d7dfc76cb54906 (diff) | |
| parent | 03aacd1d6d2f16294a8039a1bf5c6de6517dd801 (diff) | |
Fixed a layout flicker when first opening previews (LP#1038944).. Fixes: https://bugs.launchpad.net/bugs/1038944, https://bugs.launchpad.net/bugs/1043277. Approved by Michal Hruby, Brandon Schaefer.
(bzr r2680)
Diffstat (limited to 'dash')
| -rw-r--r-- | dash/previews/PreviewContainer.cpp | 71 |
1 files changed, 43 insertions, 28 deletions
diff --git a/dash/previews/PreviewContainer.cpp b/dash/previews/PreviewContainer.cpp index 54cc3bf99..eabed9d20 100644 --- a/dash/previews/PreviewContainer.cpp +++ b/dash/previews/PreviewContainer.cpp @@ -62,6 +62,7 @@ public: PreviewContent(PreviewContainer*const parent) : parent_(parent) , progress_(0.0) + , curve_progress_(0.0) , animating_(false) , waiting_preview_(false) , rotation_(0.0) @@ -69,6 +70,11 @@ public: , nav_complete_(0) , relative_nav_index_(0) { + OnGeometryChanged.connect([&](nux::Area*, nux::Geometry& geo) + { + // Need to update the preview geometries when updating the container geo. + UpdateAnimationProgress(progress_, curve_progress_); + }); Style& style = previews::Style::Instance(); spin_= style.GetSearchSpinIcon(256); @@ -98,6 +104,9 @@ public: if (preview) { + // the parents layout will not change based on the previews. + preview->SetReconfigureParentLayoutOnGeometryChange(false); + AddChild(preview.GetPointer()); AddView(preview.GetPointer()); preview->SetVisible(false); @@ -123,6 +132,7 @@ public: void UpdateAnimationProgress(float progress, float curve_progress) { progress_ = progress; + curve_progress_ = curve_progress; if (!animating_) { @@ -171,39 +181,43 @@ public: if (progress >= 1.0) { - animating_ = false; - if (current_preview_) - { - RemoveChild(current_preview_.GetPointer()); - RemoveChildObject(current_preview_.GetPointer()); - current_preview_.Release(); - } - if (swipe_.preview) + // if we were animating, we need to remove the old preview, and replace it with the new. + if (animating_) { - if (swipe_.direction == Navigation::RIGHT) - relative_nav_index_++; - else if (swipe_.direction == Navigation::LEFT) - relative_nav_index_--; - - current_preview_ = swipe_.preview; - swipe_.preview.Release(); + animating_ = false; if (current_preview_) - current_preview_->OnNavigateInComplete(); - } - - // another swipe? - if (!push_preview_.empty()) - { - progress_ = 0; - continue_navigation.emit(); - } - else - { - end_navigation.emit(); + { + RemoveChild(current_preview_.GetPointer()); + RemoveChildObject(current_preview_.GetPointer()); + current_preview_.Release(); + } + if (swipe_.preview) + { + if (swipe_.direction == Navigation::RIGHT) + relative_nav_index_++; + else if (swipe_.direction == Navigation::LEFT) + relative_nav_index_--; + + current_preview_ = swipe_.preview; + swipe_.preview.Release(); + if (current_preview_) + current_preview_->OnNavigateInComplete(); + } + + // another swipe? + if (!push_preview_.empty()) + { + progress_ = 0; + continue_navigation.emit(); + } + else + { + end_navigation.emit(); + } } // set the geometry to the whole layout. - if (current_preview_ && current_preview_->GetGeometry() != geometry) + if (current_preview_) { current_preview_->SetGeometry(geometry); } @@ -332,6 +346,7 @@ private: PreviewSwipe swipe_; float progress_; + float curve_progress_; bool animating_; // wait animation glib::Source::UniquePtr preview_wait_timer_; |
