From 522b0d6f3505af90fb74f185573cb4949c0b4a6d Mon Sep 17 00:00:00 2001 From: Luis Aguirre Date: Wed, 6 Feb 2013 15:49:12 +0000 Subject: [PATCH] Fix for issue 1046: Firefox drag-and-drop bug with elements in scaled canvas git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2330 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/svgcanvas.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index e0206000..c08c7fe2 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -2364,6 +2364,17 @@ var getMouseTarget = this.getMouseTarget = function(evt) { } root_sctm = svgcontent.getScreenCTM().inverse(); + + // Firefox issue 1046 + if(current_zoom != 1 && root_sctm.a == 1) + { + matrix_e = root_sctm.e / current_zoom - root_sctm.e; + matrix_f = root_sctm.f / current_zoom - root_sctm.f; + matrix_scale = 1/current_zoom; + root_sctm = svgcontent.getScreenCTM().inverse() + .translate(matrix_e, matrix_f) + .scale(matrix_scale); + } var pt = transformPoint( evt.pageX, evt.pageY, root_sctm ), mouse_x = pt.x * current_zoom,