rebootcode / svg-edit

Automatically exported from code.google.com/p/svg-edit
MIT License
0 stars 0 forks source link

svg-edit zoom confuses mouse position only in Firefox #974

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1.Open Firefox recent (tried FF 12 and 13 and FF Aurora 14.0a2
2.Use svg-zoom to a different value, i.e 50%
3.Use the pencil tool and draw -> draws at a wrong position. This works 
correctly in Chrome 19, IE9 and Opera 11.64

What is the expected output? What do you see instead?

Draw at pointer position, not with an offset that depends on the svg-edit 
internal zoom level

In what browser did you experience this problem? (ALL, Firefox, Opera, etc)

Tried with FF 12 and 13 and FF Aurora 14.0a2, works with IE9, Chrome 19, Opera 
11.64

In what version of SVG-edit does the problem occur? (Latest trunk, 2.5.1,
etc)
Tried 2.6 latest trunk and 2.5.1 same bug on all versions.

Please provide any additional information below.

Original issue reported on code.google.com by micbu...@gmail.com on 9 Jun 2012 at 6:32

GoogleCodeExporter commented 9 years ago
Found a fix : in svgcanvas.js everywhere the mouse position is used, we must 
not multiply by zoom level). Here is the code we used everywhere the mouse pos 
is needed : 

if(svgedit.browser.isGecko()){ // bug only occurs with FireFox
                       mouse_x = pt.x;
                       mouse_y = pt.y;
               }
               else{
                       mouse_x = pt.x * current_zoom ,
                       mouse_y = pt.y * current_zoom;
               }

Original comment by micbu...@gmail.com on 29 Jun 2012 at 9:56

GoogleCodeExporter commented 9 years ago
Thanks for the update.  I tried the fix and it seems to have fixed most of the 
element drawings.  However, I'm still having issues with the path edit/create.  
On the initial node element that is created when drawing a polygon, the first 
point shows up not positioned to where the mouse cursor was originally clicked. 
 However, once the polygon is connected, the position shifts to the right spot. 
 It's just the node that gets placed in the wrong position.  I've tried the 
code above and it doesn't seem to be working.  I've attached screenshots of 
before and after.  Notice how the position of the first node is out of place 
but once polygon is connected, it actually is in the right location.

Original comment by mxi...@acumium.com on 3 Jul 2012 at 12:47

Attachments:

GoogleCodeExporter commented 9 years ago
You need to apply the exception on mousemove too (around line 2730)

Since mousemove happens on every cursor movement it would be expensive calling 
the function every time, so it's better to keep it in a variable.

mouse_x = pt.x * (isBotchedZoom ? 1 : current_zoom),
mouse_y = pt.y * (isBotchedZoom ? 1 : current_zoom),

Original comment by duopi...@gmail.com on 26 Jul 2012 at 2:59

GoogleCodeExporter commented 9 years ago
Has anyone found a fix for this in the textedit branch?

Original comment by Michael....@gmail.com on 12 Sep 2012 at 3:57

GoogleCodeExporter commented 9 years ago
For me, it was sufficient to fix root_sctm variable:
    root_sctm = svgcontent.getScreenCTM().inverse();
        if (svgedit.browser.isGecko()) {
            root_sctm.a /= current_zoom;
            root_sctm.b /= current_zoom;
            root_sctm.c /= current_zoom;
            root_sctm.d /= current_zoom;
            root_sctm.e /= current_zoom;
            root_sctm.f /= current_zoom;
        }

Original comment by psi...@gmail.com on 10 Oct 2012 at 12:36

GoogleCodeExporter commented 9 years ago
Above does not work for mozilla versions below 13. This is actually a bug with 
mozilla version 13 and above.

https://bugzilla.mozilla.org/show_bug.cgi?id=762411

I fixed it by adding a condition to check for mozilla and its version on 
wherever root_sctm is initialized (Not a elegant solution).

Original comment by prasanth...@gmail.com on 5 Nov 2012 at 6:39

GoogleCodeExporter commented 9 years ago
Fixed at Issue 1046

Original comment by aldoluis...@gmail.com on 6 Feb 2013 at 5:22