From e80a79bff57fecf3aa9b869d8ed2de5fd815287c Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 14 Feb 2012 14:37:42 -0800 Subject: Fix for not being able to select an element in Top/Side view. Fall back to use SnapManager code if elementFromPoint returns the viewport. Signed-off-by: Nivesh Rajbhandari --- js/stage/stage.reel/stage.js | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 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 6d9a7355..9cf97e09 100644 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -510,12 +510,37 @@ exports.Stage = Montage.create(Component, { */ GetElement: { value: function(pos) { - var point = webkitConvertPointFromPageToNode(this.canvas, new WebKitPoint(pos.pageX, pos.pageY)); - return this.application.ninja.currentDocument.GetElementFromPoint(point.x + this.scrollLeft,point.y + this.scrollTop); + var point = webkitConvertPointFromPageToNode(this.canvas, new WebKitPoint(pos.pageX, pos.pageY)), + elt = this.application.ninja.currentDocument.GetElementFromPoint(point.x + this.scrollLeft,point.y + this.scrollTop); + + // workaround Chrome 3d bug + if(elt === this._viewport) + { + return this._getElementUsingSnapping(point); + } else { + return elt; + } } }, - + /** + * _getElementUsingSnapping: Returns the object at point using snap manager + * + * @param: point + * @return: Returns the Object in the user document under the point + */ + _getElementUsingSnapping: { + value: function(point) { + this.stageDeps.snapManager.enableElementSnap( true ); + var hitRec = this.stageDeps.snapManager.snap(point.x, point.y, true); + this.stageDeps.snapManager.enableElementSnap( this.stageDeps.snapManager.elementSnapEnabledAppLevel() ); + if (hitRec) { + return hitRec.getElement(); + } else { + return null; + } + } + }, draw: { -- cgit v1.2.3 From 5b7e903bb0f32d1d59620d1d800ff260f49bfa48 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 20 Feb 2012 15:03:27 -0800 Subject: Some more tweaks to not being able to select elements in top/side view. Signed-off-by: Nivesh Rajbhandari --- 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 6a8afad4..5734e317 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -522,7 +522,7 @@ exports.Stage = Montage.create(Component, { elt = this.application.ninja.currentDocument.GetElementFromPoint(point.x + this.scrollLeft,point.y + this.scrollTop); // workaround Chrome 3d bug - if(elt === this._viewport) + if(this.application.ninja.currentDocument.inExclusion(elt) !== -1) { return this._getElementUsingSnapping(point); } else { -- cgit v1.2.3