aboutsummaryrefslogtreecommitdiff
path: root/js/stage
diff options
context:
space:
mode:
authorEric Guzman2012-06-27 10:30:12 -0700
committerEric Guzman2012-06-27 10:30:12 -0700
commit8cd463b321d082770a4300756b6664bb7a519c93 (patch)
tree23473ae23b5c583572050b4b1c30d52e05c4e550 /js/stage
parent31a164700e95fb9bf37169eccdb009895452b8bf (diff)
downloadninja-8cd463b321d082770a4300756b6664bb7a519c93.tar.gz
Binding HUD - Show promoted PI properties at top of list
Diffstat (limited to 'js/stage')
-rwxr-xr-xjs/stage/binding-view.reel/binding-hud.reel/binding-hud.js46
-rwxr-xr-xjs/stage/binding-view.reel/binding-view.html6
2 files changed, 45 insertions, 7 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 9918b06d..0f1b99c9 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
@@ -45,7 +45,10 @@ exports.BindingHud = Montage.create(Component, {
45 optionsRepeater: { 45 optionsRepeater: {
46 value: null 46 value: null
47 }, 47 },
48 48 panelData : {
49 value: null,
50 serializable: true
51 },
49 _userComponent: { value: null }, 52 _userComponent: { value: null },
50 userComponent: { 53 userComponent: {
51 get: function() { 54 get: function() {
@@ -59,7 +62,7 @@ exports.BindingHud = Montage.create(Component, {
59 isOffStage, icon, iconOffsets; 62 isOffStage, icon, iconOffsets;
60 63
61 this._userComponent = val; 64 this._userComponent = val;
62 this.properties = controller.getPropertiesFromObject(val, true); 65 this.properties = this.getPropertyList(val); //controller.getPropertiesFromObject(val, true);
63 66
64 controller.getObjectBindings(this.userComponent).forEach(function(obj) { 67 controller.getObjectBindings(this.userComponent).forEach(function(obj) {
65 this.boundProperties.push(obj.sourceObjectPropertyPath); 68 this.boundProperties.push(obj.sourceObjectPropertyPath);
@@ -84,6 +87,37 @@ exports.BindingHud = Montage.create(Component, {
84 } 87 }
85 }, 88 },
86 89
90 getPropertyList : {
91 value: function(component) {
92 var props = this.application.ninja.objectsController.getPropertiesFromObject(component, true);
93
94 var objectName, promotedProperties;
95
96 if(this.userComponent._montage_metadata) {
97 objectName = this.userComponent._montage_metadata.objectName;
98
99 if(this.panelData && this.panelData[objectName + 'Pi']) {
100
101 promotedProperties = this.panelData[objectName + 'Pi'][0].Section.map(function(item) {
102 return item[0].prop;
103 });
104
105 //// Remove promoted properties from current position in array
106 props = props.filter(function(prop) {
107 return promotedProperties.indexOf(prop) === -1;
108 });
109
110 //// Add them at the top
111
112 props = promotedProperties.concat(props);
113
114 }
115 }
116
117 return props;
118 }
119 },
120
87 properties: { value: [] }, 121 properties: { value: [] },
88 122
89 _isResizing: { 123 _isResizing: {
@@ -248,11 +282,11 @@ exports.BindingHud = Montage.create(Component, {
248 if(direction === "down") { 282 if(direction === "down") {
249 this.scrollInterval = setInterval(function() { 283 this.scrollInterval = setInterval(function() {
250 this.optionsRepeater.element.scrollTop += 3; 284 this.optionsRepeater.element.scrollTop += 3;
251 }.bind(this), 50); 285 }.bind(this), 20);
252 } else { 286 } else {
253 this.scrollInterval = setInterval(function() { 287 this.scrollInterval = setInterval(function() {
254 this.optionsRepeater.element.scrollTop -= 3; 288 this.optionsRepeater.element.scrollTop -= 3;
255 }.bind(this), 50); 289 }.bind(this), 20);
256 } 290 }
257 } 291 }
258 } 292 }
@@ -267,11 +301,11 @@ exports.BindingHud = Montage.create(Component, {
267 //e._event.target.parentElement.controller.currentScrollDirection = "down"; 301 //e._event.target.parentElement.controller.currentScrollDirection = "down";
268 this.scrollInterval = setInterval(function() { 302 this.scrollInterval = setInterval(function() {
269 self.optionsRepeater.element.scrollTop += 3; 303 self.optionsRepeater.element.scrollTop += 3;
270 }, 50); 304 }, 20);
271 } else { 305 } else {
272 this.scrollInterval = setInterval(function() { 306 this.scrollInterval = setInterval(function() {
273 self.optionsRepeater.element.scrollTop -= 3; 307 self.optionsRepeater.element.scrollTop -= 3;
274 }, 50); 308 }, 20);
275 } 309 }
276 } 310 }
277 } 311 }
diff --git a/js/stage/binding-view.reel/binding-view.html b/js/stage/binding-view.reel/binding-view.html
index 9eb338d8..b6c5ff40 100755
--- a/js/stage/binding-view.reel/binding-view.html
+++ b/js/stage/binding-view.reel/binding-view.html
@@ -37,7 +37,8 @@
37 "hud": { 37 "hud": {
38 "prototype": "js/stage/binding-view.reel/binding-hud.reel", 38 "prototype": "js/stage/binding-view.reel/binding-hud.reel",
39 "properties": { 39 "properties": {
40 "element": {"#" : "hud"} 40 "element": {"#" : "hud"},
41 "panelData": {"@": "panelData"}
41 }, 42 },
42 "bindings": { 43 "bindings": {
43 "userComponent": {"<-": "@hudRepeater.objectAtCurrentIteration"} 44 "userComponent": {"<-": "@hudRepeater.objectAtCurrentIteration"}
@@ -48,6 +49,9 @@
48 "listener": {"@": "owner"} 49 "listener": {"@": "owner"}
49 } 50 }
50 ] 51 ]
52 },
53 "panelData": {
54 "object": "js/data/pi/pi-data[PiData]"
51 } 55 }
52 } 56 }
53 </script> 57 </script>