From 6a27268ebf1cd5fa7bf8313eb5712fd5f6985758 Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Fri, 8 Jun 2012 11:29:13 -0700 Subject: Render Hud Multiple Signed-off-by: Armen Kesablyan --- .../binding-hud.reel/binding-hud.js | 23 ++++++++------- js/stage/binding-view.reel/binding-view.js | 34 ++++++++++++++++++---- 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, { }, set: function(val) { this._bindingArgs = val; - this.title = this.bindingArgs.sourceObject.identifier; - this.x = this._bindingArgs.sourceObject.element.offsetLeft; - this.y = this._bindingArgs.sourceObject.element.offsetTop; + this.title = this.bindingArgs.component.identifier; + this.x = this._bindingArgs.component.element.offsetLeft; + this.y = this._bindingArgs.component.element.offsetTop; + this.properties = this._bindingArgs.properties; this.needsDraw = true; console.log("Binding Args Set", val); } @@ -62,14 +63,14 @@ exports.BindingHud = Montage.create(Component, { prepareForDraw: { value: function() { - var arrProperties = this.application.ninja.objectsController.getEnumerableProperties(this._bindingArgs.sourceObject, true); - arrProperties.forEach(function(obj) { - var objBound = false; - if(this._bindingArgs._boundObjectPropertyPath === obj) { - objBound = true; - } - this.properties.push({"title":obj, "bound": objBound}); - }.bind(this)); +// var arrProperties = this.application.ninja.objectsController.getEnumerableProperties(this._bindingArgs.sourceObject, true); +// arrProperties.forEach(function(obj) { +// var objBound = false; +// if(this._bindingArgs._boundObjectPropertyPath === obj) { +// objBound = true; +// } +// this.properties.push({"title":obj, "bound": objBound}); +// }.bind(this)); } }, 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, { value: null }, - //Bindables Format: [ - - //] + componentsList: { + value: {} + }, + + /* + + Bindables Format: [ + + ] + */ _bindables: { value: [] }, - _nonVisualComponents: { value:[] }, @@ -54,12 +60,28 @@ exports.BindingView = Montage.create(Component, { this._selectedComponent = val; this.application.ninja.objectsController.currentObject = this.selectedComponent; var arrBindings = this.application.ninja.objectsController.currentObjectBindings; + var arrProperties = this.application.ninja.objectsController.getPropertyList(this.selectedComponent, true); + //Add the first component which is the selected one to have a hud debugger; + this.componentsList[this.selectedComponent.identifier] = {"component": this.selectedComponent, "properties": this.application.ninja.objectsController.getPropertyList(this.selectedComponent, true)}; + console.log("components:",this.componentsList); + //Go through the loop and find every interacted object by bindings arrBindings.forEach(function(obj) { - + if(typeof (this.componentsList[obj.boundObject.identifier]) === "undefined") { + var componentListItem = {} + componentListItem.component = obj.boundObject; + componentListItem.properties = []; + this.application.ninja.objectsController.getPropertiesFromObject(obj.boundObject, true).forEach(function(obj) { + componentListItem.properties.push({"title":obj}) + }.bind(this)); + this.componentsList[obj.boundObject.identifier] = componentListItem; + } }.bind(this)); - this.bindables.push(this._selectedComponent); + for(var key in this.componentsList){ + this.bindables.push(this.componentsList[key]); + } + console.log(this.bindables); // Get Bindings that exist; -- cgit v1.2.3