mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 20:44:14 +02:00
Add keyboard
This commit is contained in:
parent
f3a99a2437
commit
d141d5b683
2 changed files with 54 additions and 12 deletions
|
@ -89,9 +89,7 @@ Preference {
|
|||
root.browser = null;
|
||||
});
|
||||
} else {
|
||||
root.browser = tabletAvatarBrowserBuilder.createObject(tabletRoot, {
|
||||
createGlobalEventBridgeSource: eventBridgeJavaScriptToInject
|
||||
});
|
||||
root.browser = tabletAvatarBrowserBuilder.createObject(tabletRoot);
|
||||
|
||||
// Make dialog modal.
|
||||
tabletRoot.openModal = root.browser;
|
||||
|
@ -101,7 +99,9 @@ Preference {
|
|||
|
||||
Component {
|
||||
id: tabletAvatarBrowserBuilder;
|
||||
TabletAvatarBrowser { }
|
||||
TabletAvatarBrowser {
|
||||
eventBridge: tabletRoot.eventBridge
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,17 +25,16 @@ Item {
|
|||
|
||||
property var result
|
||||
|
||||
property bool keyboardEnabled: false
|
||||
property bool keyboardRaised: false
|
||||
property bool punctuationMode: false
|
||||
|
||||
signal selected(var modelUrl)
|
||||
signal canceled()
|
||||
|
||||
anchors.fill: parent
|
||||
property alias eventBridge: eventBridgeWrapper.eventBridge
|
||||
|
||||
/*
|
||||
Rectangle {
|
||||
id: pane // Surrogate for ScrollingWindow's pane.
|
||||
anchors.fill: parent
|
||||
}
|
||||
*/
|
||||
anchors.fill: parent
|
||||
|
||||
BaseWebView {
|
||||
id: webview
|
||||
|
@ -48,6 +47,32 @@ Item {
|
|||
right: parent.right
|
||||
bottom: footer.top
|
||||
}
|
||||
|
||||
QtObject {
|
||||
id: eventBridgeWrapper
|
||||
WebChannel.id: "eventBridgeWrapper"
|
||||
property var eventBridge;
|
||||
}
|
||||
|
||||
webChannel.registeredObjects: [eventBridgeWrapper]
|
||||
|
||||
// Create a global EventBridge object for raiseAndLowerKeyboard.
|
||||
WebEngineScript {
|
||||
id: createGlobalEventBridge
|
||||
sourceCode: eventBridgeJavaScriptToInject
|
||||
injectionPoint: WebEngineScript.DocumentCreation
|
||||
worldId: WebEngineScript.MainWorld
|
||||
}
|
||||
|
||||
// Detect when may want to raise and lower keyboard.
|
||||
WebEngineScript {
|
||||
id: raiseAndLowerKeyboard
|
||||
injectionPoint: WebEngineScript.Deferred
|
||||
sourceUrl: resourceDirectoryUrl + "html/raiseAndLowerKeyboard.js"
|
||||
worldId: WebEngineScript.MainWorld
|
||||
}
|
||||
|
||||
userScripts: [ createGlobalEventBridge, raiseAndLowerKeyboard ]
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
|
@ -57,7 +82,7 @@ Item {
|
|||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
bottom: keyboard.top
|
||||
}
|
||||
|
||||
color: hifi.colors.baseGray
|
||||
|
@ -76,4 +101,21 @@ Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Keyboard {
|
||||
id: keyboard
|
||||
|
||||
raised: parent.keyboardEnabled && parent.keyboardRaised
|
||||
numeric: parent.punctuationMode
|
||||
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
keyboardEnabled = HMD.active;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue