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

Scroller fix for Issue #561: Missing content-layout-offset updates in far-anchoring + overpanning modes #748

Merged
merged 2 commits into from
May 23, 2019

Conversation

RBrid
Copy link
Contributor

@RBrid RBrid commented May 23, 2019

Fixes Issue #561.

The Scroller was unexpectedly shifting its Content position in these conditions:

  • Content is far-anchoring (i.e. HorizontalAnchorRatio==1.0 or VerticalAnchorRatio==1.0)
  • Content is being over-panned
  • Content is shrinking

The fix was to update the Scroller's content-layout-offset in these conditions.

(The typo fix for the RaiseViewportChanged call seen in #731 is also present in these changes).

The new Scroller interactive test covers the broken scenario. It checks the expected content-layout-offset.

@RBrid RBrid requested a review from a team May 23, 2019 17:17
@RBrid RBrid self-assigned this May 23, 2019
Copy link
Contributor

@StephenLPeters StephenLPeters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@RBrid RBrid merged commit 7f1a580 into master May 23, 2019

using (var setup = new TestSetupHelper("Scroller Tests"))
{
SetOutputDebugStringLevel("Verbose");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for intermediate testing, or something you intend to check in?

Log.Comment("scroller51.VerticalScrollPercent={0}", scroller51.VerticalScrollPercent);

// No layout offset is expected
double contentLayoutOffsetX = 0.0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As pure out params you shouldn't need to initialize these

(isForHorizontalDirection && scroller51.VerticalScrollPercent != 0.0) ||
(!isForHorizontalDirection && scroller51.HorizontalScrollPercent != 0.0) ||
(!isForHorizontalDirection && scroller51.VerticalScrollPercent != 100.0) ||
(isForHorizontalDirection && contentLayoutOffsetX != 30.0) ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really know what the logic is behind all these numbers. 30, 40, 10, 100, 240... they look like they're combinations of something but it's not obvious what.

@@ -849,9 +850,10 @@ winrt::Size Scroller::ArrangeOverride(winrt::Size const& finalSize)
{
float unzoomedDelta = 0.0f;

if (newUnzoomedExtentHeight > m_unzoomedExtentHeight)
if (newUnzoomedExtentHeight > m_unzoomedExtentHeight || // ExtentHeight grew
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identical logic except swapping Height for Width. Can you make a worker function to reduce that duplication?

{
FrameworkElement content = scroller51.Content as FrameworkElement;

if (scroller51.HorizontalOffset > scroller51.ScrollableWidth + 20.0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are these 20/30, 25/40 values coming from?

@@ -259,6 +285,24 @@ private void MUXControlsTestHooks_LoggingMessage(object sender, MUXControlsTestH
}
}

private void ScrollerTestHooks_ContentLayoutOffsetXChanged(Scroller sender, object args)
{
float contentLayoutOffsetX = 0.0f;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pure out value, doesn't need to be initialized

@jevansaks jevansaks added the release note PR that we want to call out in the next release summary label Jun 10, 2019
@msft-github-bot
Copy link
Collaborator

🎉Microsoft.UI.Xaml v2.2.190611001 has been released which incorporates this pull request.:tada:

Handy links:

@RBrid RBrid deleted the user/rbrid/ScrollerAnchoring branch October 21, 2019 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Scrolling release note PR that we want to call out in the next release summary
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants