Closed Bug 710119 Opened 13 years ago Closed 13 years ago

Short flings stop abruptly

Categories

(Firefox for Android Graveyard :: General, defect)

ARM
Android
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: pcwalton, Assigned: pcwalton)

Details

Attachments

(2 files, 3 obsolete files)

As of the patches in bug 705092, when I do a short fling, the friction seems to not be applied at all before the page suddenly stops.
Attached patch Proposed patch. (obsolete) — Splinter Review
So this kind of backs out that bug, but it seems to improve the look of short flings to me, without changing my ability to fling far (that I've noticed anyway).
Assignee: nobody → pwalton
Status: NEW → ASSIGNED
Attachment #581171 - Flags: review?(chrislord.net)
Comment on attachment 581171 [details] [diff] [review] Proposed patch. Review of attachment 581171 [details] [diff] [review]: ----------------------------------------------------------------- I can't r+ this patch as it just brings back the bug that this change fixed (it's certainly very noticeable to me). I think lowering the friction factor and the stopped threshold will have a similar effect, without removing the feature of having faster flings decelerate slower. Preparing patch.
Attachment #581171 - Flags: review?(chrislord.net) → review-
Attached patch Proposed patch. (obsolete) — Splinter Review
So actually this is mostly a bug in my code. STOPPED_THRESHOLD was never supposed to apply in the non-overscrolled fling case, but the overscroll revamp accidentally made it apply. This patch fixes it and now we coast nicely to a stop when flinging.
Attachment #581171 - Attachment is obsolete: true
Attachment #581220 - Attachment is obsolete: true
Attachment #581220 - Flags: review?(pwalton)
Attachment #581494 - Flags: review?(chrislord.net)
Wait, the formula for velocity is ((v^FF) * F)^(1/F), where v is velocity, F is friction, and FF is the friction factor. Isn't that just v^(F^(1/FF))?
Er, v*(F^(1/FF)).
Attached patch Proposed patch, version 3. (obsolete) — Splinter Review
Here's another approach. The idea is really simple: it uses one friction factor for high velocity and another for low velocity. In my testing it seems to work pretty well: you want high friction for short flings so that your small pans don't cause too much motion while you're trying to read a long article or whatever, but low friction for long flings where you're dashing around a page. Note that iOS relies heavily on the "double-tap to return to the top of the page" feature, because it has relatively high friction all around, but Android users expect the friction to be low enough that they can just yank their way to the top of the page.
Attachment #581494 - Attachment is obsolete: true
Attachment #581494 - Flags: review?(chrislord.net)
Attachment #581550 - Flags: review?(chrislord.net)
Attachment #581220 - Attachment is obsolete: false
(In reply to Patrick Walton (:pcwalton) from comment #5) > Wait, the formula for velocity is ((v^FF) * F)^(1/F), where v is velocity, F > is friction, and FF is the friction factor. Isn't that just v^(F^(1/FF))? The formula is ((v^FF) * F)^(1/FF) (not 1/F), which doesn't simplify.
Comment on attachment 581550 [details] [diff] [review] Proposed patch, version 3. Review of attachment 581550 [details] [diff] [review]: ----------------------------------------------------------------- I fail to see how this would be favourable to having a friction factor? This just means there's going to be a weird jump in deceleration when velocity drops below VELOCITY_THRESHOLD. This could be modelled as a smooth curve using the factor code. VELOCITY_THRESHOLD might be a good idea to add as a constant into the factor equation though, to change it to; nv = (v - k) + 1; nv = ((nv^ff) * f)^(1/ff) v = nv + (k - 1); so that the friction applies at k velocity, instead of at 1 velocity.
Attachment #581550 - Flags: review?(chrislord.net) → review-
(In reply to Chris Lord [:cwiiis] from comment #8) > (In reply to Patrick Walton (:pcwalton) from comment #5) > > Wait, the formula for velocity is ((v^FF) * F)^(1/F), where v is velocity, F > > is friction, and FF is the friction factor. Isn't that just v^(F^(1/FF))? > > The formula is ((v^FF) * F)^(1/FF) (not 1/F), which doesn't simplify. Yes, it does: http://www.wolframalpha.com/input/?i=simplify+%28%28v^G%29+*+F%29^%281%2FG%29 The factor code that's in there now is equivalent to changing the friction, unless I'm missing something.
It really doesn't feel weird to me to have that jump. I couldn't notice it, and I like the simplicity of the approach.
Although I guess we could make it a little smoother by scaling once the velocity gets below a certain number, say 12. Would you be ok with that change? e.g.: if v < 12 then v *= (0.96 - 0.76) * (v / 12) + 0.76 else v *= 0.96
My mistake, yes it simplifies, I've implemented it incorrectly :/ Your last suggestion is a good one, I'd be fine with that.
Patch version 4 implements the suggested algorithm. It feels nice to me.
Attachment #581550 - Attachment is obsolete: true
Attachment #581790 - Flags: review?(chrislord.net)
Comment on attachment 581790 [details] [diff] [review] Proposed patch, version 4. Review of attachment 581790 [details] [diff] [review]: ----------------------------------------------------------------- Looks good :)
Attachment #581790 - Flags: review?(chrislord.net) → review+
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Verified fixed on: Nightly 13.0a1(2012-03-04) Device: Samsung Galaxy S2 OS: Android 2.3.4
Status: RESOLVED → VERIFIED
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: