diff options
Diffstat (limited to 'js/stage')
-rw-r--r-- | js/stage/objects-tray.reel/objects-tray.html | 3 | ||||
-rw-r--r-- | js/stage/objects-tray.reel/objects-tray.js | 32 |
2 files changed, 33 insertions, 2 deletions
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 | ||