OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // to start at zero (and thus are implicitly scaled). | 49 // to start at zero (and thus are implicitly scaled). |
50 // | 50 // |
51 // The curve is modelled as a 4th order polynomial, starting at t = 0, and endin
g at t = m_curveDuration. | 51 // The curve is modelled as a 4th order polynomial, starting at t = 0, and endin
g at t = m_curveDuration. |
52 // Attempts to generate position/velocity estimates outside this range are undef
ined. | 52 // Attempts to generate position/velocity estimates outside this range are undef
ined. |
53 | 53 |
54 static const int cMaxSearchIterations = 20; | 54 static const int cMaxSearchIterations = 20; |
55 | 55 |
56 PassOwnPtr<PlatformGestureCurve> TouchFlingPlatformGestureCurve::createForTouchP
ad(const FloatPoint& velocity, IntPoint cumulativeScroll) | 56 PassOwnPtr<PlatformGestureCurve> TouchFlingPlatformGestureCurve::createForTouchP
ad(const FloatPoint& velocity, IntPoint cumulativeScroll) |
57 { | 57 { |
58 // The default parameters listed below are a matched set, and should not be
changed independently of one another. | 58 // The default parameters listed below are a matched set, and should not be
changed independently of one another. |
59 return create(velocity, -1.5e+02, 10, 1.5e+00, 2.075, cumulativeScroll); | 59 return create(velocity, -5.70762e+03, 1.72e+02, 3.7e+00, 1.3, cumulativeScro
ll); |
60 } | 60 } |
61 | 61 |
62 PassOwnPtr<PlatformGestureCurve> TouchFlingPlatformGestureCurve::createForTouchS
creen(const FloatPoint& velocity, IntPoint cumulativeScroll) | 62 PassOwnPtr<PlatformGestureCurve> TouchFlingPlatformGestureCurve::createForTouchS
creen(const FloatPoint& velocity, IntPoint cumulativeScroll) |
63 { | 63 { |
64 // The touchscreen-specific parameters listed below are a matched set, and s
hould not be changed independently of one another. | 64 // The touchscreen-specific parameters listed below are a matched set, and s
hould not be changed independently of one another. |
65 return create(velocity, -1.5e+02, 10, 1.5e+00, 2.075, cumulativeScroll); | 65 return create(velocity, -5.70762e+03, 1.72e+02, 3.7e+00, 1.3, cumulativeScro
ll); |
66 } | 66 } |
67 | 67 |
68 PassOwnPtr<PlatformGestureCurve> TouchFlingPlatformGestureCurve::create(const Fl
oatPoint& velocity, float p0, float p1, float p2, float curveDuration, IntPoint
cumulativeScroll) | 68 PassOwnPtr<PlatformGestureCurve> TouchFlingPlatformGestureCurve::create(const Fl
oatPoint& velocity, float p0, float p1, float p2, float curveDuration, IntPoint
cumulativeScroll) |
69 { | 69 { |
70 return adoptPtr(new TouchFlingPlatformGestureCurve(velocity, p0, p1, p2, cur
veDuration, cumulativeScroll)); | 70 return adoptPtr(new TouchFlingPlatformGestureCurve(velocity, p0, p1, p2, cur
veDuration, cumulativeScroll)); |
71 } | 71 } |
72 | 72 |
73 inline double position(double t, float* p) | 73 inline double position(double t, float* p) |
74 { | 74 { |
75 return p[0] * exp(-p[2] * t) - p[1] * t - p[0]; | 75 return p[0] * exp(-p[2] * t) - p[1] * t - p[0]; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 153 |
154 if (time + m_timeOffset < m_curveDuration || scrollIncrement != IntPoint::ze
ro()) { | 154 if (time + m_timeOffset < m_curveDuration || scrollIncrement != IntPoint::ze
ro()) { |
155 target->scrollBy(scrollIncrement); | 155 target->scrollBy(scrollIncrement); |
156 return true; | 156 return true; |
157 } | 157 } |
158 | 158 |
159 return false; | 159 return false; |
160 } | 160 } |
161 | 161 |
162 } // namespace WebCore | 162 } // namespace WebCore |
OLD | NEW |