From 84931583f1da8da29784074978f146b281b8efa3 Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Wed, 7 Mar 2012 16:08:36 -0800 Subject: Disabled state for panels Signed-off-by: Armen Kesablyan --- css/ninja.css | 2 ++ js/panels/Panel.reel/Panel.html | 20 +++++++++++++++++--- js/panels/Panel.reel/Panel.js | 4 ++++ js/panels/PanelContainer.reel/PanelContainer.js | 22 +++++++++++++++++++++- scss/imports/scss/_PanelUI.scss | 14 ++++++++++++++ 5 files changed, 58 insertions(+), 4 deletions(-) diff --git a/css/ninja.css b/css/ninja.css index f139c3b9..32514e96 100755 --- a/css/ninja.css +++ b/css/ninja.css @@ -655,6 +655,8 @@ body section .dragging { opacity: 0.4; } body .main .dragOver:not(.dragging) { background-color: #917B56; } +.panelDisabled { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 9999; color: white; text-align: center; line-height: 100px; box-shadow: inset 0 0 14px #111111; background: rgba(30, 30, 30, 0.7); } + .menuBar { width: 100%; border-style: solid; border-width: 1px; height: 22px; color: white; background: #474747; border-color: black; } .menuBar ul { list-style: none; margin: 0; padding: 0; float: left; cursor: default; } diff --git a/js/panels/Panel.reel/Panel.html b/js/panels/Panel.reel/Panel.html index 04e2930a..43b87940 100755 --- a/js/panels/Panel.reel/Panel.html +++ b/js/panels/Panel.reel/Panel.html @@ -113,6 +113,21 @@ } }, + "disabledCondition": { + "module": "montage/ui/condition.reel", + "name": "Condition", + "properties": { + "element": {"#": "disabledCondition"} + }, + "bindings": { + "condition": { + "boundObject": {"@": "owner"}, + "boundObjectPropertyPath": "disabled", + "oneway": true + } + } + }, + "owner": { "module": "js/panels/Panel.reel", "name": "Panel", @@ -136,9 +151,8 @@
-
- -
+
+
diff --git a/js/panels/Panel.reel/Panel.js b/js/panels/Panel.reel/Panel.js index 2b308258..33f9b3a7 100755 --- a/js/panels/Panel.reel/Panel.js +++ b/js/panels/Panel.reel/Panel.js @@ -57,6 +57,10 @@ exports.Panel = Montage.create(Component, { value: null }, + disabled: { + value:false + }, + collapsed: { get: function() { return this._collapsed; diff --git a/js/panels/PanelContainer.reel/PanelContainer.js b/js/panels/PanelContainer.reel/PanelContainer.js index b285b49d..c40bbc21 100755 --- a/js/panels/PanelContainer.reel/PanelContainer.js +++ b/js/panels/PanelContainer.reel/PanelContainer.js @@ -47,7 +47,7 @@ exports.PanelContainer = Montage.create(Component, { this['panel_'+i].flexible = p.flexible; this['panel_'+i].modulePath = p.modulePath; this['panel_'+i].moduleName = p.moduleName; - this['panel_'+i].index = i; + this['panel_'+i].disabled = true; this.currentPanelState[p.name] = {}; this.currentPanelState.version = "1.0"; @@ -65,6 +65,8 @@ exports.PanelContainer = Montage.create(Component, { this.application.localStorage.setItem("panels", this.currentPanelState); + this.eventManager.addEventListener( "onOpenDocument", this, false); + this.eventManager.addEventListener( "closeDocument", this, false); } }, @@ -85,6 +87,24 @@ exports.PanelContainer = Montage.create(Component, { this._redrawPanels(null, true); } }, + + handleOnOpenDocument: { + value: function(){ + this.panels.forEach(function(obj) { + obj.disabled = false; + }); + } + }, + + handleCloseDocument: { + value: function(){ + if(!this.application.ninja.documentController.activeDocument) { + this.panels.forEach(function(obj) { + obj.disabled = true; + }); + } + } + }, handleDropped: { value: function(e) { diff --git a/scss/imports/scss/_PanelUI.scss b/scss/imports/scss/_PanelUI.scss index b25871b0..2ac88b1d 100755 --- a/scss/imports/scss/_PanelUI.scss +++ b/scss/imports/scss/_PanelUI.scss @@ -1256,3 +1256,17 @@ body .main .dragOver:not(.dragging) { background-color: #917B56; } +.panelDisabled { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 9999; + color: white; + text-align: center; + line-height: 100px; + box-shadow: inset 0 0 14px #111111; + + background: rgba(30, 30, 30, 0.7); +} \ No newline at end of file -- cgit v1.2.3