From 49596f2a6b518ed0ee945006787d3c69e40a5757 Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Thu, 22 Mar 2012 14:31:12 -0700 Subject: Updated Resizers for Panels and timeline Signed-off-by: Armen Kesablyan --- js/ninja.reel/ninja.js | 107 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) (limited to 'js/ninja.reel/ninja.js') diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index 2a6e49f7..e29c5057 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js @@ -23,6 +23,80 @@ exports.Ninja = Montage.create(Component, { value: null }, + _isResizing: { + value: false + }, + _resizedHeight : { + value: 0 + }, + _height: { + value: null + }, + + height: { + get: function() { + return this._height; + }, + set: function(val) { + if(this._height != val) { + this._height = val; + this.needsDraw = true; + } + + } + }, + + _resizedWidth : { + value: 0 + }, + _width: { + value: null + }, + + width: { + get: function() { + return this._width; + }, + set: function(val) { + if(this._width != val) { + this._width = val; + this.needsDraw = true; + } + + } + }, + + handleResizeStart: { + value:function(e) { + this.isResizing = true; + this.height = parseInt(this.timeline.element.offsetHeight); + this.width = parseInt(this.rightPanelContainer.offsetWidth); + this.needsDraw = true; + } + }, + + handleResizeMove: { + value:function(e) { + this._resizedHeight = e._event.dY; + this._resizedWidth = e._event.dX; + console.log("resizing"); + this.stage.resizeCanvases = true; + this.needsDraw = true; + } + }, + + handleResizeEnd: { + value: function(e) { + this.height -= this._resizedHeight; + this.width -= this._resizedWidth; + this.stage.resizeCanvases = true; + this._resizedHeight = 0; + this._resizedWidth = 0; + this.isResizing = false; + this.needsDraw = true; + } + }, + selectedElements: { value: [] }, @@ -78,12 +152,45 @@ exports.Ninja = Montage.create(Component, { } }, + willDraw: { + value: function() { + if (this.height === null) { + this.height = parseInt(this.timeline.element.offsetHeight); + } + if (this.width === null) { + this.width = parseInt(this.rightPanelContainer.offsetWidth); + } + } + }, + + draw: { + value: function() { + if (this.height - this._resizedHeight < 30) { + this.timelineSplitter.collapsed = true; + } else { + this.timelineSplitter.collapsed = false; + } + if (this.width - this._resizedWidth < 30) { + this.panelSplitter.collapsed = true; + } else { + this.panelSplitter.collapsed = false; + } + + this.timeline.element.style.height = (this.height - this._resizedHeight) + "px"; + this.rightPanelContainer.style.width = (this.width - this._resizedWidth) + "px"; + } + }, + _didDraw: { value: false }, didDraw: { value: function() { + if (!this.isResizing) { + this.height = this.timeline.element.offsetHeight; + this.width = this.rightPanelContainer.offsetWidth; + } if(!this._didDraw) { if (!this.application.ninja.coreIoApi.ioServiceDetected) { var check = this.application.ninja.coreIoApi.cloudAvailable(); -- cgit v1.2.3