iOS: Only scroll to cursor on keyboard hide gesture reset if requested
Change-Id: I15b313b5f0d57358e405f16e941fc5061028c6a7 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>bb10
parent
e415ed83af
commit
8aa663e139
|
|
@ -68,6 +68,7 @@ static QUIView *focusView()
|
|||
@private
|
||||
QIOSInputContext *m_context;
|
||||
}
|
||||
@property BOOL hasDeferredScrollToCursor;
|
||||
@end
|
||||
|
||||
@implementation QIOSKeyboardListener
|
||||
|
|
@ -80,6 +81,8 @@ static QUIView *focusView()
|
|||
|
||||
m_context = context;
|
||||
|
||||
self.hasDeferredScrollToCursor = NO;
|
||||
|
||||
// UIGestureRecognizer
|
||||
self.enabled = NO;
|
||||
self.cancelsTouchesInView = NO;
|
||||
|
|
@ -231,9 +234,14 @@ static QUIView *focusView()
|
|||
qImDebug() << "keyboard was hidden, disabling hide-keyboard gesture";
|
||||
self.enabled = NO;
|
||||
} else {
|
||||
qImDebug() << "gesture completed without triggering, scrolling view to cursor";
|
||||
m_context->scrollToCursor();
|
||||
qImDebug() << "gesture completed without triggering";
|
||||
if (self.hasDeferredScrollToCursor) {
|
||||
qImDebug() << "applying deferred scroll to cursor";
|
||||
m_context->scrollToCursor();
|
||||
}
|
||||
}
|
||||
|
||||
self.hasDeferredScrollToCursor = NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -418,7 +426,8 @@ void QIOSInputContext::scrollToCursor()
|
|||
if (m_keyboardHideGesture.state == UIGestureRecognizerStatePossible && m_keyboardHideGesture.numberOfTouches == 1) {
|
||||
// Don't scroll to the cursor if the user is touching the screen and possibly
|
||||
// trying to trigger the hide-keyboard gesture.
|
||||
qImDebug() << "preventing scrolling to cursor as we're still waiting for a possible gesture";
|
||||
qImDebug() << "deferring scrolling to cursor as we're still waiting for a possible gesture";
|
||||
m_keyboardHideGesture.hasDeferredScrollToCursor = YES;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue