mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 06:19:02 +02:00
Scroll attachments if necessary when raise keyboard to keep focus
This commit is contained in:
parent
1fc6d82456
commit
66dded5e28
3 changed files with 34 additions and 19 deletions
|
@ -42,4 +42,14 @@ ScrollingWindow {
|
||||||
|
|
||||||
AttachmentsContent { }
|
AttachmentsContent { }
|
||||||
|
|
||||||
|
onKeyboardRaisedChanged: {
|
||||||
|
if (keyboardEnabled && keyboardRaised) {
|
||||||
|
var buttonHeight = 40; // Allow for New Attachment button.
|
||||||
|
var keyboardRaisedHeight = 200;
|
||||||
|
var delta = activator.mouseY - (root.height - keyboardRaisedHeight - buttonHeight);
|
||||||
|
if (delta > 0) {
|
||||||
|
content.scrollBy(delta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,24 +191,8 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME
|
function scrollBy(delta) {
|
||||||
/*
|
scrollView.scrollBy(delta);
|
||||||
onKeyboardRaisedChanged: {
|
|
||||||
if (keyboardEnabled && keyboardRaised) {
|
|
||||||
// Scroll to item with focus if necessary.
|
|
||||||
var footerHeight = newAttachmentButton.height + buttonRow.height + 3 * hifi.dimensions.contentSpacing.y;
|
|
||||||
var delta = activator.mouseY
|
|
||||||
- (activator.height + activator.y - 200 - footerHeight - hifi.dimensions.controlLineHeight);
|
|
||||||
|
|
||||||
if (delta > 0) {
|
|
||||||
scrollView.scrollBy(delta);
|
|
||||||
} else {
|
|
||||||
// HACK: Work around for case where are 100% scrolled; stops window from erroneously scrolling to 100% when show keyboard.
|
|
||||||
scrollView.scrollBy(-1);
|
|
||||||
scrollView.scrollBy(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ Item {
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
// Defocuses any current control so that the keyboard gets hidden.
|
// Defocuses any current control so that the keyboard gets hidden.
|
||||||
id: mouseArea
|
id: defocuser
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
propagateComposedEvents: true
|
propagateComposedEvents: true
|
||||||
acceptedButtons: Qt.AllButtons
|
acceptedButtons: Qt.AllButtons
|
||||||
|
@ -71,6 +71,27 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onKeyboardRaisedChanged: {
|
||||||
|
if (keyboardEnabled && keyboardRaised) {
|
||||||
|
var buttonsHeight = 120; // Allow for New Attachment plus Cancel & OK buttons.
|
||||||
|
var delta = activator.mouseY - (root.height - keyboard.raisedHeight - buttonsHeight);
|
||||||
|
if (delta > 0) {
|
||||||
|
attachments.scrollBy(delta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: activator
|
||||||
|
anchors.fill: parent
|
||||||
|
propagateComposedEvents: true
|
||||||
|
enabled: true
|
||||||
|
acceptedButtons: Qt.AllButtons
|
||||||
|
onPressed: {
|
||||||
|
mouse.accepted = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
keyboardEnabled = HMD.active;
|
keyboardEnabled = HMD.active;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue