mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:03:53 +02:00
7925 Create Mode: keyboard focused entry field is not visible
note: changed the way of calculation scroll value after showing virtual keyboard. Now it doesn't require KEYBOARD_HEGHT and will always try to position focused element at vertical center of the client area
This commit is contained in:
parent
88097bb39f
commit
00c3dcee2f
1 changed files with 9 additions and 8 deletions
|
@ -14,7 +14,6 @@
|
|||
var isWindowFocused = true;
|
||||
var isKeyboardRaised = false;
|
||||
var isNumericKeyboard = false;
|
||||
var KEYBOARD_HEIGHT = 200;
|
||||
|
||||
function shouldRaiseKeyboard() {
|
||||
var nodeName = document.activeElement.nodeName;
|
||||
|
@ -56,13 +55,15 @@
|
|||
}
|
||||
|
||||
if (!isKeyboardRaised) {
|
||||
var delta = document.activeElement.getBoundingClientRect().bottom + 10
|
||||
- (document.body.clientHeight - KEYBOARD_HEIGHT);
|
||||
if (delta > 0) {
|
||||
setTimeout(function () {
|
||||
document.body.scrollTop += delta;
|
||||
}, 500); // Allow time for keyboard to be raised in QML.
|
||||
}
|
||||
var timeout = setTimeout(function () {
|
||||
clearTimeout(timeout);
|
||||
|
||||
var elementRect = document.activeElement.getBoundingClientRect();
|
||||
var absoluteElementTop = elementRect.top + window.scrollY;
|
||||
var middle = absoluteElementTop - (window.innerHeight / 2);
|
||||
|
||||
window.scrollTo(0, middle);
|
||||
}, 500); // Allow time for keyboard to be raised in QML.
|
||||
}
|
||||
|
||||
isKeyboardRaised = keyboardRaised;
|
||||
|
|
Loading…
Reference in a new issue