aboutsummaryrefslogtreecommitdiff
path: root/js/stage/binding-view.reel/binding-view.js
diff options
context:
space:
mode:
authorArmen Kesablyan2012-06-11 10:44:59 -0700
committerArmen Kesablyan2012-06-11 10:44:59 -0700
commitcd8f5e98dd1ba97d81a7f1f2362f9ce481577957 (patch)
treedef5a2feb656cbddde613e756655c2023b8f0bce /js/stage/binding-view.reel/binding-view.js
parent6a27268ebf1cd5fa7bf8313eb5712fd5f6985758 (diff)
downloadninja-cd8f5e98dd1ba97d81a7f1f2362f9ce481577957.tar.gz
Binding-View : Deselect Works Now, Rendering multiple Huds Available
Signed-off-by: Armen Kesablyan <armen@motorola.com>
Diffstat (limited to 'js/stage/binding-view.reel/binding-view.js')
-rwxr-xr-xjs/stage/binding-view.reel/binding-view.js135
1 files changed, 74 insertions, 61 deletions
diff --git a/js/stage/binding-view.reel/binding-view.js b/js/stage/binding-view.reel/binding-view.js
index 01a71202..900d2b24 100755
--- a/js/stage/binding-view.reel/binding-view.js
+++ b/js/stage/binding-view.reel/binding-view.js
@@ -17,17 +17,50 @@ exports.BindingView = Montage.create(Component, {
17 value: null 17 value: null
18 }, 18 },
19 19
20 componentsList: { 20 //Move variables
21 value: {} 21 _translateX : {
22 value: 0
22 }, 23 },
23 24
24 /* 25 _translateY: {
26 value: 0
27 },
28
29 translateX : {
30 get: function() {
31 return this._translateX;
32 },
33 set: function(val) {
34 this._translateX = val;
35 console.log("x", this._translateX);
36 }
37 },
38
39 translateY: {
40 get: function() {
41 return this._translateY;
42 },
43 set: function(val) {
44 this._translateY = val;
45 console.log("y", this._translateY);
46 }
47 },
48
49 handleMousedown: {
50 value: function(e) {
51 validateOverHud(e.clientX, e.clientY);
52 }
53 },
25 54
26 Bindables Format: [ 55 validateOverHud: {
56 value: function() {
27 57
28 ] 58 }
29 */ 59 },
30 60
61 componentsList: {
62 value: {}
63 },
31 64
32 _bindables: { 65 _bindables: {
33 value: [] 66 value: []
@@ -58,35 +91,36 @@ exports.BindingView = Montage.create(Component, {
58 }, 91 },
59 set: function(val) { 92 set: function(val) {
60 this._selectedComponent = val; 93 this._selectedComponent = val;
61 this.application.ninja.objectsController.currentObject = this.selectedComponent; 94 if(this._selectedComponent !== null) {
62 var arrBindings = this.application.ninja.objectsController.currentObjectBindings; 95 this.application.ninja.objectsController.currentObject = this.selectedComponent;
63 var arrProperties = this.application.ninja.objectsController.getPropertyList(this.selectedComponent, true); 96 var arrBindings = this.application.ninja.objectsController.currentObjectBindings;
64 97 var arrProperties = this.application.ninja.objectsController.getPropertyList(this.selectedComponent, true);
65 //Add the first component which is the selected one to have a hud 98
66 debugger; 99 //Add the first component which is the selected one to have a hud
67 this.componentsList[this.selectedComponent.identifier] = {"component": this.selectedComponent, "properties": this.application.ninja.objectsController.getPropertyList(this.selectedComponent, true)}; 100
68 console.log("components:",this.componentsList); 101 this.componentsList[this.selectedComponent.identifier] = {"component": this.selectedComponent, "properties": this.application.ninja.objectsController.getPropertyList(this.selectedComponent, true)};
69 //Go through the loop and find every interacted object by bindings 102 console.log("components:",this.componentsList);
70 arrBindings.forEach(function(obj) { 103 //Go through the loop and find every interacted object by bindings
71 if(typeof (this.componentsList[obj.boundObject.identifier]) === "undefined") { 104 arrBindings.forEach(function(obj) {
72 var componentListItem = {} 105 if(typeof (this.componentsList[obj.boundObject.identifier]) === "undefined") {
73 componentListItem.component = obj.boundObject; 106 var componentListItem = {}
74 componentListItem.properties = []; 107 componentListItem.component = obj.boundObject;
75 this.application.ninja.objectsController.getPropertiesFromObject(obj.boundObject, true).forEach(function(obj) { 108 componentListItem.properties = [];
76 componentListItem.properties.push({"title":obj}) 109 this.application.ninja.objectsController.getPropertiesFromObject(obj.boundObject, true).forEach(function(obj) {
77 }.bind(this)); 110 componentListItem.properties.push({"title":obj})
78 this.componentsList[obj.boundObject.identifier] = componentListItem; 111 }.bind(this));
112 this.componentsList[obj.boundObject.identifier] = componentListItem;
113 }
114 }.bind(this));
115 for(var key in this.componentsList){
116 this.bindables.push(this.componentsList[key]);
79 } 117 }
80 }.bind(this)); 118 console.log(this.bindables);
81 for(var key in this.componentsList){ 119 // Get Bindings that exist;
82 this.bindables.push(this.componentsList[key]);
83 }
84 console.log(this.bindables);
85 // Get Bindings that exist;
86 120
87 121
88 //Get Properties of Elements in bindings; 122 //Get Properties of Elements in bindings;
89 123 }
90 this.needsDraw = true; 124 this.needsDraw = true;
91 } 125 }
92 }, 126 },
@@ -137,41 +171,14 @@ exports.BindingView = Montage.create(Component, {
137 draw: { 171 draw: {
138 value: function() { 172 value: function() {
139 if(this.selectedComponent !== null) { 173 if(this.selectedComponent !== null) {
140// this.bindables = [
141// {
142// "title": "Input1",
143// "properties": [
144// {"title":"Value",
145// "bindings": [
146// {"direction": "<-", "boundObject":"Checkbox1", "boundProperty": "Value"}
147// ]
148// },
149// {"title": "Width", "bindings": []}
150// ],
151// "x": 20,
152// "y": 20
153// },
154// {
155// "title": "Checkbox1",
156// "properties": [
157// {"title":"Group" , "bindings": []},
158// {"title":"Value",
159// "bindings": [
160// {"direction": "->", "boundObject":"Input1", "boundProperty": "Value"}
161// ]
162// }
163// ],
164// "x": 120,
165// "y": 120
166// }
167// ];
168 this.canvas.width = this.application.ninja.stage.drawingCanvas.offsetWidth; 174 this.canvas.width = this.application.ninja.stage.drawingCanvas.offsetWidth;
169 this.canvas.height = this.application.ninja.stage.drawingCanvas.offsetHeight; 175 this.canvas.height = this.application.ninja.stage.drawingCanvas.offsetHeight;
170 this.clearCanvas(); 176 this.clearCanvas();
171 this.drawBlueLine(110,53,210,173); 177 this.drawBlueLine(110,53,210,173);
172 178
173 } else { 179 } else {
174 //this.bindables = []; 180 this.bindables = [];
181 this.clearCanvas();
175 } 182 }
176 183
177 } 184 }
@@ -195,6 +202,12 @@ exports.BindingView = Montage.create(Component, {
195 } 202 }
196 }, 203 },
197 204
205 handleMousemove: {
206 value: function() {
207
208 }
209 },
210
198 handleMousedown: { 211 handleMousedown: {
199 value: function(event) { 212 value: function(event) {
200 213