Don't save touch location as a resting position.
When you drag bubbles out of the magnetic target, it springs towards your touch position to 'catch up', since it was stuck in the target away from the touch. However, unlike all other springs, this one should not save its end position as the stack resting position, since it's not a valid resting position. This one was hard to repro - you have to drag bubbles into the target, then quickly pull them out, back in, and release them before they catch up to your finger. If you do though, you'll end up with bubbles that come back in the middle of the screen. Test: mash on the dismiss target a bunch Bug: 155495386 Change-Id: I8ded5337a72fb52a851e7640d2b0fddb8453648a
This commit is contained in:
@@ -676,12 +676,22 @@ public class StackAnimationController extends
|
||||
PhysicsAnimationLayout.getReadablePropertyName(property),
|
||||
finalPosition));
|
||||
|
||||
// Whether we're springing towards the touch location, rather than to a position on the
|
||||
// sides of the screen.
|
||||
final boolean isSpringingTowardsTouch = mSpringToTouchOnNextMotionEvent;
|
||||
|
||||
StackPositionProperty firstBubbleProperty = new StackPositionProperty(property);
|
||||
SpringAnimation springAnimation =
|
||||
new SpringAnimation(this, firstBubbleProperty)
|
||||
.setSpring(spring)
|
||||
.addEndListener((dynamicAnimation, b, v, v1) -> {
|
||||
mRestingStackPosition.set(mStackPosition);
|
||||
if (!isSpringingTowardsTouch) {
|
||||
// If we're springing towards the touch position, don't save the
|
||||
// resting position - the touch location is not a valid resting
|
||||
// position. We'll set this when the stack springs to the left or
|
||||
// right side of the screen after the touch gesture ends.
|
||||
mRestingStackPosition.set(mStackPosition);
|
||||
}
|
||||
|
||||
if (after != null) {
|
||||
for (Runnable callback : after) {
|
||||
|
||||
Reference in New Issue
Block a user