aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmen Kesablyan2012-06-08 11:29:13 -0700
committerArmen Kesablyan2012-06-08 11:29:13 -0700
commit6a27268ebf1cd5fa7bf8313eb5712fd5f6985758 (patch)
tree3f2b11529d8384ee7348152844e723a29a0f2df1
parent7e66e84d1ee4d1816c811b8eb6f236f97cf8224b (diff)
downloadninja-6a27268ebf1cd5fa7bf8313eb5712fd5f6985758.tar.gz
Render Hud Multiple
Signed-off-by: Armen Kesablyan <armen@motorola.com>
-rwxr-xr-xjs/stage/binding-view.reel/binding-hud.reel/binding-hud.js23
-rwxr-xr-xjs/stage/binding-view.reel/binding-view.js34
2 files changed, 40 insertions, 17 deletions
diff --git a/js/stage/binding-view.reel/binding-hud.reel/binding-hud.js b/js/stage/binding-view.reel/binding-hud.reel/binding-hud.js
index 14347a32..88229683 100755
--- a/js/stage/binding-view.reel/binding-hud.reel/binding-hud.js
+++ b/js/stage/binding-view.reel/binding-hud.reel/binding-hud.js
@@ -26,9 +26,10 @@ exports.BindingHud = Montage.create(Component, {
26 }, 26 },
27 set: function(val) { 27 set: function(val) {
28 this._bindingArgs = val; 28 this._bindingArgs = val;
29 this.title = this.bindingArgs.sourceObject.identifier; 29 this.title = this.bindingArgs.component.identifier;
30 this.x = this._bindingArgs.sourceObject.element.offsetLeft; 30 this.x = this._bindingArgs.component.element.offsetLeft;
31 this.y = this._bindingArgs.sourceObject.element.offsetTop; 31 this.y = this._bindingArgs.component.element.offsetTop;
32 this.properties = this._bindingArgs.properties;
32 this.needsDraw = true; 33 this.needsDraw = true;
33 console.log("Binding Args Set", val); 34 console.log("Binding Args Set", val);
34 } 35 }
@@ -62,14 +63,14 @@ exports.BindingHud = Montage.create(Component, {
62 63
63 prepareForDraw: { 64 prepareForDraw: {
64 value: function() { 65 value: function() {
65 var arrProperties = this.application.ninja.objectsController.getEnumerableProperties(this._bindingArgs.sourceObject, true); 66// var arrProperties = this.application.ninja.objectsController.getEnumerableProperties(this._bindingArgs.sourceObject, true);
66 arrProperties.forEach(function(obj) { 67// arrProperties.forEach(function(obj) {
67 var objBound = false; 68// var objBound = false;
68 if(this._bindingArgs._boundObjectPropertyPath === obj) { 69// if(this._bindingArgs._boundObjectPropertyPath === obj) {
69 objBound = true; 70// objBound = true;
70 } 71// }
71 this.properties.push({"title":obj, "bound": objBound}); 72// this.properties.push({"title":obj, "bound": objBound});
72 }.bind(this)); 73// }.bind(this));
73 } 74 }
74 }, 75 },
75 76
diff --git a/js/stage/binding-view.reel/binding-view.js b/js/stage/binding-view.reel/binding-view.js
index 1457e2fc..01a71202 100755
--- a/js/stage/binding-view.reel/binding-view.js
+++ b/js/stage/binding-view.reel/binding-view.js
@@ -17,16 +17,22 @@ exports.BindingView = Montage.create(Component, {
17 value: null 17 value: null
18 }, 18 },
19 19
20 //Bindables Format: [ 20 componentsList: {
21 21 value: {}
22 //] 22 },
23
24 /*
25
26 Bindables Format: [
27
28 ]
29 */
23 30
24 31
25 _bindables: { 32 _bindables: {
26 value: [] 33 value: []
27 }, 34 },
28 35
29
30 _nonVisualComponents: { 36 _nonVisualComponents: {
31 value:[] 37 value:[]
32 }, 38 },
@@ -54,12 +60,28 @@ exports.BindingView = Montage.create(Component, {
54 this._selectedComponent = val; 60 this._selectedComponent = val;
55 this.application.ninja.objectsController.currentObject = this.selectedComponent; 61 this.application.ninja.objectsController.currentObject = this.selectedComponent;
56 var arrBindings = this.application.ninja.objectsController.currentObjectBindings; 62 var arrBindings = this.application.ninja.objectsController.currentObjectBindings;
63 var arrProperties = this.application.ninja.objectsController.getPropertyList(this.selectedComponent, true);
57 64
65 //Add the first component which is the selected one to have a hud
58 debugger; 66 debugger;
67 this.componentsList[this.selectedComponent.identifier] = {"component": this.selectedComponent, "properties": this.application.ninja.objectsController.getPropertyList(this.selectedComponent, true)};
68 console.log("components:",this.componentsList);
69 //Go through the loop and find every interacted object by bindings
59 arrBindings.forEach(function(obj) { 70 arrBindings.forEach(function(obj) {
60 71 if(typeof (this.componentsList[obj.boundObject.identifier]) === "undefined") {
72 var componentListItem = {}
73 componentListItem.component = obj.boundObject;
74 componentListItem.properties = [];
75 this.application.ninja.objectsController.getPropertiesFromObject(obj.boundObject, true).forEach(function(obj) {
76 componentListItem.properties.push({"title":obj})
77 }.bind(this));
78 this.componentsList[obj.boundObject.identifier] = componentListItem;
79 }
61 }.bind(this)); 80 }.bind(this));
62 this.bindables.push(this._selectedComponent); 81 for(var key in this.componentsList){
82 this.bindables.push(this.componentsList[key]);
83 }
84 console.log(this.bindables);
63 // Get Bindings that exist; 85 // Get Bindings that exist;
64 86
65 87