mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Fix subtle bugs in sky-scrollable
Previously the scrollbar wasn't constrained to the scrollable element and we had messed up the math on the fling curve. TBR=eseidel@chromium.org Review URL: https://codereview.chromium.org/947303003
This commit is contained in:
parent
374f71edcf
commit
bc9b3e319e
@ -36,7 +36,7 @@ class FlingCurve {
|
||||
|
||||
FlingCurve(double velocity, double startTime) {
|
||||
double startingVelocity = math.min(_kMaxVelocity, velocity.abs());
|
||||
_timeOffset = _velocityAtTime(startingVelocity);
|
||||
_timeOffset = _timeAtVelocity(startingVelocity);
|
||||
_positionOffset = _positionAtTime(_timeOffset);
|
||||
_startTime = startTime / 1000.0;
|
||||
_previousPosition = 0.0;
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
right: 0;
|
||||
}
|
||||
#content {
|
||||
background-color: yellow;
|
||||
background-color: white;
|
||||
will-change: transform;
|
||||
position: absolute;
|
||||
width: 256px;
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
:host {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
will-change: transform;
|
||||
}
|
||||
#scrollable {
|
||||
will-change: transform;
|
||||
|
||||
@ -108,10 +108,10 @@ scoped_ptr<blink::WebInputEvent> BuildWebGestureEvent(
|
||||
break;
|
||||
case mojo::EVENT_TYPE_SCROLL_FLING_START:
|
||||
web_event->type = blink::WebInputEvent::GestureFlingStart;
|
||||
// TODO(abarth): Why don't we need to divide by the device_pixel_ratio
|
||||
// here? For some reason, this seems to get the right velocity.
|
||||
web_event->data.flingStart.velocityX = event->gesture_data->velocity_x;
|
||||
web_event->data.flingStart.velocityY = event->gesture_data->velocity_y;
|
||||
web_event->data.flingStart.velocityX =
|
||||
event->gesture_data->velocity_x / device_pixel_ratio;
|
||||
web_event->data.flingStart.velocityY =
|
||||
event->gesture_data->velocity_y / device_pixel_ratio;
|
||||
break;
|
||||
case mojo::EVENT_TYPE_SCROLL_FLING_CANCEL:
|
||||
web_event->type = blink::WebInputEvent::GestureFlingCancel;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user