From e9b359feb1afcb7ecbc27edd15fa1c8859355422 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Thu, 2 Jun 2016 19:15:19 -0700 Subject: [PATCH] Make QML overlays disappear, use fade for non-window types --- interface/resources/qml/desktop/Desktop.qml | 39 ++++++++++++++----- .../resources/qml/windows/ModalWindow.qml | 2 +- scripts/system/libraries/toolBars.js | 2 +- 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/interface/resources/qml/desktop/Desktop.qml b/interface/resources/qml/desktop/Desktop.qml index c3b1b0ad6e..241cd91611 100644 --- a/interface/resources/qml/desktop/Desktop.qml +++ b/interface/resources/qml/desktop/Desktop.qml @@ -268,24 +268,45 @@ FocusScope { pinned = newPinned } - onPinnedChanged: { + property real unpinnedAlpha: 1.0; + Behavior on unpinnedAlpha { + NumberAnimation { + easing.type: Easing.Linear; + duration: 300 + } + } + + state: "NORMAL" + states: [ + State { + name: "NORMAL" + PropertyChanges { target: desktop; unpinnedAlpha: 1.0 } + }, + State { + name: "PINNED" + PropertyChanges { target: desktop; unpinnedAlpha: 0.0 } + } + ] + + transitions: [ + Transition { + NumberAnimation { properties: "unpinnedAlpha"; duration: 300 } + } + ] + + onPinnedChanged: { if (pinned) { + // recalculate our non-pinned children hiddenChildren = d.findMatchingChildren(desktop, function(child){ return !d.isTopLevelWindow(child) && child.visible; }); hiddenChildren.forEach(function(child){ - child.visible = false; + child.opacity = Qt.binding(function(){ return desktop.unpinnedAlpha }); }); - } else { - hiddenChildren.forEach(function(child){ - if (child) { - child.visible = true; - } - }); - hiddenChildren = []; } + state = pinned ? "PINNED" : "NORMAL" } onShowDesktop: pinned = false diff --git a/interface/resources/qml/windows/ModalWindow.qml b/interface/resources/qml/windows/ModalWindow.qml index 144165e4e1..f79dc9084f 100644 --- a/interface/resources/qml/windows/ModalWindow.qml +++ b/interface/resources/qml/windows/ModalWindow.qml @@ -16,7 +16,7 @@ Window { id: window modality: Qt.ApplicationModal destroyOnCloseButton: true - destroyOnInvisible: true + destroyOnHidden: true frame: ModalFrame { } property int colorScheme: hifi.colorSchemes.light diff --git a/scripts/system/libraries/toolBars.js b/scripts/system/libraries/toolBars.js index 9efe533457..f021f456bf 100644 --- a/scripts/system/libraries/toolBars.js +++ b/scripts/system/libraries/toolBars.js @@ -256,7 +256,7 @@ ToolBar = function(x, y, direction, optionalPersistenceKey, optionalInitialPosit y: y - ToolBar.SPACING }); } - this.save(); + //this.save(); } this.setAlpha = function(alpha, tool) {