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/stage.reel') 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/stage.reel') 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/stage.reel') 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