diff options
author | Armen Kesablyan | 2012-07-02 13:19:20 -0700 |
---|---|---|
committer | Armen Kesablyan | 2012-07-02 13:19:20 -0700 |
commit | 526b9d76686323f488f1b26175440172b715d808 (patch) | |
tree | 47fc6bd90715b403a08d08a48a86f4d24da1ba29 /js/stage/binding-view.reel/binding-hud.reel/binding-hud.js | |
parent | b194664df7e01aaeb8d1e7220a6de0e7f879f1db (diff) | |
parent | 12de4e49a309e210c13eb40b2ffa158ef2eb54a7 (diff) | |
download | ninja-526b9d76686323f488f1b26175440172b715d808.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal
Diffstat (limited to 'js/stage/binding-view.reel/binding-hud.reel/binding-hud.js')
-rwxr-xr-x | js/stage/binding-view.reel/binding-hud.reel/binding-hud.js | 86 |
1 files changed, 44 insertions, 42 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 6b802cb0..1b0af09d 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 | |||
@@ -10,6 +10,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
10 | */ | 10 | */ |
11 | var Montage = require("montage/core/core").Montage, | 11 | var Montage = require("montage/core/core").Montage, |
12 | Component = require("montage/ui/component").Component; | 12 | Component = require("montage/ui/component").Component; |
13 | var ElementsMediator = require("js/mediators/element-mediator").ElementMediator; | ||
13 | 14 | ||
14 | exports.BindingHud = Montage.create(Component, { | 15 | exports.BindingHud = Montage.create(Component, { |
15 | scrollUp: { | 16 | scrollUp: { |
@@ -49,10 +50,10 @@ exports.BindingHud = Montage.create(Component, { | |||
49 | value: null, | 50 | value: null, |
50 | serializable: true | 51 | serializable: true |
51 | }, | 52 | }, |
52 | _userComponent: { value: null }, | 53 | _userElement: { value: null }, |
53 | userComponent: { | 54 | userElement: { |
54 | get: function() { | 55 | get: function() { |
55 | return this._userComponent; | 56 | return this._userElement; |
56 | }, | 57 | }, |
57 | set: function(val) { | 58 | set: function(val) { |
58 | if(!val) { return; } | 59 | if(!val) { return; } |
@@ -61,14 +62,14 @@ exports.BindingHud = Montage.create(Component, { | |||
61 | bindingView = this.parentComponent.parentComponent, | 62 | bindingView = this.parentComponent.parentComponent, |
62 | isOffStage, icon, iconOffsets; | 63 | isOffStage, icon, iconOffsets; |
63 | 64 | ||
64 | this._userComponent = val; | 65 | this._userElement = val; |
65 | this.properties = this.getPropertyList(val); //controller.getPropertiesFromObject(val, true); | 66 | this.properties = this.getPropertyList(val.controller); //controller.getPropertiesFromObject(val, true); |
66 | 67 | ||
67 | controller.getObjectBindings(this.userComponent).forEach(function(obj) { | 68 | controller.getObjectBindings(this._userElement.controller).forEach(function(obj) { |
68 | this.boundProperties.push(obj.sourceObjectPropertyPath); | 69 | this.boundProperties.push(obj.sourceObjectPropertyPath); |
69 | }, this); | 70 | }, this); |
70 | 71 | ||
71 | isOffStage = controller.isOffStageObject(val); | 72 | isOffStage = controller.isOffStageObject(val.controller); |
72 | 73 | ||
73 | if(isOffStage) { | 74 | if(isOffStage) { |
74 | icon = bindingView.getOffStageIcon(val); | 75 | icon = bindingView.getOffStageIcon(val); |
@@ -76,20 +77,33 @@ exports.BindingHud = Montage.create(Component, { | |||
76 | this.title = icon.name; | 77 | this.title = icon.name; |
77 | this.x = iconOffsets.x; | 78 | this.x = iconOffsets.x; |
78 | this.y = iconOffsets.y - 80; | 79 | this.y = iconOffsets.y - 80; |
80 | } else { | ||
81 | this.title = this._userElement.controller.identifier; | ||
82 | this.x = this._userElement.offsetLeft; | ||
83 | this.y = this._userElement.offsetTop; | ||
84 | // this.x = parseInt(ElementsMediator.getProperty(val, "left")); | ||
85 | // this.y = parseInt(ElementsMediator.getProperty(val, "top")); | ||
79 | } | 86 | } |
80 | this.needsDraw = true; | 87 | this.needsDraw = true; |
81 | |||
82 | } | 88 | } |
83 | }, | 89 | }, |
84 | 90 | ||
85 | getPropertyList : { | 91 | getPropertyList : { |
86 | value: function(component) { | 92 | value: function(component) { |
87 | var props = this.application.ninja.objectsController.getPropertiesFromObject(component, true); | 93 | var props = this.application.ninja.objectsController.getPropertiesFromObject(component, true), |
88 | 94 | promotedProperties = [], | |
89 | var objectName, promotedProperties; | 95 | objectName; |
96 | |||
97 | ///// Mapper - property to property object | ||
98 | function propertyMapper(property) { | ||
99 | return { | ||
100 | property: property, | ||
101 | promoted: promotedProperties.indexOf(property) !== -1 | ||
102 | } | ||
103 | } | ||
90 | 104 | ||
91 | if(this.userComponent._montage_metadata) { | 105 | if(this.userElement.controller._montage_metadata) { |
92 | objectName = this.userComponent._montage_metadata.objectName; | 106 | objectName = this.userElement.controller._montage_metadata.objectName; |
93 | 107 | ||
94 | if(this.panelData && this.panelData[objectName + 'Pi']) { | 108 | if(this.panelData && this.panelData[objectName + 'Pi']) { |
95 | 109 | ||
@@ -109,7 +123,7 @@ exports.BindingHud = Montage.create(Component, { | |||
109 | } | 123 | } |
110 | } | 124 | } |
111 | 125 | ||
112 | return props; | 126 | return props.map(propertyMapper); |
113 | } | 127 | } |
114 | }, | 128 | }, |
115 | 129 | ||
@@ -231,12 +245,6 @@ exports.BindingHud = Montage.create(Component, { | |||
231 | this.scrollUp.style.display = "block"; | 245 | this.scrollUp.style.display = "block"; |
232 | this.scrollDown.style.display = "block"; | 246 | this.scrollDown.style.display = "block"; |
233 | } | 247 | } |
234 | var isOffStage = this.application.ninja.objectsController.isOffStageObject(this.userComponent); | ||
235 | if(!isOffStage) { | ||
236 | this.title = this.userComponent.identifier; | ||
237 | this.x = this.userComponent.element.offsetLeft; | ||
238 | this.y = this.userComponent.element.offsetTop; | ||
239 | } | ||
240 | } | 248 | } |
241 | }, | 249 | }, |
242 | 250 | ||
@@ -295,22 +303,17 @@ exports.BindingHud = Montage.create(Component, { | |||
295 | 303 | ||
296 | handleMouseover: { | 304 | handleMouseover: { |
297 | value: function(e) { | 305 | value: function(e) { |
306 | |||
298 | if(this.scrollSpace < this.properties.length) { | 307 | if(this.scrollSpace < this.properties.length) { |
299 | if (this.scrollInterval === null) { | 308 | if (this.scrollInterval === null) { |
300 | if (e._event.target.classList.contains("scrollAreaBottom")) { | 309 | if (e._event.target.classList.contains("scrollAreaBottom")) { |
301 | self = e._event.target.parentElement.controller; | 310 | this.currentScrollDirection = "down"; |
302 | //e._event.target.parentElement.controller.currentScrollDirection = "down"; | ||
303 | this.scrollInterval = setInterval(function() { | ||
304 | self.optionsRepeater.element.scrollTop += 3; | ||
305 | }, 20); | ||
306 | } else { | 311 | } else { |
307 | this.scrollInterval = setInterval(function() { | 312 | this.currentScrollDirection = "up"; |
308 | self.optionsRepeater.element.scrollTop -= 3; | ||
309 | }, 20); | ||
310 | } | 313 | } |
311 | } | 314 | } |
312 | } | 315 | } |
313 | //this.needsDraw = true; | 316 | this.needsDraw = true; |
314 | } | 317 | } |
315 | }, | 318 | }, |
316 | 319 | ||
@@ -324,25 +327,24 @@ exports.BindingHud = Montage.create(Component, { | |||
324 | } | 327 | } |
325 | }, | 328 | }, |
326 | 329 | ||
327 | willDraw: { | 330 | draw: { |
328 | value: function() { | 331 | value: function() { |
329 | 332 | ||
330 | } | 333 | if(this.currentScrollDirection !== null) { |
331 | }, | 334 | this.scrollInterval = setInterval(function() { |
335 | if(this.currentScrollDirection === "down") { | ||
336 | this.optionsRepeater.element.scrollTop += 3; | ||
337 | } else { | ||
338 | this.optionsRepeater.element.scrollTop -= 3; | ||
339 | } | ||
340 | }.bind(this), 20); | ||
341 | } else { | ||
342 | clearInterval(this.scrollInterval); | ||
343 | } | ||
332 | 344 | ||
333 | draw: { | ||
334 | value: function() { | ||
335 | this.titleElement.innerHTML = this.title; | 345 | this.titleElement.innerHTML = this.title; |
336 | this.element.style.top = (this.y + this._resizedY) + "px"; | 346 | this.element.style.top = (this.y + this._resizedY) + "px"; |
337 | this.element.style.left = (this.x + this._resizedX) + "px"; | 347 | this.element.style.left = (this.x + this._resizedX) + "px"; |
338 | |||
339 | // if(this.currentScrollDirection !== null) { | ||
340 | // if(this.currentScrollDirection === "up") { | ||
341 | // this.optionsRepeater.element.scrollTop -= 18; | ||
342 | // } else { | ||
343 | // this.optionsRepeater.element.scrollTop += 18; | ||
344 | // } | ||
345 | // } | ||
346 | } | 348 | } |
347 | }, | 349 | }, |
348 | didDraw: { | 350 | didDraw: { |