From 9add37d85a9d90541daae8ad5316388c4d9a9da4 Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Thu, 28 Jun 2012 13:21:11 -0700 Subject: Binding View - Bug fix After save corrupts doom and breaks binding view Signed-off-by: Armen Kesablyan --- .../binding-hud.reel/binding-hud.js | 70 ++++++++++------------ 1 file changed, 32 insertions(+), 38 deletions(-) (limited to 'js/stage/binding-view.reel/binding-hud.reel') 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..58cf197f 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 */ var Montage = require("montage/core/core").Montage, Component = require("montage/ui/component").Component; +var ElementsMediator = require("js/mediators/element-mediator").ElementMediator; exports.BindingHud = Montage.create(Component, { scrollUp: { @@ -49,10 +50,10 @@ exports.BindingHud = Montage.create(Component, { value: null, serializable: true }, - _userComponent: { value: null }, - userComponent: { + _userElement: { value: null }, + userElement: { get: function() { - return this._userComponent; + return this._userElement; }, set: function(val) { if(!val) { return; } @@ -61,14 +62,14 @@ exports.BindingHud = Montage.create(Component, { bindingView = this.parentComponent.parentComponent, isOffStage, icon, iconOffsets; - this._userComponent = val; - this.properties = this.getPropertyList(val); //controller.getPropertiesFromObject(val, true); + this._userElement = val; + this.properties = this.getPropertyList(val.controller); //controller.getPropertiesFromObject(val, true); - controller.getObjectBindings(this.userComponent).forEach(function(obj) { + controller.getObjectBindings(this._userElement.controller).forEach(function(obj) { this.boundProperties.push(obj.sourceObjectPropertyPath); }, this); - isOffStage = controller.isOffStageObject(val); + isOffStage = controller.isOffStageObject(val.controller); if(isOffStage) { icon = bindingView.getOffStageIcon(val); @@ -76,9 +77,14 @@ exports.BindingHud = Montage.create(Component, { this.title = icon.name; this.x = iconOffsets.x; this.y = iconOffsets.y - 80; + } else { + this.title = this._userElement.controller.identifier; + this.x = this._userElement.offsetLeft; + this.y = this._userElement.offsetTop; +// this.x = parseInt(ElementsMediator.getProperty(val, "left")); +// this.y = parseInt(ElementsMediator.getProperty(val, "top")); } this.needsDraw = true; - } }, @@ -88,8 +94,8 @@ exports.BindingHud = Montage.create(Component, { var objectName, promotedProperties; - if(this.userComponent._montage_metadata) { - objectName = this.userComponent._montage_metadata.objectName; + if(this.userElement.controller._montage_metadata) { + objectName = this.userElement.controller._montage_metadata.objectName; if(this.panelData && this.panelData[objectName + 'Pi']) { @@ -231,12 +237,6 @@ exports.BindingHud = Montage.create(Component, { this.scrollUp.style.display = "block"; this.scrollDown.style.display = "block"; } - var isOffStage = this.application.ninja.objectsController.isOffStageObject(this.userComponent); - if(!isOffStage) { - this.title = this.userComponent.identifier; - this.x = this.userComponent.element.offsetLeft; - this.y = this.userComponent.element.offsetTop; - } } }, @@ -295,22 +295,17 @@ exports.BindingHud = Montage.create(Component, { handleMouseover: { value: function(e) { + if(this.scrollSpace < this.properties.length) { if (this.scrollInterval === null) { if (e._event.target.classList.contains("scrollAreaBottom")) { - self = e._event.target.parentElement.controller; - //e._event.target.parentElement.controller.currentScrollDirection = "down"; - this.scrollInterval = setInterval(function() { - self.optionsRepeater.element.scrollTop += 3; - }, 20); + this.currentScrollDirection = "down"; } else { - this.scrollInterval = setInterval(function() { - self.optionsRepeater.element.scrollTop -= 3; - }, 20); + this.currentScrollDirection = "up"; } } } - //this.needsDraw = true; + this.needsDraw = true; } }, @@ -324,25 +319,24 @@ exports.BindingHud = Montage.create(Component, { } }, - willDraw: { + draw: { value: function() { - } - }, + if(this.currentScrollDirection !== null) { + this.scrollInterval = setInterval(function() { + if(this.currentScrollDirection === "down") { + this.optionsRepeater.element.scrollTop += 3; + } else { + this.optionsRepeater.element.scrollTop -= 3; + } + }.bind(this), 20); + } else { + clearInterval(this.scrollInterval); + } - draw: { - value: function() { this.titleElement.innerHTML = this.title; this.element.style.top = (this.y + this._resizedY) + "px"; this.element.style.left = (this.x + this._resizedX) + "px"; - -// if(this.currentScrollDirection !== null) { -// if(this.currentScrollDirection === "up") { -// this.optionsRepeater.element.scrollTop -= 18; -// } else { -// this.optionsRepeater.element.scrollTop += 18; -// } -// } } }, didDraw: { -- cgit v1.2.3