mirror of
https://github.com/overte-org/overte.git
synced 2025-06-05 09:52:34 +02:00
added test / more docs
This commit is contained in:
parent
3f6793b462
commit
3a32472b0b
4 changed files with 40 additions and 2 deletions
|
@ -102,8 +102,8 @@ Windows.Window {
|
||||||
shown = false;
|
shown = false;
|
||||||
if (nativeWindow) {
|
if (nativeWindow) {
|
||||||
contentHolder.parent = nativeWindow.contentItem;
|
contentHolder.parent = nativeWindow.contentItem;
|
||||||
nativeWindow.setVisible(interactiveWindowVisible);
|
|
||||||
updateInteractiveWindowPositionForMode();
|
updateInteractiveWindowPositionForMode();
|
||||||
|
nativeWindow.setVisible(interactiveWindowVisible);
|
||||||
}
|
}
|
||||||
} else if (presentationMode === modeNotSet) {
|
} else if (presentationMode === modeNotSet) {
|
||||||
console.error("presentationMode should be set.");
|
console.error("presentationMode should be set.");
|
||||||
|
|
|
@ -24,6 +24,11 @@
|
||||||
*
|
*
|
||||||
* @hifi-interface
|
* @hifi-interface
|
||||||
* @hifi-client-entity
|
* @hifi-client-entity
|
||||||
|
*
|
||||||
|
* @property {number} width
|
||||||
|
* @property {number} height
|
||||||
|
* @property {number} ALWAYS_ON_TOP - InteractiveWindow flag for always showing a window on top
|
||||||
|
* @property {number} CLOSE_BUTTON_HIDES - InteractiveWindow flag for hiding the window instead of closing on window close by user
|
||||||
*/
|
*/
|
||||||
class DesktopScriptingInterface : public QObject, public Dependency {
|
class DesktopScriptingInterface : public QObject, public Dependency {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
|
@ -42,7 +42,6 @@ using namespace InteractiveWindowEnums;
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* @class InteractiveWindow
|
* @class InteractiveWindow
|
||||||
* @hideconstructor
|
|
||||||
*
|
*
|
||||||
* @hifi-interface
|
* @hifi-interface
|
||||||
* @hifi-client-en
|
* @hifi-client-en
|
||||||
|
|
34
scripts/developer/tests/interactiveWindowTest.js
Normal file
34
scripts/developer/tests/interactiveWindowTest.js
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
//
|
||||||
|
// interactiveWindowTest.js
|
||||||
|
//
|
||||||
|
// Created by Thijs Wenker on 2018-07-03
|
||||||
|
// Copyright 2018 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// An example of an interactive window that toggles presentation mode when toggling HMD on/off
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
|
||||||
|
function getPreferredPresentationMode() {
|
||||||
|
return HMD.active ? Desktop.PresentationMode.VIRTUAL : Desktop.PresentationMode.NATIVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPreferredTitle() {
|
||||||
|
return HMD.active ? 'Virtual Desktop Window' : 'Native Desktop Window';
|
||||||
|
}
|
||||||
|
|
||||||
|
var virtualWindow = Desktop.createWindow(Script.resourcesPath() + 'qml/OverlayWindowTest.qml', {
|
||||||
|
title: getPreferredTitle(),
|
||||||
|
flags: Desktop.ALWAYS_ON_TOP,
|
||||||
|
presentationMode: getPreferredPresentationMode(),
|
||||||
|
size: {x: 500, y: 400}
|
||||||
|
});
|
||||||
|
|
||||||
|
HMD.displayModeChanged.connect(function() {
|
||||||
|
virtualWindow.presentationMode = getPreferredPresentationMode();
|
||||||
|
virtualWindow.title = getPreferredTitle();
|
||||||
|
});
|
||||||
|
|
||||||
|
Script.scriptEnding.connect(function() {
|
||||||
|
virtualWindow.close();
|
||||||
|
});
|
Loading…
Reference in a new issue