Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mouse wheel zooming does not work in Opera 11, IE9 #6

Open
GoogleCodeExporter opened this issue Mar 16, 2015 · 6 comments
Open

mouse wheel zooming does not work in Opera 11, IE9 #6

GoogleCodeExporter opened this issue Mar 16, 2015 · 6 comments

Comments

@GoogleCodeExporter
Copy link

The image does not zoom in these browsers. It works fine in chrome and Firefox 5

Original issue reported on code.google.com by [email protected] on 22 Jun 2011 at 4:34

@GoogleCodeExporter
Copy link
Author

If you use this this code:

if (window.addEventListener)
        /** DOMMouseScroll is for mozilla. */
        window.addEventListener('DOMMouseScroll', wheel, false);
/** IE/Opera. */
window.onmousewheel = document.onmousewheel = wheel;

to setup mousewheel events instead of the one in SVGPAN.js then it works also 
in Opera and IE9.

Original comment by [email protected] on 2 Dec 2011 at 6:42

@GoogleCodeExporter
Copy link
Author

The following seemed to work for me (version 1.2.2):

    //if(navigator.userAgent.toLowerCase().indexOf('webkit') >= 0)
            window.addEventListener('mousewheel', handleMouseWheel, false); // Chrome/Safari
    //else
            window.addEventListener('DOMMouseScroll', handleMouseWheel, false); // Others

Original comment by [email protected] on 8 Feb 2012 at 11:10

@GoogleCodeExporter
Copy link
Author

I modified it as follows to get it to work in Opera, Chrome, Safari, Firefox, 
and IE9:

    if (navigator.userAgent.match(/like Mac OS X/i)) {
        window.addEventListener('gesturechange',handleMouseWheel,false); // iOS gestures (UNTESTED)
    } else if (navigator.userAgent.toLowerCase().indexOf('firefox') >= 0) {
        window.addEventListener('DOMMouseScroll', handleMouseWheel, false); // Firefox
    } else {
        window.addEventListener('mousewheel', handleMouseWheel, false); // Chrome/Safari/Opera/Explorer9
    }

I haven't yet tested the iOS gesture code.

Original comment by [email protected] on 13 Jul 2012 at 3:05

@GoogleCodeExporter
Copy link
Author

@ #3

Had to change it from window.addEventListener… to root.addEventListener… to 
make it work. Thanks! 

Original comment by [email protected] on 21 Oct 2013 at 12:12

@GoogleCodeExporter
Copy link
Author

I tried all the above but could not get it to work properly in IE11...

Original comment by [email protected] on 12 Jan 2015 at 2:27

@GoogleCodeExporter
Copy link
Author

I traced the source of the problem to getEventPoint...

I amended the code as below and it worked!

/**
 * Instance an SVGPoint object with given event coordinates.
 */
function getEventPoint(evt) {
    if(evt==null){return;}
    var p;
    try
    {
        p = root.createSVGPoint();
    }
    catch(e)
    {
    }

    if(p==null)
    {
        var svgDoc = evt.target.ownerDocument;
        var g = getRoot(svgDoc);
        p = g.nearestViewportElement.createSVGPoint();
    }

    p.x = evt.clientX;
    p.y = evt.clientY;

    return p;
}

Original comment by [email protected] on 12 Jan 2015 at 3:16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant