diff options
author | Armen Kesablyan | 2012-06-11 10:44:59 -0700 |
---|---|---|
committer | Armen Kesablyan | 2012-06-11 10:44:59 -0700 |
commit | cd8f5e98dd1ba97d81a7f1f2362f9ce481577957 (patch) | |
tree | def5a2feb656cbddde613e756655c2023b8f0bce | |
parent | 6a27268ebf1cd5fa7bf8313eb5712fd5f6985758 (diff) | |
download | ninja-cd8f5e98dd1ba97d81a7f1f2362f9ce481577957.tar.gz |
Binding-View : Deselect Works Now, Rendering multiple Huds Available
Signed-off-by: Armen Kesablyan <armen@motorola.com>
-rwxr-xr-x | js/stage/binding-view.reel/binding-hud-option.reel/binding-hud-option.js | 11 | ||||
-rwxr-xr-x | js/stage/binding-view.reel/binding-hud.reel/binding-hud.js | 18 | ||||
-rwxr-xr-x | js/stage/binding-view.reel/binding-view.html | 11 | ||||
-rwxr-xr-x | js/stage/binding-view.reel/binding-view.js | 135 | ||||
-rw-r--r-- | js/tools/bindingTool.js | 7 |
5 files changed, 110 insertions, 72 deletions
diff --git a/js/stage/binding-view.reel/binding-hud-option.reel/binding-hud-option.js b/js/stage/binding-view.reel/binding-hud-option.reel/binding-hud-option.js index 78189415..3eda272c 100755 --- a/js/stage/binding-view.reel/binding-hud-option.reel/binding-hud-option.js +++ b/js/stage/binding-view.reel/binding-hud-option.reel/binding-hud-option.js | |||
@@ -39,10 +39,15 @@ exports.BindingHudOption = Montage.create(Component, { | |||
39 | return this._hudOptions; | 39 | return this._hudOptions; |
40 | }, | 40 | }, |
41 | set: function(val) { | 41 | set: function(val) { |
42 | this._hudOptions = val; | 42 | if (typeof(val) !== "undefined") { |
43 | this.title = val.title; | 43 | this._hudOptions = val; |
44 | this.bound = val.bound; | 44 | this.title = val.title; |
45 | this.bound = val.bound; | ||
46 | } else { | ||
47 | this._hudOptions = null; | ||
48 | } | ||
45 | this.needsDraw = true; | 49 | this.needsDraw = true; |
50 | |||
46 | } | 51 | } |
47 | }, | 52 | }, |
48 | 53 | ||
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 88229683..acd072f9 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 | |||
@@ -25,13 +25,17 @@ exports.BindingHud = Montage.create(Component, { | |||
25 | return this._bindingArgs; | 25 | return this._bindingArgs; |
26 | }, | 26 | }, |
27 | set: function(val) { | 27 | set: function(val) { |
28 | this._bindingArgs = val; | 28 | if (typeof(val) !== "undefined") { |
29 | this.title = this.bindingArgs.component.identifier; | 29 | this._bindingArgs = val; |
30 | this.x = this._bindingArgs.component.element.offsetLeft; | 30 | this.title = this.bindingArgs.component.identifier; |
31 | this.y = this._bindingArgs.component.element.offsetTop; | 31 | this.x = this._bindingArgs.component.element.offsetLeft; |
32 | this.properties = this._bindingArgs.properties; | 32 | this.y = this._bindingArgs.component.element.offsetTop; |
33 | this.needsDraw = true; | 33 | this.properties = this._bindingArgs.properties; |
34 | console.log("Binding Args Set", val); | 34 | this.needsDraw = true; |
35 | console.log("Binding Args Set", val); | ||
36 | } else { | ||
37 | this.properties = []; | ||
38 | } | ||
35 | } | 39 | } |
36 | }, | 40 | }, |
37 | 41 | ||
diff --git a/js/stage/binding-view.reel/binding-view.html b/js/stage/binding-view.reel/binding-view.html index 4eea3cc4..90ef2286 100755 --- a/js/stage/binding-view.reel/binding-view.html +++ b/js/stage/binding-view.reel/binding-view.html | |||
@@ -37,6 +37,17 @@ | |||
37 | "bindingArgs": {"<-": "@hudRepeater.objectAtCurrentIteration"} | 37 | "bindingArgs": {"<-": "@hudRepeater.objectAtCurrentIteration"} |
38 | } | 38 | } |
39 | }, | 39 | }, |
40 | "translateComposer": { | ||
41 | "prototype": "montage/ui/composer/translate-composer", | ||
42 | "properties": { | ||
43 | "component": {"@": "owner"} | ||
44 | }, | ||
45 | "bindings": { | ||
46 | "element": {"<-": "@owner._element"}, | ||
47 | "translateX": {"->": "@owner.translateX"}, | ||
48 | "translateY": {"->": "@owner.translateY"} | ||
49 | } | ||
50 | }, | ||
40 | "nonVisualRepeater": { | 51 | "nonVisualRepeater": { |
41 | "prototype": "montage/ui/repetition.reel", | 52 | "prototype": "montage/ui/repetition.reel", |
42 | "properties": { | 53 | "properties": { |
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 | // }, | ||