mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 14:13:47 +02:00
Merge pull request #13811 from thoys/fix/create/deactivateCreateWhenWindowsClosed
MS16958: deactivate Create App when desktop windows are closed
This commit is contained in:
commit
a6e5ce76c6
3 changed files with 28 additions and 1 deletions
|
@ -806,6 +806,14 @@ var toolBar = (function () {
|
|||
|
||||
addButton("newMaterialButton", createNewEntityDialogButtonCallback("Material"));
|
||||
|
||||
var deactivateCreateIfDesktopWindowsHidden = function() {
|
||||
if (!shouldUseEditTabletApp() && !entityListTool.isVisible() && !createToolsWindow.isVisible()) {
|
||||
that.setActive(false);
|
||||
}
|
||||
};
|
||||
entityListTool.interactiveWindowHidden.addListener(this, deactivateCreateIfDesktopWindowsHidden);
|
||||
createToolsWindow.interactiveWindowHidden.addListener(this, deactivateCreateIfDesktopWindowsHidden);
|
||||
|
||||
that.setActive(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,6 +59,10 @@ EntityListTool = function(shouldUseEditTabletApp) {
|
|||
entityListWindow.setVisible(!shouldUseEditTabletApp() && visible);
|
||||
};
|
||||
|
||||
that.isVisible = function() {
|
||||
return entityListWindow.isVisible();
|
||||
};
|
||||
|
||||
that.setVisible(false);
|
||||
|
||||
function emitJSONScriptEvent(data) {
|
||||
|
@ -244,6 +248,7 @@ EntityListTool = function(shouldUseEditTabletApp) {
|
|||
|
||||
webView.webEventReceived.connect(onWebEventReceived);
|
||||
entityListWindow.webEventReceived.addListener(onWebEventReceived);
|
||||
that.interactiveWindowHidden = entityListWindow.interactiveWindowHidden;
|
||||
|
||||
return that;
|
||||
};
|
||||
|
|
|
@ -75,6 +75,7 @@ module.exports = (function() {
|
|||
this.settingsKey = settingsKey;
|
||||
this.defaultRect = defaultRect;
|
||||
this.webEventReceived = new CallableEvent();
|
||||
this.interactiveWindowHidden = new CallableEvent();
|
||||
this.fromQml = new CallableEvent();
|
||||
if (createOnStartup) {
|
||||
this.createWindow();
|
||||
|
@ -108,10 +109,16 @@ module.exports = (function() {
|
|||
this.window.sizeChanged.connect(this, windowRectChanged);
|
||||
this.window.positionChanged.connect(this, windowRectChanged);
|
||||
|
||||
this.window.webEventReceived.connect(this, function (data) {
|
||||
this.window.webEventReceived.connect(this, function(data) {
|
||||
this.webEventReceived.call(data);
|
||||
});
|
||||
|
||||
this.window.visibleChanged.connect(this, function() {
|
||||
if (!this.window.visible) {
|
||||
this.interactiveWindowHidden.call();
|
||||
}
|
||||
});
|
||||
|
||||
this.window.fromQml.connect(this, function (data) {
|
||||
this.fromQml.call(data);
|
||||
});
|
||||
|
@ -133,6 +140,12 @@ module.exports = (function() {
|
|||
}
|
||||
}
|
||||
},
|
||||
isVisible: function() {
|
||||
if (this.window) {
|
||||
return this.window.visible;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
emitScriptEvent: function(data) {
|
||||
if (this.window) {
|
||||
this.window.emitScriptEvent(data);
|
||||
|
@ -144,6 +157,7 @@ module.exports = (function() {
|
|||
}
|
||||
},
|
||||
webEventReceived: null,
|
||||
interactiveWindowHidden: null,
|
||||
fromQml: null
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue