optimize: keep filter opened while scrolling
This commit is contained in:
@ -614,7 +614,7 @@ namespace Pixiview.Illust
|
|||||||
private double lastRefreshY = double.MinValue;
|
private double lastRefreshY = double.MinValue;
|
||||||
private double offset;
|
private double offset;
|
||||||
|
|
||||||
protected bool ScrollingDown(double y)
|
protected bool IsScrollingDown(double y)
|
||||||
{
|
{
|
||||||
return y > lastScrollY;
|
return y > lastScrollY;
|
||||||
}
|
}
|
||||||
|
@ -86,6 +86,7 @@ namespace Pixiview.Illust
|
|||||||
private bool previousEnabled;
|
private bool previousEnabled;
|
||||||
private bool dateEnabled;
|
private bool dateEnabled;
|
||||||
private bool nextEnabled;
|
private bool nextEnabled;
|
||||||
|
private ScrollDirection scrollDirection = ScrollDirection.Stop;
|
||||||
|
|
||||||
private bool isFilterVisible;
|
private bool isFilterVisible;
|
||||||
private string lastQueryKey;
|
private string lastQueryKey;
|
||||||
@ -229,6 +230,11 @@ namespace Pixiview.Illust
|
|||||||
if (flag)
|
if (flag)
|
||||||
{
|
{
|
||||||
isFilterVisible = true;
|
isFilterVisible = true;
|
||||||
|
if (scrollDirection == ScrollDirection.Down)
|
||||||
|
{
|
||||||
|
// stop the scrolling
|
||||||
|
await scrollView.ScrollToAsync(0, scrollView.ScrollY, false);
|
||||||
|
}
|
||||||
await Task.WhenAll(
|
await Task.WhenAll(
|
||||||
labelCaret.RotateTo(180, easing: Easing.CubicOut),
|
labelCaret.RotateTo(180, easing: Easing.CubicOut),
|
||||||
gridFilter.TranslateTo(0, 0, easing: Easing.CubicOut),
|
gridFilter.TranslateTo(0, 0, easing: Easing.CubicOut),
|
||||||
@ -324,14 +330,25 @@ namespace Pixiview.Illust
|
|||||||
private void ScrollView_Scrolled(object sender, ScrolledEventArgs e)
|
private void ScrollView_Scrolled(object sender, ScrolledEventArgs e)
|
||||||
{
|
{
|
||||||
var y = e.ScrollY;
|
var y = e.ScrollY;
|
||||||
if (ScrollingDown(y))
|
if (IsScrollingDown(y))
|
||||||
{
|
{
|
||||||
|
if (scrollDirection != ScrollDirection.Down)
|
||||||
|
{
|
||||||
|
scrollDirection = ScrollDirection.Down;
|
||||||
|
}
|
||||||
// down
|
// down
|
||||||
if (isFilterVisible)
|
if (isFilterVisible)
|
||||||
{
|
{
|
||||||
ToggleFilterPanel(false);
|
ToggleFilterPanel(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (scrollDirection != ScrollDirection.Up)
|
||||||
|
{
|
||||||
|
scrollDirection = ScrollDirection.Up;
|
||||||
|
}
|
||||||
|
}
|
||||||
OnScrolled(y);
|
OnScrolled(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user