Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix layout cycle error in ProportionalStackPanel #367

Merged
merged 1 commit into from
Oct 19, 2024

Conversation

BAndysc
Copy link
Contributor

@BAndysc BAndysc commented Oct 7, 2024

As reported in #366, resizing panels led to "Layout Cycle Detected" warning. This is not caused by a cycle like the message suggest, but we were changing Proportion from the MeasureOverride and ArrangeOverride methods.

https://github.com/wieslawsoltes/Dock/blob/master/src/Avalonia.Controls.ProportionalStackPanel/ProportionalStackPanel.cs#L224

I don't know if there is a better place to call AssignProportions (outside Measure and Arrange methods). Thus my proposal is to avoid calling InvalidateMeasure/InvalidateArrange when AssignProportions is being executed. AffectsParentMeasure is just a syntax sugar for

PROPERTY.Changed.AddClassHandler<TElement>((sender, e) =>
{
    if (sender.GetVisualParent() is not TParent parent)
        return;

    parent.InvalidateMeasure();
});

So this PR basically only adds a flag to skip invalidating in this case.

Fixes: #366

@wieslawsoltes wieslawsoltes merged commit 5d3e14e into wieslawsoltes:master Oct 19, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Layout cycle while drag spliiter
2 participants