From c79814664f3002613b3f12106edffc64932fa4ac Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 8 May 2012 16:27:50 -0700 Subject: Get clicked element when body is scrolled. Signed-off-by: Nivesh Rajbhandari --- js/stage/stage.reel/stage.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'js/stage/stage.reel') diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 1f661513..dc6444ff 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -551,13 +551,16 @@ exports.Stage = Montage.create(Component, { */ getElement: { value: function(position, selectable) { - var point, element; + var point, element, + docView = this.application.ninja.currentDocument.model.views.design; - point = webkitConvertPointFromPageToNode(this.canvas, new WebKitPoint(position.pageX, position.pageY)); - element = this.application.ninja.currentDocument.model.views.design.getElementFromPoint(point.x + this.userContentLeft,point.y + this.userContentTop); + point = webkitConvertPointFromPageToNode(this.canvas, new WebKitPoint(position.pageX - docView.iframe.contentWindow.pageXOffset, position.pageY - docView.iframe.contentWindow.pageYOffset)); + element = this.application.ninja.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) { + point = webkitConvertPointFromPageToNode(this.canvas, new WebKitPoint(position.pageX, position.pageY)); element = this.getElementUsingSnapping(point); } @@ -888,7 +891,7 @@ exports.Stage = Montage.create(Component, { //TODO - Maybe move to mediator. var newVal = value/100.0; if (newVal >= 1) - this.application.ninja.currentDocument.iframe.style.zoom = value/100; + this.application.ninja.currentDocument.model.views.design.iframe.style.zoom = value/100; this.updatedStage = true; -- cgit v1.2.3