aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Guzman2012-06-19 15:55:17 -0700
committerEric Guzman2012-06-19 15:55:17 -0700
commit72efb92273d20757097b18326fb31d070a6d693d (patch)
treebb39c42e692591cced1a706ae9a3d340455b1615
parent2ef72cdf0e59fb3623a2c13251ac707522f3dc5a (diff)
downloadninja-72efb92273d20757097b18326fb31d070a6d693d.tar.gz
Objects Tray - Show only "off stage" objects
-rw-r--r--js/controllers/objects-controller.js5
-rw-r--r--js/stage/objects-tray.reel/objects-tray.html3
-rw-r--r--js/stage/objects-tray.reel/objects-tray.js32
3 files changed, 35 insertions, 5 deletions
diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js
index 877f7f9f..3a6f6e97 100644
--- a/js/controllers/objects-controller.js
+++ b/js/controllers/objects-controller.js
@@ -4,14 +4,13 @@
4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. 4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5 </copyright> */ 5 </copyright> */
6 6
7var Montage = require("montage/core/core").Montage, 7var Montage = require("montage/core/core").Montage;
8 Component = require("montage/ui/component").Component;
9 8
10var CATEGORIES = { 9var CATEGORIES = {
11 10
12}; 11};
13 12
14var objectsController = exports.ObjectsController = Montage.create(Component, { 13var objectsController = exports.ObjectsController = Montage.create(Montage, {
15 14
16 _currentDocument : { 15 _currentDocument : {
17 value : null, 16 value : null,
diff --git a/js/stage/objects-tray.reel/objects-tray.html b/js/stage/objects-tray.reel/objects-tray.html
index 0fece3fe..710e3edf 100644
--- a/js/stage/objects-tray.reel/objects-tray.html
+++ b/js/stage/objects-tray.reel/objects-tray.html
@@ -14,7 +14,8 @@
14 "owner": { 14 "owner": {
15 "prototype": "js/stage/objects-tray.reel", 15 "prototype": "js/stage/objects-tray.reel",
16 "properties": { 16 "properties": {
17 "element": {"#": "objects-tray"} 17 "element": {"#": "objects-tray"},
18 "offStageObjectsController": {"@": "arrayController"}
18 } 19 }
19 }, 20 },
20 "repetition" : { 21 "repetition" : {
diff --git a/js/stage/objects-tray.reel/objects-tray.js b/js/stage/objects-tray.reel/objects-tray.js
index 190abf57..3872c8b6 100644
--- a/js/stage/objects-tray.reel/objects-tray.js
+++ b/js/stage/objects-tray.reel/objects-tray.js
@@ -15,6 +15,23 @@ exports.ObjectsTray = Montage.create(Component, {
15 hideClass : { value: 'hide-objects-tray'}, 15 hideClass : { value: 'hide-objects-tray'},
16 _empty : { value: null }, 16 _empty : { value: null },
17 _workspaceMode : { value: null }, 17 _workspaceMode : { value: null },
18
19 offStageObjectsController : {
20 value: null
21 },
22
23 _showAllObjects : { value: null },
24 showAllObjects : {
25 get : function() { return this._showAllObjects; },
26 set : function(value) {
27 if(value === this._showAllObjects) { return; }
28
29 this._showAllObjects = value;
30
31 this.needsDraw = true;
32 }
33 },
34
18 workspaceMode : { 35 workspaceMode : {
19 get : function() { return this._workspaceMode; }, 36 get : function() { return this._workspaceMode; },
20 set : function(value) { 37 set : function(value) {
@@ -43,6 +60,19 @@ exports.ObjectsTray = Montage.create(Component, {
43 } 60 }
44 }, 61 },
45 62
63 offStageObjectFilter : {
64 value: function(obj) {
65 if(this.showAllObjects) {
66 return true;
67 }
68
69 var isComponent = this.application.ninja.objectsController._hasPrototype(obj, "Component"),
70 hasValidElement = obj.element && obj.element.parentNode;
71
72 return !isComponent || !hasValidElement;
73 }
74 },
75
46 _hide : { value: null }, 76 _hide : { value: null },
47 hide : { 77 hide : {
48 get : function() { return this._hide; }, 78 get : function() { return this._hide; },
@@ -58,7 +88,7 @@ exports.ObjectsTray = Montage.create(Component, {
58 88
59 templateDidLoad: { 89 templateDidLoad: {
60 value: function() { 90 value: function() {
61 console.log('objects panel loaded'); 91 this.offStageObjectsController.filterFunction = this.offStageObjectFilter.bind(this);
62 } 92 }
63 }, 93 },
64 94