Fix up keyboards in attachments dialogs

This commit is contained in:
David Rowe 2016-09-26 16:39:34 +13:00
parent 302c8ede60
commit bc8c400448
3 changed files with 23 additions and 34 deletions

View file

@ -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);
}
}
}
}

View file

@ -30,7 +30,7 @@ ScrollingWindow {
Rectangle {
width: parent.width
height: root.height
height: root.height - (keyboardRaised ? 200 : 0)
radius: 4
color: hifi.colors.baseGray

View file

@ -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; }