aboutsummaryrefslogtreecommitdiff
path: root/js/stage/objects-tray.reel/objects-tray.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/stage/objects-tray.reel/objects-tray.js')
-rw-r--r--js/stage/objects-tray.reel/objects-tray.js140
1 files changed, 140 insertions, 0 deletions
diff --git a/js/stage/objects-tray.reel/objects-tray.js b/js/stage/objects-tray.reel/objects-tray.js
new file mode 100644
index 00000000..75ece4c3
--- /dev/null
+++ b/js/stage/objects-tray.reel/objects-tray.js
@@ -0,0 +1,140 @@
1/* <copyright>
2 This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5 </copyright> */
6
7/**
8 @requires montage/core/core
9 @requires montage/ui/component
10 */
11var Montage = require("montage/core/core").Montage,
12 Component = require("montage/ui/component").Component;
13
14exports.ObjectsTray = Montage.create(Component, {
15 hideClass : { value: 'hide-objects-tray'},
16 _empty : { value: null },
17 _workspaceMode : { value: null },
18
19 iconsRepetition : {
20 value: null
21 },
22 offStageObjectsController : {
23 value: null
24 },
25
26 _showAllObjects : { value: null },
27 showAllObjects : {
28 get : function() { return this._showAllObjects; },
29 set : function(value) {
30 if(value === this._showAllObjects) { return; }
31
32 this._showAllObjects = value;
33
34 this.needsDraw = true;
35 }
36 },
37
38 workspaceMode : {
39 get : function() { return this._workspaceMode; },
40 set : function(value) {
41 if(value === this._workspaceMode) { return; }
42
43 var toHide = (value !== 'binding');
44
45 setTimeout(function() {
46 this.hide = toHide;
47 }.bind(this), 200);
48
49 this._workspaceMode = value;
50
51 this.needsDraw = true;
52 }
53 },
54
55 _objects: { value: null },
56 objects: {
57 get: function() {
58 return this._objects;
59 },
60 set: function(value) {
61 this._objects = value;
62 this.needsDraw = true;
63 }
64 },
65
66 offStageObjectFilter : {
67 value: function(obj) {
68 if(this.showAllObjects) {
69 return true;
70 }
71
72 return this.application.ninja.objectsController.isOffStageObject(obj);
73 }
74 },
75
76 _hide : { value: null },
77 hide : {
78 get : function() { return this._hide; },
79 set : function(value) {
80 if(value === this._hide) { return; }
81
82 this._hide = value;
83
84 this.needsDraw = true;
85 }
86 },
87
88 displayHUDForObject : {
89 value: function(object) {
90 this.parentComponent.boundComponents.push(object);
91 }
92 },
93
94 /* ---------------------
95 Draw Cycle
96 --------------------- */
97
98 templateDidLoad: {
99 value: function() {
100 this.offStageObjectsController.filterFunction = this.offStageObjectFilter.bind(this);
101 }
102 },
103
104 prepareForDraw : {
105 value: function() {
106
107 Object.defineBinding(this, 'workspaceMode', {
108 "boundObject": this.application.ninja,
109 "boundObjectPropertyPath": "workspaceMode",
110 "oneway": true
111 });
112
113 Object.defineBinding(this, 'objects', {
114 "boundObject": this.application.ninja.objectsController,
115 "boundObjectPropertyPath": "objects",
116 "oneway": true
117 });
118
119 }
120 },
121 willDraw : {
122 value: function() {
123 if(this.objects) {
124 this._empty = !this.offStageObjectsController.organizedObjects.length;
125 } else {
126 this._empty = true;
127 }
128 }
129 },
130 draw : {
131 value: function() {
132 if(this.hide || this._empty) {
133 this.element.classList.add(this.hideClass);
134 } else {
135 this.element.classList.remove(this.hideClass);
136 }
137 }
138 }
139
140}); \ No newline at end of file