From 4c3aac5eabd93052b1554a03d78235215bb49db4 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 29 May 2012 00:34:40 -0700 Subject: document bindings phase 1 - using array controller to bind the current document to all ninja components - removed open document event - removed references to the document controller Signed-off-by: Valerio Virgillito --- js/stage/stage.reel/stage.js | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) (limited to 'js/stage/stage.reel/stage.js') diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index c7afb95c..e00d2b54 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -155,25 +155,41 @@ exports.Stage = Montage.create(Component, { set: function(value) { this._userContentBorder = value; } }, - _activeDocument : { + _currentDocument: { value : null, enumerable : false }, - activeDocument : { + currentDocument : { get : function() { - return this._activeDocument; + return this._currentDocument; }, - set : function(document) { - ///// If the document is null set default stylesheets to null + set : function(value) { + // TODO: WRONG! Fails when going from design to code view + if (value === this._currentDocument || value.getProperty("currentView") !== "design") { + console.log("Stage - current document not set since the same value of " + this._currentDocument + " and value " + value); + return; + } - if(!document) { - return false; + if(!value) { + // Show the rulers + this.showRulers(); + // Show the canvas + this.hideCanvas(false); } - ///// setting document via binding - this._activeDocument = document; + //console.log("Stage - set current document with value of " + value); + this._currentDocument = value; + + if(this._currentDocument.currentView === "design") { + this.clearAllCanvas(); + this.initWithDocument(false); + } + if(!this._currentDocument) { + this.hideRulers(); + this.hideCanvas(true); + } }, enumerable : false }, @@ -295,9 +311,6 @@ exports.Stage = Montage.create(Component, { this._scrollLeft = 0; this._scrollTop = 0; - this.stageDeps.handleOpenDocument(); - this.layout.handleOpenDocument(); - if(designView._template) { var initialLeft = parseInt((this.canvas.width - designView._template.size.width)/2); var initialTop = parseInt((this.canvas.height - designView._template.size.height)/2); -- cgit v1.2.3 From 2fd6db5f46208a5aa8fa58d090f795e5b7eb99bb Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 29 May 2012 10:35:06 -0700 Subject: Sped up user-interaction by moving grid drawing into its own canvas so the layout code doesn't have to be run when modifying selected elements. Signed-off-by: Nivesh Rajbhandari --- js/stage/stage.reel/stage.js | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'js/stage/stage.reel/stage.js') diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index c7afb95c..d8684739 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -97,6 +97,12 @@ exports.Stage = Montage.create(Component, { _layoutCanvas: { value: null }, layoutCanvas: { get: function() { return this._layoutCanvas; } }, + _gridCanvas: { value: null }, + gridCanvas: { get: function() { return this._gridCanvas; } }, + + _gridContext: { value: null }, + gridContext: { get: function() { return this._gridContext; } }, + _drawingCanvas: { value: null }, drawingCanvas: { get: function() { return this._drawingCanvas; } }, @@ -207,11 +213,14 @@ exports.Stage = Montage.create(Component, { value: function() { if(this.resizeCanvases) { // TODO GET THE SCROLL SIZE FROM THE CSS -- 11 px - this._canvas.width = this._layoutCanvas.width = this._drawingCanvas.width = this.element.offsetWidth - 11 ; - this._canvas.height = this._layoutCanvas.height = this._drawingCanvas.height = this.element.offsetHeight - 11;// - 26 - 26; + this._canvas.width = this._layoutCanvas.width = this._drawingCanvas.width = this._gridCanvas.width = this.element.offsetWidth - 11 ; + this._canvas.height = this._layoutCanvas.height = this._drawingCanvas.height = this._gridCanvas.height = this.element.offsetHeight - 11;// - 26 - 26; // Hack for now until a full component this.layout.draw(); + if(this.application.ninja.currentDocument) { + this.layout.draw3DInfo(true); + } } else if(this.updatedStage) { this.layout.draw(); this.layout.draw3DInfo(true); @@ -231,6 +240,7 @@ exports.Stage = Montage.create(Component, { this._context = this._canvas.getContext("2d"); this._drawingContext= this._drawingCanvas.getContext("2d"); + this._gridContext= this._gridCanvas.getContext("2d"); // Setup event listeners this._drawingCanvas.addEventListener("mousedown", this, false); @@ -276,8 +286,8 @@ exports.Stage = Montage.create(Component, { this.hideCanvas(false); // Recalculate the canvas sizes because of splitter resizing - this._canvas.width = this._layoutCanvas.width = this._drawingCanvas.width = this.element.offsetWidth - 11 ; - this._canvas.height = this._layoutCanvas.height = this._drawingCanvas.height = this.element.offsetHeight - 11; + this._canvas.width = this._layoutCanvas.width = this._drawingCanvas.width = this._gridCanvas.width = this.element.offsetWidth - 11 ; + this._canvas.height = this._layoutCanvas.height = this._drawingCanvas.height = this._gridCanvas.height = this.element.offsetHeight - 11; designView.iframe.contentWindow.addEventListener("scroll", this, false); @@ -519,11 +529,12 @@ exports.Stage = Montage.create(Component, { this._canvas.style.visibility = "hidden"; this._layoutCanvas.style.visibility = "hidden"; this._drawingCanvas.style.visibility = "hidden"; + this._gridCanvas.style.visibility = "hidden"; } else { this._canvas.style.visibility = "visible"; this._layoutCanvas.style.visibility = "visible"; this._drawingCanvas.style.visibility = "visible"; - + this._gridCanvas.style.visibility = "visible"; } } }, @@ -560,10 +571,17 @@ exports.Stage = Montage.create(Component, { } }, + clearGridCanvas: { + value: function() { + this._gridContext.clearRect(0, 0, this._gridCanvas.width, this._gridCanvas.height); + } + }, + clearAllCanvas: { value: function() { this._drawingContext.clearRect(0, 0, this._drawingCanvas.width, this._drawingCanvas.height); this.context.clearRect(0, 0, this.canvas.width, this.canvas.height); + this._gridContext.clearRect(0, 0, this._gridCanvas.width, this._gridCanvas.height); this.layout.clearCanvas(); } }, -- cgit v1.2.3 From 4fa08fe2ce439a5f5c248c568f72d3828ee11b36 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 29 May 2012 11:43:55 -0700 Subject: fix for the document tab close button and rulers on initial document Signed-off-by: Valerio Virgillito --- js/stage/stage.reel/stage.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'js/stage/stage.reel/stage.js') diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index e00d2b54..a6e7c24f 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -171,10 +171,8 @@ exports.Stage = Montage.create(Component, { return; } - if(!value) { - // Show the rulers + if(!this._currentDocument) { this.showRulers(); - // Show the canvas this.hideCanvas(false); } @@ -186,7 +184,7 @@ exports.Stage = Montage.create(Component, { this.initWithDocument(false); } - if(!this._currentDocument) { + if(!value) { this.hideRulers(); this.hideCanvas(true); } -- cgit v1.2.3 From 961830a1ab076db70577df735f43cae5e8559e83 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 29 May 2012 14:55:19 -0700 Subject: Moving layout and stageDeps' handleOpenDocument into stage. Signed-off-by: Nivesh Rajbhandari --- js/stage/stage.reel/stage.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'js/stage/stage.reel/stage.js') diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index d8684739..44d6eadb 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -305,8 +305,7 @@ exports.Stage = Montage.create(Component, { this._scrollLeft = 0; this._scrollTop = 0; - this.stageDeps.handleOpenDocument(); - this.layout.handleOpenDocument(); + this.initialize3DOnOpenDocument(); if(designView._template) { var initialLeft = parseInt((this.canvas.width - designView._template.size.width)/2); @@ -1079,6 +1078,18 @@ exports.Stage = Montage.create(Component, { this.application.ninja.toolsSplitter.restore(); this.application.ninja.optionsSplitter.restore(); } + }, + + initialize3DOnOpenDocument: { + value: function() { + + workingPlane = [0,0,1,0]; + + this.snapManager._isCacheInvalid = true; + this.snapManager.setupDragPlaneFromPlane (workingPlane); + + this.drawUtils.initializeFromDocument(); + } } }); \ No newline at end of file -- cgit v1.2.3 From 820005437e7270e72b865a3436d7148e1dd19900 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 29 May 2012 15:42:24 -0700 Subject: Fixed bug with scrolling too much when moving objects in negative space. Signed-off-by: Nivesh Rajbhandari --- js/stage/stage.reel/stage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/stage/stage.reel/stage.js') diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 44d6eadb..7025c692 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -193,7 +193,7 @@ exports.Stage = Montage.create(Component, { this._userPaddingLeft = value; this._documentOffsetLeft = -value; this.application.ninja.currentDocument.model.documentRoot.ownerDocument.getElementsByTagName("HTML")[0].style["padding-left"] = -value + "px"; - this.userContentLeft = this._documentOffsetLeft; + this.userContentLeft = this._documentOffsetLeft - this._scrollLeft; this.updatedStage = true; } }, @@ -204,7 +204,7 @@ exports.Stage = Montage.create(Component, { this._userPaddingTop = value; this._documentOffsetTop = -value; this.application.ninja.currentDocument.model.documentRoot.ownerDocument.getElementsByTagName("HTML")[0].style["padding-top"] = -value + "px"; - this.userContentTop = this._documentOffsetTop; + this.userContentTop = this._documentOffsetTop - this._scrollTop; this.updatedStage = true; } }, -- cgit v1.2.3 From d8840eda0d3b3e31fb5a72306fe66608f4f99c2b Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 29 May 2012 23:52:59 -0700 Subject: fixing the menu bindings and some cleanup of the stage Signed-off-by: Valerio Virgillito --- js/stage/stage.reel/stage.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'js/stage/stage.reel/stage.js') diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index a6e7c24f..82c4d652 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -156,8 +156,7 @@ exports.Stage = Montage.create(Component, { }, _currentDocument: { - value : null, - enumerable : false + value : null }, currentDocument : { @@ -176,7 +175,6 @@ exports.Stage = Montage.create(Component, { this.hideCanvas(false); } - //console.log("Stage - set current document with value of " + value); this._currentDocument = value; if(this._currentDocument.currentView === "design") { @@ -188,8 +186,7 @@ exports.Stage = Montage.create(Component, { this.hideRulers(); this.hideCanvas(true); } - }, - enumerable : false + } }, _userPaddingLeft: { value: 0 }, @@ -287,8 +284,6 @@ exports.Stage = Montage.create(Component, { value: function(didSwitch) { var designView = this.application.ninja.currentDocument.model.views.design; - this.hideCanvas(false); - // Recalculate the canvas sizes because of splitter resizing this._canvas.width = this._layoutCanvas.width = this._drawingCanvas.width = this.element.offsetWidth - 11 ; this._canvas.height = this._layoutCanvas.height = this._drawingCanvas.height = this.element.offsetHeight - 11; -- cgit v1.2.3 From 31b094ee21102f99a4021d505bc3a28527c9e23d Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 30 May 2012 01:33:20 -0700 Subject: Fixing the close document. Signed-off-by: Valerio Virgillito --- js/stage/stage.reel/stage.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'js/stage/stage.reel/stage.js') diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 82c4d652..da5a4f76 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -164,27 +164,23 @@ exports.Stage = Montage.create(Component, { return this._currentDocument; }, set : function(value) { - // TODO: WRONG! Fails when going from design to code view - if (value === this._currentDocument || value.getProperty("currentView") !== "design") { - console.log("Stage - current document not set since the same value of " + this._currentDocument + " and value " + value); + if (value === this._currentDocument) { return; } - if(!this._currentDocument) { + if(!this._currentDocument && value.currentView === "design") { this.showRulers(); this.hideCanvas(false); } this._currentDocument = value; - if(this._currentDocument.currentView === "design") { - this.clearAllCanvas(); - this.initWithDocument(false); - } - if(!value) { this.hideRulers(); this.hideCanvas(true); + } else if(this._currentDocument.currentView === "design") { + this.clearAllCanvas(); + this.initWithDocument(false); } } }, -- cgit v1.2.3 From 0b830a8c6415e9cc255d1593a05ae3fa9d94c5e2 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 31 May 2012 14:31:00 -0700 Subject: Adding back the stage references in the 3d classes. Signed-off-by: Nivesh Rajbhandari --- js/stage/stage.reel/stage.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'js/stage/stage.reel/stage.js') diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 4505ff66..dc00eac2 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -1090,7 +1090,11 @@ exports.Stage = Montage.create(Component, { workingPlane = [0,0,1,0]; + this.viewUtils.setStageElement(this.application.ninja.currentDocument.model.documentRoot); + this.viewUtils.setRootElement(this.application.ninja.currentDocument.model.documentRoot.parentNode); + this.snapManager._isCacheInvalid = true; + this.snapManager.currentStage = this.application.ninja.currentDocument.model.documentRoot; this.snapManager.setupDragPlaneFromPlane (workingPlane); this.drawUtils.initializeFromDocument(); -- cgit v1.2.3 From 6307b0930f1a8452de954ae16e293da2f575db04 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 31 May 2012 14:49:41 -0700 Subject: removing the last closeDocument handler Signed-off-by: Valerio Virgillito --- js/stage/stage.reel/stage.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'js/stage/stage.reel/stage.js') diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index dc00eac2..4c4ba6c9 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -184,6 +184,8 @@ exports.Stage = Montage.create(Component, { if(!value) { this.hideRulers(); this.hideCanvas(true); + drawUtils._eltArray.length = 0; + drawUtils._planesArray.length = 0; } else if(this._currentDocument.currentView === "design") { this.clearAllCanvas(); this.initWithDocument(false); -- cgit v1.2.3 From ffe6c157279e115f4658d8c66622085f05cfbf43 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 31 May 2012 15:27:03 -0700 Subject: fixing the switching between various types of documents Signed-off-by: Valerio Virgillito --- js/stage/stage.reel/stage.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'js/stage/stage.reel/stage.js') diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 4c4ba6c9..cd08c55d 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -187,8 +187,18 @@ exports.Stage = Montage.create(Component, { drawUtils._eltArray.length = 0; drawUtils._planesArray.length = 0; } else if(this._currentDocument.currentView === "design") { + this.showCodeViewBar(false); + this.restoreAllPanels(); + this.hideCanvas(false); + this.showRulers(); + this.clearAllCanvas(); this.initWithDocument(false); + } else { + this.showCodeViewBar(true); + this.collapseAllPanels(); + this.hideCanvas(true); + this.hideRulers(); } } }, -- cgit v1.2.3 From 4b455d9bb1c3ff7a8199628dc66e158cdee936df Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 31 May 2012 15:34:55 -0700 Subject: Removing unused scroll model save/restore. Signed-off-by: Nivesh Rajbhandari --- js/stage/stage.reel/stage.js | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'js/stage/stage.reel/stage.js') diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index cd08c55d..fd9db5ec 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -1040,22 +1040,6 @@ exports.Stage = Montage.create(Component, { } }, - saveScroll:{ - value: function(){ - this.application.ninja.documentController.activeDocument.savedLeftScroll = this._iframeContainer.scrollLeft; - this.application.ninja.documentController.activeDocument.savedTopScroll = this._iframeContainer.scrollTop; - } - }, - - restoreScroll:{ - value: function(){ - this._iframeContainer.scrollLeft = this.application.ninja.documentController.activeDocument.savedLeftScroll; - this._scrollLeft = this.application.ninja.documentController.activeDocument.savedLeftScroll; - this._iframeContainer.scrollTop = this.application.ninja.documentController.activeDocument.savedTopScroll; - this._scrollTop = this.application.ninja.documentController.activeDocument.savedTopScroll; - } - }, - showRulers:{ value:function(){ this.application.ninja.rulerTop.style.display = "block"; -- cgit v1.2.3 From 294baf576986adb139406e516d8461070fdfd695 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 31 May 2012 16:30:26 -0700 Subject: Fixing scroll offsets when switching between documents. Signed-off-by: Nivesh Rajbhandari --- js/stage/stage.reel/stage.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'js/stage/stage.reel/stage.js') diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index fd9db5ec..087606d0 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -179,6 +179,11 @@ exports.Stage = Montage.create(Component, { this.hideCanvas(false); } + if(this.currentDocument && (this.currentDocument.currentView === "design")) { + this.currentDocument.model.scrollLeft = this._scrollLeft; + this.currentDocument.model.scrollTop = this._scrollTop; + } + this._currentDocument = value; if(!value) { @@ -193,7 +198,7 @@ exports.Stage = Montage.create(Component, { this.showRulers(); this.clearAllCanvas(); - this.initWithDocument(false); + this.initWithDocument(); } else { this.showCodeViewBar(true); this.collapseAllPanels(); @@ -299,8 +304,14 @@ exports.Stage = Montage.create(Component, { }, initWithDocument: { - value: function(didSwitch) { - var designView = this.application.ninja.currentDocument.model.views.design; + value: function() { + var model = this.currentDocument.model, + designView = this.currentDocument.model.views.design, + didSwitch = false; + + if(model.scrollLeft != null) { + didSwitch = true; + } // Recalculate the canvas sizes because of splitter resizing this._canvas.width = this._layoutCanvas.width = this._drawingCanvas.width = this._gridCanvas.width = this.element.offsetWidth - 11 ; @@ -336,8 +347,8 @@ exports.Stage = Montage.create(Component, { } if(didSwitch) { - this.application.ninja.currentDocument.model.views.design.document.body.scrollLeft = this.application.ninja.currentDocument.model.scrollLeft; - this.application.ninja.currentDocument.model.views.design.document.body.scrollTop = this.application.ninja.currentDocument.model.scrollTop; + this.application.ninja.currentDocument.model.views.design.document.body.scrollLeft = this.currentDocument.model.scrollLeft; + this.application.ninja.currentDocument.model.views.design.document.body.scrollTop = this.currentDocument.model.scrollTop; this.handleScroll(); } else { this.centerStage(); -- cgit v1.2.3 From 3a3a2351ea2d816bf953cbf76622772f7d64aa8b Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 1 Jun 2012 00:16:31 -0700 Subject: fixing the code editor, closing documents and cleanup of the stage Signed-off-by: Valerio Virgillito --- js/stage/stage.reel/stage.js | 53 ++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 26 deletions(-) (limited to 'js/stage/stage.reel/stage.js') diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 087606d0..ed716541 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -206,7 +206,7 @@ exports.Stage = Montage.create(Component, { this.hideRulers(); } } - }, + }, _userPaddingLeft: { value: 0 }, _userPaddingTop: { value: 0 }, @@ -216,7 +216,7 @@ exports.Stage = Montage.create(Component, { set: function(value) { this._userPaddingLeft = value; this._documentOffsetLeft = -value; - this.application.ninja.currentDocument.model.documentRoot.ownerDocument.getElementsByTagName("HTML")[0].style["padding-left"] = -value + "px"; + this.currentDocument.model.documentRoot.ownerDocument.getElementsByTagName("HTML")[0].style["padding-left"] = -value + "px"; this.userContentLeft = this._documentOffsetLeft - this._scrollLeft; this.updatedStage = true; } @@ -227,7 +227,7 @@ exports.Stage = Montage.create(Component, { set: function(value) { this._userPaddingTop = value; this._documentOffsetTop = -value; - this.application.ninja.currentDocument.model.documentRoot.ownerDocument.getElementsByTagName("HTML")[0].style["padding-top"] = -value + "px"; + this.currentDocument.model.documentRoot.ownerDocument.getElementsByTagName("HTML")[0].style["padding-top"] = -value + "px"; this.userContentTop = this._documentOffsetTop - this._scrollTop; this.updatedStage = true; } @@ -242,7 +242,7 @@ exports.Stage = Montage.create(Component, { // Hack for now until a full component this.layout.draw(); - if(this.application.ninja.currentDocument) { + if(this.currentDocument) { this.layout.draw3DInfo(true); } } else if(this.updatedStage) { @@ -347,8 +347,8 @@ exports.Stage = Montage.create(Component, { } if(didSwitch) { - this.application.ninja.currentDocument.model.views.design.document.body.scrollLeft = this.currentDocument.model.scrollLeft; - this.application.ninja.currentDocument.model.views.design.document.body.scrollTop = this.currentDocument.model.scrollTop; + this.currentDocument.model.views.design.document.body.scrollLeft = this.currentDocument.model.scrollLeft; + this.currentDocument.model.views.design.document.body.scrollTop = this.currentDocument.model.scrollTop; this.handleScroll(); } else { this.centerStage(); @@ -462,9 +462,9 @@ exports.Stage = Montage.create(Component, { handleMousewheel: { value: function(event) { if(event._event.wheelDelta > 0) { - this.application.ninja.currentDocument.model.views.design.document.body.scrollTop -= 20; + this.currentDocument.model.views.design.document.body.scrollTop -= 20; } else { - this.application.ninja.currentDocument.model.views.design.document.body.scrollTop += 20; + this.currentDocument.model.views.design.document.body.scrollTop += 20; } } }, @@ -532,8 +532,8 @@ exports.Stage = Montage.create(Component, { handleScroll: { value: function() { - this._scrollLeft = this.application.ninja.currentDocument.model.views.design.document.body.scrollLeft; - this._scrollTop = this.application.ninja.currentDocument.model.views.design.document.body.scrollTop; + this._scrollLeft = this.currentDocument.model.views.design.document.body.scrollLeft; + this._scrollTop = this.currentDocument.model.views.design.document.body.scrollTop; this.userContentLeft = this._documentOffsetLeft - this._scrollLeft; this.userContentTop = this._documentOffsetTop - this._scrollTop; @@ -571,7 +571,7 @@ exports.Stage = Montage.create(Component, { */ centerStage: { value: function() { - var designView = this.application.ninja.currentDocument.model.views.design; + var designView = this.currentDocument.model.views.design; if(designView._template) { designView.document.body.scrollLeft = this._documentOffsetLeft - parseInt((this.canvas.width - designView._template.size.width)/2); designView.document.body.scrollTop = this._documentOffsetTop - parseInt((this.canvas.height - designView._template.size.height)/2); @@ -630,21 +630,21 @@ exports.Stage = Montage.create(Component, { getElement: { value: function(position, selectable) { var point, element, - docView = this.application.ninja.currentDocument.model.views.design; + docView = this.currentDocument.model.views.design; point = webkitConvertPointFromPageToNode(this.canvas, new WebKitPoint(position.pageX - docView.iframe.contentWindow.pageXOffset + this.documentOffsetLeft, position.pageY - docView.iframe.contentWindow.pageYOffset + this.documentOffsetTop)); - element = this.application.ninja.currentDocument.model.views.design.getElementFromPoint(point.x - this.userContentLeft,point.y - this.userContentTop); + element = this.currentDocument.model.views.design.getElementFromPoint(point.x - this.userContentLeft,point.y - this.userContentTop); if(!element) debugger; // workaround Chrome 3d bug - if(this.application.ninja.toolsData.selectedToolInstance._canSnap && this.application.ninja.currentDocument.inExclusion(element) !== -1) { + if(this.application.ninja.toolsData.selectedToolInstance._canSnap && this.currentDocument.inExclusion(element) !== -1) { point = webkitConvertPointFromPageToNode(this.canvas, new WebKitPoint(position.pageX, position.pageY)); element = this.getElementUsingSnapping(point); } if(selectable) { - if(this.application.ninja.currentDocument.inExclusion(element) !== -1) { + if(this.currentDocument.inExclusion(element) !== -1) { return this.application.ninja.currentSelectedContainer; } @@ -949,7 +949,7 @@ exports.Stage = Montage.create(Component, { setStageAsViewport: { value: function() { - this.stageDeps.viewUtils.setViewportObj(this.application.ninja.currentDocument.model.documentRoot); + this.stageDeps.viewUtils.setViewportObj(this.currentDocument.model.documentRoot); } }, @@ -957,7 +957,7 @@ exports.Stage = Montage.create(Component, { value: function(value) { if(!this._firstDraw) { - var userContent = this.application.ninja.currentDocument.model.documentRoot; + var userContent = this.currentDocument.model.documentRoot; if (userContent) { var w = this._canvas.width, @@ -969,7 +969,7 @@ exports.Stage = Montage.create(Component, { //TODO - Maybe move to mediator. var newVal = value/100.0; if (newVal >= 1) - this.application.ninja.currentDocument.model.views.design.iframe.style.zoom = value/100; + this.currentDocument.model.views.design.iframe.style.zoom = value/100; this.updatedStage = true; @@ -988,12 +988,12 @@ exports.Stage = Montage.create(Component, { { case "top": plane = [0,1,0,0]; - plane[3] = this.application.ninja.currentDocument.model.documentRoot.offsetHeight / 2.0; + plane[3] = this.currentDocument.model.documentRoot.offsetHeight / 2.0; break; case "side": plane = [1,0,0,0]; - plane[3] = this.application.ninja.currentDocument.model.documentRoot.offsetWidth / 2.0; + plane[3] = this.currentDocument.model.documentRoot.offsetWidth / 2.0; break; case "front": @@ -1012,7 +1012,7 @@ exports.Stage = Montage.create(Component, { setStageView: { value: function(side) { var mat, - currentDoc = this.application.ninja.currentDocument.model.documentRoot, + currentDoc = this.currentDocument.model.documentRoot, isDrawingGrid = this.application.ninja.appModel.show3dGrid; // Stage 3d Props. currentDoc.elementModel.props3D.ResetTranslationValues(); @@ -1057,6 +1057,7 @@ exports.Stage = Montage.create(Component, { this.application.ninja.rulerLeft.style.display = "block"; } }, + hideRulers:{ value:function(){ this.application.ninja.rulerTop.style.display = "none"; @@ -1066,11 +1067,11 @@ exports.Stage = Montage.create(Component, { showCodeViewBar:{ value:function(isCodeView){ if(isCodeView === true) { - this.application.ninja.editorViewOptions.element.style.display = "block"; + this.application.ninja.documentBar.element.style.display = "none"; } else { this.application.ninja.documentBar.element.style.display = "block"; - this.application.ninja.editorViewOptions.element.style.display = "none"; + } } }, @@ -1097,11 +1098,11 @@ exports.Stage = Montage.create(Component, { workingPlane = [0,0,1,0]; - this.viewUtils.setStageElement(this.application.ninja.currentDocument.model.documentRoot); - this.viewUtils.setRootElement(this.application.ninja.currentDocument.model.documentRoot.parentNode); + this.viewUtils.setStageElement(this.currentDocument.model.documentRoot); + this.viewUtils.setRootElement(this.currentDocument.model.documentRoot.parentNode); this.snapManager._isCacheInvalid = true; - this.snapManager.currentStage = this.application.ninja.currentDocument.model.documentRoot; + this.snapManager.currentStage = this.currentDocument.model.documentRoot; this.snapManager.setupDragPlaneFromPlane (workingPlane); this.drawUtils.initializeFromDocument(); -- cgit v1.2.3 From 6079ceedb5b340c78ecd02f27dfa734eedccf512 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 1 Jun 2012 00:39:14 -0700 Subject: making the document bar handle the current document to hide/show itself Signed-off-by: Valerio Virgillito --- js/stage/stage.reel/stage.js | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'js/stage/stage.reel/stage.js') diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index ed716541..d8f7313b 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -192,7 +192,6 @@ exports.Stage = Montage.create(Component, { drawUtils._eltArray.length = 0; drawUtils._planesArray.length = 0; } else if(this._currentDocument.currentView === "design") { - this.showCodeViewBar(false); this.restoreAllPanels(); this.hideCanvas(false); this.showRulers(); @@ -200,7 +199,6 @@ exports.Stage = Montage.create(Component, { this.clearAllCanvas(); this.initWithDocument(); } else { - this.showCodeViewBar(true); this.collapseAllPanels(); this.hideCanvas(true); this.hideRulers(); @@ -1064,17 +1062,6 @@ exports.Stage = Montage.create(Component, { this.application.ninja.rulerLeft.style.display = "none"; } }, - showCodeViewBar:{ - value:function(isCodeView){ - if(isCodeView === true) { - - this.application.ninja.documentBar.element.style.display = "none"; - } else { - this.application.ninja.documentBar.element.style.display = "block"; - - } - } - }, collapseAllPanels:{ value:function(){ -- cgit v1.2.3 From b7f048624c07a1186cca080bf4c9a87af7d53f35 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Fri, 1 Jun 2012 06:47:50 -0700 Subject: SnapManager.setupDragPlaneFromPlane must happen after StylesController has finished initializeRootStyles. Signed-off-by: Nivesh Rajbhandari --- js/stage/stage.reel/stage.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'js/stage/stage.reel/stage.js') diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 087606d0..5a1d7f78 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -1102,7 +1102,9 @@ exports.Stage = Montage.create(Component, { this.snapManager._isCacheInvalid = true; this.snapManager.currentStage = this.application.ninja.currentDocument.model.documentRoot; - this.snapManager.setupDragPlaneFromPlane (workingPlane); + //TODO - StylesController needs to initialize the stage's styles prior to calling this. + // So, moving this into styles-controller.initializeRootStyles code. +// this.snapManager.setupDragPlaneFromPlane (workingPlane); this.drawUtils.initializeFromDocument(); } -- cgit v1.2.3 From fd264c58bfc5f53f57d9ddfd06114124b14bac04 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Fri, 1 Jun 2012 14:54:19 -0700 Subject: Moving styles controller higher in ninja's serialization so its bindings will get triggered before stage's bindings. This should fix the stage's styles not getting initialized correctly. Signed-off-by: Nivesh Rajbhandari --- js/stage/stage.reel/stage.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'js/stage/stage.reel/stage.js') diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 4d9296a1..d8f7313b 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -1090,9 +1090,7 @@ exports.Stage = Montage.create(Component, { this.snapManager._isCacheInvalid = true; this.snapManager.currentStage = this.currentDocument.model.documentRoot; - //TODO - StylesController needs to initialize the stage's styles prior to calling this. - // So, moving this into styles-controller.initializeRootStyles code. -// this.snapManager.setupDragPlaneFromPlane (workingPlane); + this.snapManager.setupDragPlaneFromPlane (workingPlane); this.drawUtils.initializeFromDocument(); } -- cgit v1.2.3 From 3293b0b730227c14bd4f7bd53c125b48f9886764 Mon Sep 17 00:00:00 2001 From: Pushkar Joshi Date: Tue, 5 Jun 2012 14:53:15 -0700 Subject: handle switching between multiple documents for Pen tool by having its own selection change handler --- js/stage/stage.reel/stage.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'js/stage/stage.reel/stage.js') diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index d8f7313b..8d1c087d 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -182,6 +182,8 @@ exports.Stage = Montage.create(Component, { if(this.currentDocument && (this.currentDocument.currentView === "design")) { this.currentDocument.model.scrollLeft = this._scrollLeft; this.currentDocument.model.scrollTop = this._scrollTop; + //call configure false with the old document on the selected tool to tear down down any temp. stuff + this.application.ninja.toolsData.selectedToolInstance._configure(false); } this._currentDocument = value; @@ -351,7 +353,6 @@ exports.Stage = Montage.create(Component, { } else { this.centerStage(); } - // TODO - We will need to modify this once we support switching between multiple documents this.application.ninja.toolsData.selectedToolInstance._configure(true); } -- cgit v1.2.3 From 5d1fd1fc1da434cd56ac8f366eb17b692c786497 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 5 Jun 2012 16:27:46 -0700 Subject: IKNINJA-1662 - fixed js error while resizing brewing in code view Signed-off-by: Ananya Sen --- js/stage/stage.reel/stage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/stage/stage.reel/stage.js') diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index d8f7313b..d7331e0d 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -240,7 +240,7 @@ exports.Stage = Montage.create(Component, { // Hack for now until a full component this.layout.draw(); - if(this.currentDocument) { + if(this.currentDocument && (this.currentDocument.currentView === "design")) { this.layout.draw3DInfo(true); } } else if(this.updatedStage) { -- cgit v1.2.3