mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 08:16:21 +02:00
Added Hotkey Listening to the webview
Ctrl + P and Ctrl + Shift + P are now available even if the edit window has been selected
This commit is contained in:
parent
f5d266a562
commit
dcbe3c622d
7 changed files with 52 additions and 47 deletions
|
@ -1374,12 +1374,6 @@ var keyReleaseEvent = function (event) {
|
|||
});
|
||||
grid.setPosition(newPosition);
|
||||
}
|
||||
} else if (event.text === 'p' && event.isControl && !event.isAutoRepeat ) {
|
||||
if (event.isShifted) {
|
||||
unparentSelectedEntities();
|
||||
} else {
|
||||
parentSelectedEntities();
|
||||
}
|
||||
}
|
||||
};
|
||||
Controller.keyReleaseEvent.connect(keyReleaseEvent);
|
||||
|
@ -1586,6 +1580,7 @@ var PropertiesTool = function (opts) {
|
|||
print('Edit.js received web event that was not valid json.')
|
||||
return;
|
||||
}
|
||||
print(JSON.stringify(data))
|
||||
var i, properties, dY, diff, newPosition;
|
||||
if (data.type === "print") {
|
||||
if (data.message) {
|
||||
|
@ -1924,7 +1919,11 @@ var particleExplorerTool = new ParticleExplorerTool();
|
|||
var selectedParticleEntity = 0;
|
||||
entityListTool.webView.webEventReceived.connect(function (data) {
|
||||
data = JSON.parse(data);
|
||||
if (data.type === "selectionUpdate") {
|
||||
if(data.type === 'parent') {
|
||||
parentSelectedEntities();
|
||||
} else if(data.type === 'unparent') {
|
||||
unparentSelectedEntities();
|
||||
} else if (data.type === "selectionUpdate") {
|
||||
var ids = data.entityIds;
|
||||
if (ids.length === 1) {
|
||||
if (Entities.getEntityProperties(ids[0], "type").type === "ParticleEffect") {
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
<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>
|
||||
<script type="text/javascript" src="js/parentingHotkey.js"></script>
|
||||
</head>
|
||||
<body onload='loaded();'>
|
||||
<div id="entity-list-header">
|
||||
|
@ -91,7 +90,6 @@
|
|||
</tfoot>
|
||||
</table>
|
||||
|
||||
<input type="button" class="green" id="parent" value="Parent" />
|
||||
<div id="no-entities">
|
||||
No entities found <span id="no-entities-in-view">in view</span> within a <span id="no-entities-radius">100</span> meter radius. Try moving to a different location and refreshing.
|
||||
</div>
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
<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>
|
||||
<script type="text/javascript" src="js/parentingHotkey.js"></script>
|
||||
</head>
|
||||
<body onload='loaded();'>
|
||||
<div id="properties-list">
|
||||
|
|
|
@ -292,6 +292,13 @@ function loaded() {
|
|||
EventBridge.emitWebEvent(JSON.stringify({ type: 'delete' }));
|
||||
refreshEntities();
|
||||
}
|
||||
if (keyDownEvent.keyCode === 80 && keyDownEvent.ctrlKey) {
|
||||
if (keyDownEvent.shiftKey) {
|
||||
EventBridge.emitWebEvent(JSON.stringify({ type: 'unparent' }));
|
||||
} else {
|
||||
EventBridge.emitWebEvent(JSON.stringify({ type: 'parent' }));
|
||||
}
|
||||
}
|
||||
}, false);
|
||||
|
||||
var isFilterInView = false;
|
||||
|
@ -426,4 +433,3 @@ function loaded() {
|
|||
event.preventDefault();
|
||||
}, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -1441,7 +1441,15 @@ function loaded() {
|
|||
}));
|
||||
});
|
||||
|
||||
|
||||
document.addEventListener("keydown", function (keyDown) {
|
||||
if (keyDown.keyCode === 80 && keyDown.ctrlKey) {
|
||||
if (keyDown.shiftKey) {
|
||||
EventBridge.emitWebEvent(JSON.stringify({ type: 'unparent' }));
|
||||
} else {
|
||||
EventBridge.emitWebEvent(JSON.stringify({ type: 'parent' }));
|
||||
}
|
||||
}
|
||||
});
|
||||
window.onblur = function() {
|
||||
// Fake a change event
|
||||
var ev = document.createEvent("HTMLEvents");
|
||||
|
|
|
@ -131,10 +131,17 @@ function loaded() {
|
|||
|
||||
EventBridge.emitWebEvent(JSON.stringify({ type: 'init' }));
|
||||
});
|
||||
|
||||
document.addEventListener("keydown", function (keyDown) {
|
||||
if (keyDown.keyCode === 80 && keyDown.ctrlKey) {
|
||||
if (keyDown.shiftKey) {
|
||||
EventBridge.emitWebEvent(JSON.stringify({ type: 'unparent' }));
|
||||
} else {
|
||||
EventBridge.emitWebEvent(JSON.stringify({ type: 'parent' }));
|
||||
}
|
||||
}
|
||||
})
|
||||
// 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();
|
||||
}, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
var keyReleaseEvent = function (event) {
|
||||
if (event.text === 'p' && event.isControl && !event.isAutoRepeat ) {
|
||||
if (event.isShifted) {
|
||||
EventBridge.emitWebEvent(JSON.stringify({ type: 'unparent' }));
|
||||
} else {
|
||||
EventBridge.emitWebEvent(JSON.stringify({ type: 'parent' }));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
window.onkeypress = keyReleaseEvent;
|
||||
Controller.keyReleaseEvent.connect(keyReleaseEvent);
|
Loading…
Reference in a new issue