提交 2a829f94 编写于 作者: C Chinmay Garde

Pass correct recognizer data while panning on iOS

上级 c87a7c68
......@@ -58,6 +58,7 @@ static sky::InputEventPtr BasicInputEventFromRecognizer(
@implementation SkySurface {
BOOL _platformViewInitialized;
CGPoint _lastScrollTranslation;
sky::SkyEnginePtr _sky_engine;
scoped_ptr<sky::shell::ShellView> _shell_view;
......@@ -274,6 +275,7 @@ static sky::InputEventPtr BasicInputEventFromRecognizer(
sky::EventType type = sky::EVENT_TYPE_UNKNOWN;
switch (recognizer.state) {
case UIGestureRecognizerStateBegan:
_lastScrollTranslation = CGPointZero;
type = sky::EVENT_TYPE_GESTURE_SCROLL_BEGIN;
break;
case UIGestureRecognizerStateChanged:
......@@ -297,8 +299,11 @@ static sky::InputEventPtr BasicInputEventFromRecognizer(
auto translation = [recognizer translationInView: self];
auto velocity = [recognizer velocityInView: self];
input->gesture_data->dx = translation.x * scale;
input->gesture_data->dy = translation.y * scale;
input->gesture_data->dx = (translation.x - _lastScrollTranslation.x) * scale;
input->gesture_data->dy = (translation.y - _lastScrollTranslation.y) * scale;
_lastScrollTranslation = translation;
input->gesture_data->velocityX = velocity.x * scale;
input->gesture_data->velocityY = velocity.y * scale;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册