From 0e221e80eb41bbe770c195838373b9e27de54c7a Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 6 Mar 2012 16:11:52 -0800 Subject: IKNINJA-1207: added check for design view to fix js error Signed-off-by: Ananya Sen --- js/stage/layout.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'js/stage') diff --git a/js/stage/layout.js b/js/stage/layout.js index de4c67c1..ab2daf9b 100755 --- a/js/stage/layout.js +++ b/js/stage/layout.js @@ -65,8 +65,9 @@ exports.Layout = Montage.create(Component, { handleOpenDocument: { value: function() { // Initial elements to draw is the entire node list - this.elementsToDraw = this.application.ninja.documentController.activeDocument._liveNodeList; - + if(typeof this.application.ninja.documentController.activeDocument._liveNodeList !== "undefined"){//only for designer view + this.elementsToDraw = this.application.ninja.documentController.activeDocument._liveNodeList; + } // Draw the elements and the 3d info this.draw(); this.draw3DInfo(false); @@ -104,8 +105,9 @@ exports.Layout = Montage.create(Component, { } // Make an array copy of the line node list which is not an array like object - this.domTree = Array.prototype.slice.call(this.application.ninja.documentController.activeDocument._liveNodeList, 0); - + if(typeof this.application.ninja.documentController.activeDocument._liveNodeList !== "undefined"){//only for designer view + this.domTree = Array.prototype.slice.call(this.application.ninja.documentController.activeDocument._liveNodeList, 0); + } // Clear the elements to draw this.elementsToDraw.length = 0; -- cgit v1.2.3 From 2364c671ffc2953e3ee8dfdf037244de8fab3920 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 6 Mar 2012 16:30:33 -0800 Subject: IKNINJA-1238 fix and fixing other js errors on switching and closing documents Signed-off-by: Ananya Sen --- js/stage/stage-view.reel/stage-view.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'js/stage') diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js index 91047e51..ad67cada 100755 --- a/js/stage/stage-view.reel/stage-view.js +++ b/js/stage/stage-view.reel/stage-view.js @@ -125,6 +125,10 @@ exports.StageView = Montage.create(Component, { this.application.ninja.documentController.activeDocument = doc; + if(this.application.ninja.documentController.activeDocument.currentView === "design") { + this.application.ninja.currentDocument = this.application.ninja.documentController.activeDocument; + } + this.application.ninja.stage._scrollFlag = false; // TODO HACK to prevent type error on Hide/Show Iframe this.application.ninja.documentController._showCurrentDocument(); @@ -135,7 +139,6 @@ exports.StageView = Montage.create(Component, { if(this.application.ninja.documentController.activeDocument.currentView === "design") { this.application.ninja.stage._scrollFlag = true; // TODO HACK to prevent type error on Hide/Show Iframe - this.application.ninja.currentDocument = this.application.ninja.documentController.activeDocument; //reinitialize draw-util, snapmanager and view-util this.application.ninja.stage.stageDeps.reinitializeForSwitchDocument(); -- cgit v1.2.3 From 250420d8c6154172b27fe53aff30e78c227e8a67 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 7 Mar 2012 14:26:37 -0800 Subject: minor fixes Signed-off-by: Ananya Sen --- js/stage/layout.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/stage') diff --git a/js/stage/layout.js b/js/stage/layout.js index ab2daf9b..8a53a08b 100755 --- a/js/stage/layout.js +++ b/js/stage/layout.js @@ -65,7 +65,7 @@ exports.Layout = Montage.create(Component, { handleOpenDocument: { value: function() { // Initial elements to draw is the entire node list - if(typeof this.application.ninja.documentController.activeDocument._liveNodeList !== "undefined"){//only for designer view + if(this.application.ninja.documentController.activeDocument.currentView === "design"){//only for designer view this.elementsToDraw = this.application.ninja.documentController.activeDocument._liveNodeList; } // Draw the elements and the 3d info @@ -105,7 +105,7 @@ exports.Layout = Montage.create(Component, { } // Make an array copy of the line node list which is not an array like object - if(typeof this.application.ninja.documentController.activeDocument._liveNodeList !== "undefined"){//only for designer view + if(this.application.ninja.documentController.activeDocument.currentView === "design"){//only for designer view this.domTree = Array.prototype.slice.call(this.application.ninja.documentController.activeDocument._liveNodeList, 0); } // Clear the elements to draw -- cgit v1.2.3 From b4d3bf155e38e6554f05bb3cbaddd2f3bf799e90 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 13 Mar 2012 18:12:48 -0700 Subject: Fixing the layout to only draw one level and stage resize when the panels are collapsed. Fixing the following bugs: IKNINJA-1068 Signed-off-by: Valerio Virgillito --- js/stage/layout.js | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) (limited to 'js/stage') diff --git a/js/stage/layout.js b/js/stage/layout.js index 8a53a08b..6be2df1d 100755 --- a/js/stage/layout.js +++ b/js/stage/layout.js @@ -64,31 +64,17 @@ exports.Layout = Montage.create(Component, { handleOpenDocument: { value: function() { - // Initial elements to draw is the entire node list - if(this.application.ninja.documentController.activeDocument.currentView === "design"){//only for designer view - this.elementsToDraw = this.application.ninja.documentController.activeDocument._liveNodeList; + // Initial elements to draw are the childrens of the root element + if(this.application.ninja.documentController.activeDocument.currentView === "design") { + this.elementsToDraw = this.application.ninja.documentController.activeDocument.documentRoot.childNodes; } + // Draw the elements and the 3d info this.draw(); this.draw3DInfo(false); } }, - // No need to keep track of the added elements. We now have a live node list of the dom - handleElementAdded: { - value: function(event) { - // this.domTree.push(event.detail); - // this.draw(); - // this.draw3DInfo(false); - } - }, - - handleElementDeleted: { - value: function(event) { - //this.domTree.splice(this.domTree.indexOf(event.detail), 1); - } - }, - // Redraw stage only once after all deletion is completed handleDeleteSelection: { value: function(event) { @@ -99,14 +85,25 @@ exports.Layout = Montage.create(Component, { handleSelectionChange: { value: function(event) { + var containerIndex; if(this.application.ninja.documentController.activeDocument === null){ return; } - // Make an array copy of the line node list which is not an array like object - if(this.application.ninja.documentController.activeDocument.currentView === "design"){//only for designer view + if(this.application.ninja.documentController.activeDocument.currentView === "design"){ + // Make an array copy of the line node list which is not an array like object this.domTree = Array.prototype.slice.call(this.application.ninja.documentController.activeDocument._liveNodeList, 0); + // Index of the current container + containerIndex = this.domTree.indexOf(this.application.ninja.currentSelectedContainer); + + if(containerIndex < 0) { + // Stage is the container. + this.domTree = Array.prototype.slice.call(this.application.ninja.currentSelectedContainer.childNodes, 0); + } else { + // Child nodes of the container + this.domTree = Array.prototype.slice.call(this.domTree[containerIndex].childNodes, 0); + } } // Clear the elements to draw this.elementsToDraw.length = 0; @@ -119,10 +116,10 @@ exports.Layout = Montage.create(Component, { return (tmp.indexOf(value) === -1); }); } else { - this.elementsToDraw = this.domTree; + this.elementsToDraw = Array.prototype.slice.call(this.domTree, 0); } - this.draw(); // Not a reel yet :) + this.draw(); // Not a reel yet this.draw3DInfo(false); // Clear the domTree copy -- cgit v1.2.3 From a7cb2c0b22f03b79f19d4a9a2eb691d1ccc392f9 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 14 Mar 2012 18:04:11 -0700 Subject: adding a focus manager to handle panel bugs where blur was not getting called when clicking on the canvas. Signed-off-by: Valerio Virgillito --- js/stage/stage.reel/stage.html | 7 ++++++- js/stage/stage.reel/stage.js | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'js/stage') diff --git a/js/stage/stage.reel/stage.html b/js/stage/stage.reel/stage.html index 812e3d55..f796303c 100755 --- a/js/stage/stage.reel/stage.html +++ b/js/stage/stage.reel/stage.html @@ -50,6 +50,10 @@ "element" : {"#": "textToolObject"} } }, + + "focusManager": { + "object": "js/components/focus-manager.reel" + }, "owner": { "module": "js/stage/stage.reel", @@ -63,7 +67,8 @@ "stageDeps": {"@": "StageDeps1"}, "layout": {"@": "layout1"}, "stageView": {"@": "stageView"}, - "textTool": {"@": "textTool"} + "textTool": {"@": "textTool"}, + "focusManager": {"@": "focusManager"} }, "bindings": { "currentDocumentStageView": { diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 4c1d046b..a624b2c6 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -319,6 +319,10 @@ exports.Stage = Montage.create(Component, { handleMousedown: { value: function(event) { + // Call the focus manager to set focus to blur any focus'd elements + this.focusManager.setFocus(); + + var point; // event.preventDefault(); // commenting because HTML elements in the IDE are retaining focus // If right click set the context menu to true to prevent a mouse up. -- cgit v1.2.3 From da5dfc8863ad47c48414ff1fdacbacdb91abd30c Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 14 Mar 2012 23:25:34 -0700 Subject: Fixing the splitter resize canvas bug by getting the size when a document is opened. Signed-off-by: Valerio Virgillito --- js/stage/stage.reel/stage.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'js/stage') diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index a624b2c6..e139af97 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -170,8 +170,7 @@ exports.Stage = Montage.create(Component, { // Hack for now until a full component this.layout.draw(); - } - else if(this.updatedStage) { + } else if(this.updatedStage) { this.layout.draw(); this.layout.draw3DInfo(true); } @@ -235,6 +234,10 @@ 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._documentRoot = this.application.ninja.currentDocument.documentRoot; this._viewport = this.application.ninja.currentDocument.documentRoot.parentNode; -- cgit v1.2.3 From 4bec28fbd8371deceffd1563190cb5e399d554d3 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 16 Mar 2012 16:36:04 -0700 Subject: Squashed commit of SnapManagerFixes Signed-off-by: Valerio Virgillito --- js/stage/stage.reel/stage.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'js/stage') diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index e139af97..00b72490 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -518,6 +518,36 @@ exports.Stage = Montage.create(Component, { } }, + /** + * GetSelectableElement: Returns a selectable object (direct child of current container) at clicked point + * + * @param: X,Y + * @return: Returns the current container if the the X,Y hits an element in the exclusion list + */ + GetSelectableElement: { + value: function(pos) { + var item = this.GetElement(pos); + if(this.application.ninja.currentDocument.inExclusion(item) !== -1) { + return this.application.ninja.currentSelectedContainer; + } + var activeContainerId = this.application.ninja.currentSelectedContainer.uuid; + if(item.parentNode.uuid === activeContainerId) { + return item; + } else { + var outerElement = item.parentNode; + + while(outerElement.parentNode && outerElement.parentNode.uuid !== activeContainerId) { + // If element is higher up than current container then return + if(outerElement.id === "UserContent") return; + // else keep going up the chain + outerElement = outerElement.parentNode; + } + + return outerElement; + } + } + }, + /** * GetElement: Returns the object under the X,Y coordinates passed as an obj with x,y * -- cgit v1.2.3 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/stage/stage-view.reel/stage-view.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'js/stage') diff --git a/js/stage/stage-view.reel/stage-view.js b/js/stage/stage-view.reel/stage-view.js index ad67cada..1f471431 100755 --- a/js/stage/stage-view.reel/stage-view.js +++ b/js/stage/stage-view.reel/stage-view.js @@ -200,14 +200,18 @@ exports.StageView = Montage.create(Component, { }, showRulers:{ value:function(){ - this.application.ninja.rulerTop.style.background = "url('../images/temp/ruler-top.png')"; - this.application.ninja.rulerLeft.style.background = "url('../images/temp/ruler-left.png')"; + this.application.ninja.rulerTop.style.display = "block"; + this.application.ninja.rulerLeft.style.display = "block"; +// this.application.ninja.rulerTop.style.background = "url('../images/temp/ruler-top.png')"; +// this.application.ninja.rulerLeft.style.background = "url('../images/temp/ruler-left.png')"; } }, hideRulers:{ value:function(){ - this.application.ninja.rulerTop.style.background = "rgb(128,128,128)"; - this.application.ninja.rulerLeft.style.background = "rgb(128,128,128)"; + this.application.ninja.rulerTop.style.display = "none"; + this.application.ninja.rulerLeft.style.display = "none"; +// this.application.ninja.rulerTop.style.background = "rgb(128,128,128)"; +// this.application.ninja.rulerLeft.style.background = "rgb(128,128,128)"; } }, -- cgit v1.2.3