mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-13 10:18:15 +02:00
Raise and lower keyboard in entities editor
This commit is contained in:
parent
2344d15dbc
commit
a94d77ee12
7 changed files with 50 additions and 0 deletions
|
@ -14,6 +14,7 @@
|
|||
<script type="text/javascript" src="qrc:///qtwebchannel/qwebchannel.js"></script>
|
||||
<script type="text/javascript" src="js/eventBridgeLoader.js"></script>
|
||||
<script type="text/javascript" src="js/spinButtons.js"></script>
|
||||
<script type="text/javascript" src="js/keyboardControl.js"></script>
|
||||
<script type="text/javascript" src="js/entityList.js"></script>
|
||||
</head>
|
||||
<body onload='loaded();'>
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
<script type="text/javascript" src="qrc:///qtwebchannel/qwebchannel.js"></script>
|
||||
<script type="text/javascript" src="js/eventBridgeLoader.js"></script>
|
||||
<script type="text/javascript" src="js/spinButtons.js"></script>
|
||||
<script type="text/javascript" src="js/keyboardControl.js"></script>
|
||||
<script type="text/javascript" src="js/entityProperties.js"></script>
|
||||
<script src="js/jsoneditor.min.js"></script>
|
||||
</head>
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<script type="text/javascript" src="qrc:///qtwebchannel/qwebchannel.js"></script>
|
||||
<script type="text/javascript" src="js/eventBridgeLoader.js"></script>
|
||||
<script type="text/javascript" src="js/spinButtons.js"></script>
|
||||
<script type="text/javascript" src="js/keyboardControl.js"></script>
|
||||
<script type="text/javascript" src="js/gridControls.js"></script>
|
||||
</head>
|
||||
<body onload='loaded();'>
|
||||
|
|
|
@ -412,6 +412,8 @@ function loaded() {
|
|||
|
||||
augmentSpinButtons();
|
||||
|
||||
setUpKeyboardControl();
|
||||
|
||||
// Disable right-click context menu which is not visible in the HMD and makes it seem like the app has locked
|
||||
document.addEventListener("contextmenu", function (event) {
|
||||
event.preventDefault();
|
||||
|
|
|
@ -1590,6 +1590,8 @@ function loaded() {
|
|||
|
||||
augmentSpinButtons();
|
||||
|
||||
setUpKeyboardControl();
|
||||
|
||||
// Disable right-click context menu which is not visible in the HMD and makes it seem like the app has locked
|
||||
document.addEventListener("contextmenu", function(event) {
|
||||
event.preventDefault();
|
||||
|
|
|
@ -127,6 +127,8 @@ function loaded() {
|
|||
|
||||
augmentSpinButtons();
|
||||
|
||||
setUpKeyboardControl();
|
||||
|
||||
EventBridge.emitWebEvent(JSON.stringify({ type: 'init' }));
|
||||
});
|
||||
|
||||
|
|
41
scripts/system/html/js/keyboardControl.js
Normal file
41
scripts/system/html/js/keyboardControl.js
Normal file
|
@ -0,0 +1,41 @@
|
|||
//
|
||||
// keyboardControl.js
|
||||
//
|
||||
// Created by David Rowe on 28 Sep 2016.
|
||||
// Copyright 2016 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
function setUpKeyboardControl() {
|
||||
|
||||
var lowerTimer = null;
|
||||
|
||||
function raiseKeyboard() {
|
||||
if (lowerTimer !== null) {
|
||||
clearTimeout(lowerTimer);
|
||||
lowerTimer = null;
|
||||
}
|
||||
EventBridge.emitWebEvent("_RAISE_KEYBOARD");
|
||||
}
|
||||
|
||||
function doLowerKeyboard() {
|
||||
EventBridge.emitWebEvent("_LOWER_KEYBOARD");
|
||||
lowerTimer = null;
|
||||
}
|
||||
|
||||
function lowerKeyboard() {
|
||||
// Delay lowering keyboard a little in case immediately raise it again.
|
||||
if (lowerTimer === null) {
|
||||
lowerTimer = setTimeout(doLowerKeyboard, 20);
|
||||
}
|
||||
}
|
||||
|
||||
var inputs = document.querySelectorAll("input[type=text], input[type=number], textarea");
|
||||
for (var i = 0, length = inputs.length; i < length; i++) {
|
||||
inputs[i].addEventListener("focus", raiseKeyboard);
|
||||
inputs[i].addEventListener("blur", lowerKeyboard);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in a new issue