Fix global target and proportions#1030
Merged
wieslawsoltes merged 6 commits intomasterfrom Feb 9, 2026
Merged
Conversation
This was referenced Feb 11, 2026
Closed
This was referenced Feb 18, 2026
This was referenced Feb 25, 2026
This was referenced Mar 4, 2026
This was referenced Mar 6, 2026
Closed
This was referenced Mar 16, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Investigation Report and PR Summary: Fix for Issue #1022
Linked Issue
Issue
Docking to Top after resizing a Bottom-docked area could produce incorrect split behavior:
0.5/0.5behavior when splitting single tool/document docks.Reproduction
Using
DockMvvmSamplefrom the issue:Detailed Investigation
Phase 1: Operation-precedence ambiguity
When both local and global targets were available, execution could pick global too eagerly.
Implemented:
Over(...),Drop(...), and drag preview operation selection.Phase 2: Wrong global target resolution (core issue)
Global validation/execution resolved target from focused active pane (
Layout.ActiveDockable) in paths where the hovered drop context should have been authoritative.Implemented:
Applied in:
DockControlState,HostWindowState,ManagedHostWindowState,DockManagerState.Phase 3: Split proportion state drift (
ProportionvsCollapsedProportion)Remaining bad ratios came from stale
CollapsedProportionvalues overriding fresh split values in proportional layout restore paths.Implemented in
FactoryBase:ProportionandCollapsedProportionare updated together,NaN,Phase 4: Global docking proportion behavior consistency
DockSettings.GlobalDockingProportionneeded to apply reliably after global drops while preserving safety guards.Final behavior:
sourceDockable.Owner != nullguard,Owner.ProportionandOwner.CollapsedProportion.Phase 5: Service quality refactor and consolidation
Refactor was first split into multiple services, then consolidated to reduce indirection and improve maintainability.
Final architecture:
IGlobalDockingService/GlobalDockingService.Important parity note:
DockControlStateinto the service for proportion application (no broadened fallback semantics).Commit Timeline
5315650ceFix global drop target resolution and operation precedence1fe128d7fFix split proportion propagation after resize and fallback splitsdebe90f6eSet GlobalDockingProportion default to 0.5f204ffa81Refactor global docking decisions into dedicated services00d174973Restore pre-refactor global proportion gating semanticsbd0dfa043Consolidate global docking rules into single serviceFinal Fix Summary
NaNproportions using effective target share in optimized split paths.ProportionandCollapsedProportion.DockSettings.GlobalDockingProportionis0.5.Test Coverage Added/Updated
tests/Dock.Avalonia.HeadlessTests/DockControlStateTests.csGlobalDockingService.tests/Dock.Avalonia.HeadlessTests/WindowStateGlobalTargetResolutionTests.csHostWindowState_ValidateGlobal_UsesDropContextTarget_WithoutDockControlAncestorManagedHostWindowState_ValidateGlobal_UsesDropContextTarget_WithoutDockControlAncestortests/Dock.Avalonia.HeadlessTests/FactorySplitTests.csNaNproportions,tests/Dock.Avalonia.HeadlessTests/OptimizedSplitLayoutTests.csOptimizedSplitLayout_WithNaNTarget_UsesEffectiveShareForHalfSplittests/Dock.Model.UnitTests/DockServiceSplitProportionTests.csValidation
Executed:
dotnet test tests/Dock.Avalonia.HeadlessTests/Dock.Avalonia.HeadlessTests.csproj --configuration Release --filter "FullyQualifiedName~DockControlStateTests|FullyQualifiedName~WindowStateGlobalTargetResolutionTests"dotnet test tests/Dock.Avalonia.HeadlessTests/Dock.Avalonia.HeadlessTests.csproj --configuration Releasedotnet test tests/Dock.Model.UnitTests/Dock.Model.UnitTests.csproj --configuration ReleaseFiles Changed (Final)
src/Dock.Avalonia/Internal/DockManagerState.cssrc/Dock.Avalonia/Internal/DockControlState.cssrc/Dock.Avalonia/Internal/HostWindowState.cssrc/Dock.Avalonia/Internal/ManagedHostWindowState.cssrc/Dock.Avalonia/Internal/Services/IGlobalDockingService.cssrc/Dock.Avalonia/Internal/Services/GlobalDockingService.cssrc/Dock.Model/FactoryBase.cssrc/Dock.Settings/DockSettings.csdocfx/articles/dock-settings.mdtests/Dock.Avalonia.HeadlessTests/DockControlStateTests.cstests/Dock.Avalonia.HeadlessTests/WindowStateGlobalTargetResolutionTests.cstests/Dock.Avalonia.HeadlessTests/FactorySplitTests.cstests/Dock.Avalonia.HeadlessTests/OptimizedSplitLayoutTests.cstests/Dock.Model.UnitTests/DockServiceSplitProportionTests.csPR Summary (Ready to Use)
This PR fixes issue #1022 by correcting global drop target resolution and split proportion state handling across docking paths, then hardening maintainability with a single consolidated global docking service. The fix ensures global docking resolves from the hovered drop context rather than unrelated focused panes, preventing wrong-subtree splits (including right-panel mis-targeting). Split behavior now consistently handles unset (
NaN) proportions via effective-share logic, avoids stale reused-dock proportion leakage in fallback layouts, and keepsProportionandCollapsedProportionsynchronized so collapsed state restore does not override fresh split ratios. Global proportion assignment remains strictly gated to the original semantics (pre-refactor parity preserved) while applying both proportion fields when valid. DefaultGlobalDockingProportionis set to0.5. Expanded regression coverage spans dock-control, host-window, model split behavior, and the top-after-bottom-resize scenario. All relevant full suites pass.Fixes #1022