Merge pull request #13811 from thoys/fix/create/deactivateCreateWhenWindowsClosed

MS16958: deactivate Create App when desktop windows are closed
This commit is contained in:
John Conklin II 2018-08-13 11:51:32 -07:00 committed by GitHub
commit a6e5ce76c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 1 deletions

View file

@ -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);
}

View file

@ -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;
};

View file

@ -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
};