Skip to content

Commit

Permalink
[Side Sheet] Fixed side sheet swipe calculations in RightSheetDelegate.
Browse files Browse the repository at this point in the history
These changes fix a bug for coplanar predictive back, where a sheet hide was triggered every time a predictive back swipe was started on a right coplanar sheet, rather than allowing the predictive back swipe.

PiperOrigin-RevId: 527681485
  • Loading branch information
afohrman authored and leticiarossi committed Apr 28, 2023
1 parent a6cf098 commit 8ae8a37
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ int getExpandedOffset() {
boolean isReleasedCloseToOriginEdge(@NonNull View releasedChild) {
// To be considered released close to the origin (right) edge, the released child's left must
// be at least halfway to the origin (right) edge of the screen.
return releasedChild.getLeft() > (getHiddenOffset() - getExpandedOffset()) / 2;
return releasedChild.getLeft() > (getHiddenOffset() + getExpandedOffset()) / 2;
}

@Override
boolean isSwipeSignificant(float xVelocity, float yVelocity) {
return SheetUtils.isSwipeMostlyHorizontal(xVelocity, yVelocity)
&& yVelocity > sheetBehavior.getSignificantVelocityThreshold();
&& Math.abs(xVelocity) > sheetBehavior.getSignificantVelocityThreshold();
}

@Override
Expand Down

0 comments on commit 8ae8a37

Please sign in to comment.