Add smooth tab reorder animation during drag#19598
Add smooth tab reorder animation during drag#19598Z-a-r-a-k-i wants to merge 1 commit intomicrosoft:mainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
2bcb73a to
b0e75de
Compare
|
@microsoft-github-policy-service agree |
|
WHOA. Do you have a video of this? It sounds great! |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
carlos-zamora
left a comment
There was a problem hiding this comment.
Thanks for the contribution! Looks great! There's a few changes I've suggested that would simplify it a bit (i.e. remove possible extra vars or code).
Aside from that, I'm excited to see this merge soon. 😊
| void TerminalPage::_onTabStripDragLeave(const winrt::Windows::Foundation::IInspectable& /*sender*/, | ||
| const winrt::Windows::UI::Xaml::DragEventArgs& /*e*/) | ||
| { | ||
| // When the drag leaves the tab strip, reset the gap animation | ||
| if (_tabReorderAnimator) | ||
| { | ||
| _tabReorderAnimator->OnDragLeave(); | ||
| } | ||
| } |
There was a problem hiding this comment.
nit: perhaps this makes more sense in TabManagement.cpp
| for (uint32_t i = 0; i < tabCount; i++) | ||
| { | ||
| if (static_cast<int>(i) != _draggedTabIndex) | ||
| { | ||
| if (const auto item = _tabView.ContainerFromIndex(i).try_as<MUX::TabViewItem>()) | ||
| { | ||
| return item.ActualWidth(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if (_draggedTabIndex >= 0 && _draggedTabIndex < static_cast<int>(tabCount)) | ||
| { | ||
| if (const auto item = _tabView.ContainerFromIndex(_draggedTabIndex).try_as<MUX::TabViewItem>()) | ||
| { | ||
| return item.ActualWidth(); | ||
| } | ||
| } |
There was a problem hiding this comment.
Why do we need both? Why not just the second block?
| _StopAllAnimations(); | ||
| _transforms.clear(); | ||
|
|
||
| const auto tabCount = _tabView.TabItems().Size(); |
There was a problem hiding this comment.
| const auto tabCount = _tabView.TabItems().Size(); | |
| const auto tabCount = _tabView.TabItems().Size(); | |
| _transforms.reserve(tabCount); |
nit: set the size of _transforms to tabCount since it'll always be that.
| const auto duration = DurationHelper::FromTimeSpan( | ||
| TimeSpan{ std::chrono::milliseconds(AnimationDurationMs) }); |
There was a problem hiding this comment.
| const auto duration = DurationHelper::FromTimeSpan( | |
| TimeSpan{ std::chrono::milliseconds(AnimationDurationMs) }); | |
| const auto duration = DurationHelper::FromTimeSpan( TimeSpan{ std::chrono::milliseconds(AnimationDurationMs) }); |
nit: no need to split into 2 lines
| Windows::UI::Xaml::Media::Animation::TransitionCollection _savedTransitions{ nullptr }; | ||
| bool _transitionsSaved{ false }; |
There was a problem hiding this comment.
Do we need _transitionsSaved? Can't we just check if _savedTransitions is null?
|
Closing this PR - after further investigation, I discovered that the WinUI This means the Thanks @carlos-zamora and @DHowett for the review feedback! |

Summary of the Pull Request
Adds smooth tab reorder animation during same-window tab dragging. When a tab is dragged, other tabs animate to show where the tab will be inserted, similar to Chrome/Edge behavior.
References and Relevant Issues
Detailed Description of the Pull Request / Additional comments
TabReorderAnimatorclass that usesTranslateTransformto animate tabsDisableAnimationsglobal setting (checked at init and on settings reload)ItemContainerTransitionsduring drag to prevent conflictsValidation Steps Performed
PR Checklist