diff --git a/interface/resources/qml/hifi/dialogs/AttachmentsDialog.qml b/interface/resources/qml/hifi/dialogs/AttachmentsDialog.qml index 15467f8021..cc9a570d47 100644 --- a/interface/resources/qml/hifi/dialogs/AttachmentsDialog.qml +++ b/interface/resources/qml/hifi/dialogs/AttachmentsDialog.qml @@ -45,7 +45,7 @@ ScrollingWindow { Rectangle { width: parent.width - height: root.height + height: root.height - (keyboardRaised ? 200 : 0) radius: 4 color: hifi.colors.baseGray @@ -128,6 +128,10 @@ ScrollingWindow { } onCountChanged: MyAvatar.setAttachmentsVariant(attachments); } + + function scrollBy(delta) { + flickableItem.contentY += delta; + } } } @@ -204,5 +208,22 @@ ScrollingWindow { } } } + + onKeyboardRaisedChanged: { + if (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); + } + } + } } diff --git a/interface/resources/qml/hifi/dialogs/ModelBrowserDialog.qml b/interface/resources/qml/hifi/dialogs/ModelBrowserDialog.qml index aeffb8e4bf..a5a254f605 100644 --- a/interface/resources/qml/hifi/dialogs/ModelBrowserDialog.qml +++ b/interface/resources/qml/hifi/dialogs/ModelBrowserDialog.qml @@ -30,7 +30,7 @@ ScrollingWindow { Rectangle { width: parent.width - height: root.height + height: root.height - (keyboardRaised ? 200 : 0) radius: 4 color: hifi.colors.baseGray diff --git a/interface/resources/qml/hifi/dialogs/attachments/Attachment.qml b/interface/resources/qml/hifi/dialogs/attachments/Attachment.qml index 9dab51437a..6d371741ea 100644 --- a/interface/resources/qml/hifi/dialogs/attachments/Attachment.qml +++ b/interface/resources/qml/hifi/dialogs/attachments/Attachment.qml @@ -34,9 +34,6 @@ Item { anchors { left: parent.left; right: parent.right; margins: 20 } spacing: 8 - property bool keyboardRaised: false - property bool punctuationMode: false - Item { height: modelChooserButton.height + urlLabel.height + 4 anchors { left: parent.left; right: parent.right;} @@ -74,35 +71,6 @@ Item { } } - // virtual keyboard, letters - HifiControls.Keyboard { - id: keyboard1 - // y: parent.keyboardRaised ? parent.height : 0 - height: parent.keyboardRaised ? 200 : 0 - visible: parent.keyboardRaised && !parent.punctuationMode - enabled: parent.keyboardRaised && !parent.punctuationMode - anchors.right: parent.right - anchors.rightMargin: 0 - anchors.left: parent.left - anchors.leftMargin: 0 - // anchors.bottom: buttonRow.top - // anchors.bottomMargin: 2 * hifi.dimensions.contentSpacing.y - } - - HifiControls.KeyboardPunctuation { - id: keyboard2 - // y: parent.keyboardRaised ? parent.height : 0 - height: parent.keyboardRaised ? 200 : 0 - visible: parent.keyboardRaised && parent.punctuationMode - enabled: parent.keyboardRaised && parent.punctuationMode - anchors.right: parent.right - anchors.rightMargin: 0 - anchors.left: parent.left - anchors.leftMargin: 0 - // anchors.bottom: buttonRow.top - // anchors.bottomMargin: 2 * hifi.dimensions.contentSpacing.y - } - Item { height: jointChooser.height + jointLabel.height + 4 anchors { left: parent.left; right: parent.right; }