From cfa2d42f6ca65eb3ce1bea92db5f4af87dd68bb5 Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Wed, 13 Jun 2012 11:36:01 -0700 Subject: Binding-View: Translate huds Signed-off-by: Armen Kesablyan --- .../binding-hud.reel/binding-hud.css | 2 +- .../binding-hud.reel/binding-hud.html | 21 ++++++ .../binding-hud.reel/binding-hud.js | 74 ++++++++++++++++++++-- 3 files changed, 92 insertions(+), 5 deletions(-) (limited to 'js/stage/binding-view.reel/binding-hud.reel') diff --git a/js/stage/binding-view.reel/binding-hud.reel/binding-hud.css b/js/stage/binding-view.reel/binding-hud.reel/binding-hud.css index aa204be7..e177963f 100755 --- a/js/stage/binding-view.reel/binding-hud.reel/binding-hud.css +++ b/js/stage/binding-view.reel/binding-hud.reel/binding-hud.css @@ -40,7 +40,7 @@ line-height:16px; padding:1px 9px; } -.hudOption.bound, .bindingHud .hudOption.bound .connectorBubble { +.hudOption.bound, .bindingHud .hudOption.bound .connectorBubble, .bindingHud .hudOption:hover, .bindingHud .hudOption .connectorBubble { background: #5e9eff; display:block; } diff --git a/js/stage/binding-view.reel/binding-hud.reel/binding-hud.html b/js/stage/binding-view.reel/binding-hud.reel/binding-hud.html index afa4cd47..38d2a2ec 100755 --- a/js/stage/binding-view.reel/binding-hud.reel/binding-hud.html +++ b/js/stage/binding-view.reel/binding-hud.reel/binding-hud.html @@ -35,6 +35,27 @@ "bindings": { "hudOptions": {"<-": "@repeater.objectAtCurrentIteration"} } + }, + "resizer1": { + "prototype": "js/panels/resize-composer", + "properties": { + "element": {"#": "title"}, + "component": {"@": "owner"} + }, + "listeners": [ + { + "type": "resizeStart", + "listener": {"@": "owner"} + }, + { + "type": "resizeMove", + "listener": {"@": "owner"} + }, + { + "type": "resizeEnd", + "listener": {"@": "owner"} + } + ] } } 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 acd072f9..5053d3bb 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 @@ -44,14 +44,75 @@ exports.BindingHud = Montage.create(Component, { ] }, - x: { + _isResizing: { + value: null + }, + + _resizedX : { + value: 0 + }, + + _resizedY: { + value: 0 + }, + + handleResizeStart: { + value:function(e) { + this.isResizing = true; + this.x = parseInt(this.x); + this.y = parseInt(this.y); + this.needsDraw = true; + } + }, + + handleResizeMove: { + value:function(e) { + this._resizedY = e._event.dY; + this._resizedX = e._event.dX; + this.needsDraw = true; + } + }, + + handleResizeEnd: { + value: function(e) { + this.x += this._resizedX; + this.y += this._resizedY; + this._resizedX = 0; + this._resizedY = 0; + this.isResizing = false; + this.needsDraw = true; + } + }, + + _x: { value: 20 }, - y: { + _y: { value: 100 }, + x: { + get: function() { + return this._x; + }, + set: function(val) { + this._x = val; + console.log(this._x); + this.needsDraw = true; + } + }, + + y: { + get: function() { + return this._y; + }, + set: function(val) { + this._y = val; + this.needsDraw = true; + } + }, + _title: { value: "default" }, @@ -81,8 +142,13 @@ exports.BindingHud = Montage.create(Component, { draw: { value: function() { this.titleElement.innerHTML = this.title; - this.element.style.top = this.y + "px"; - this.element.style.left = this.x + "px"; + +// if(this.isResizing) { +// this.timelineSplitter.collapsed = this.height - this._resizedHeight < 46; +// this.panelSplitter.collapsed = this.width - this._resizedWidth < 30; +// } + this.element.style.top = (this.y + this._resizedY) + "px"; + this.element.style.left = (this.x + this._resizedX) + "px"; console.log("hud",this); } } -- cgit v1.2.3