Giter Club home page Giter Club logo

Comments (6)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 15, 2024
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

  • Added labels: ****
  • Removed labels: ****

from svgpan.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 15, 2024
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

  • Added labels: ****
  • Removed labels: ****

from svgpan.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 15, 2024
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

  • Added labels: ****
  • Removed labels: ****

from svgpan.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 15, 2024
@ #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

  • Added labels: ****
  • Removed labels: ****

from svgpan.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 15, 2024
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

  • Added labels: ****
  • Removed labels: ****

from svgpan.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 15, 2024
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

  • Added labels: ****
  • Removed labels: ****

from svgpan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.