Skip to content

Commit

Permalink
fix(FlipView): Flipping on WASM and Skia
Browse files Browse the repository at this point in the history
  • Loading branch information
ajpinedam committed Apr 5, 2022
1 parent 9942b0c commit 811266b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,20 @@ private static double GetHorizontalScrollWheelDelta(Size size, double delta)
const double ScrollViewerMinHeightToReflowAroundOcclusions = 32.0f;

private /*readonly - partial*/ IScrollStrategy _strategy;

public bool CanHorizontallyScroll { get; set; }

public bool CanVerticallyScroll { get; set; }
private bool _canHorizontallyScroll;
public bool CanHorizontallyScroll
{
get => _canHorizontallyScroll || _forceChangeToCurrentView;
set => _canHorizontallyScroll = value;
}

private bool _canVerticallyScroll;
public bool CanVerticallyScroll
{
get => _canVerticallyScroll || _forceChangeToCurrentView;
set => _canVerticallyScroll = value;
}

public double HorizontalOffset { get; private set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,21 @@ public object ScrollOwner

private ScrollViewer Scroller => ScrollOwner as ScrollViewer;

#if __WASM__
bool _forceChangeToCurrentView;

#if __WASM__
bool IScrollContentPresenter.ForceChangeToCurrentView
{
get => _forceChangeToCurrentView;
set => _forceChangeToCurrentView = value;
}

#elif __SKIA__
internal bool ForceChangeToCurrentView
{
get => _forceChangeToCurrentView;
set => _forceChangeToCurrentView = value;
}
#endif

private void InitializeScrollContentPresenter()
Expand Down
2 changes: 1 addition & 1 deletion src/Uno.UI/UI/Xaml/Controls/ScrollViewer/ScrollViewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ protected override void OnApplyTemplate()

_isTemplateApplied = _presenter != null;

#if __WASM__
#if __WASM__ || __SKIA__
if (_presenter != null && ForceChangeToCurrentView)
{
_presenter.ForceChangeToCurrentView = ForceChangeToCurrentView;
Expand Down

0 comments on commit 811266b

Please sign in to comment.