Comments (6)
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.
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.
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.
@ #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.
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.
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)
- SVGPan doesn't work in Firefox HOT 1
- Does not find first g-element, only works with id="viewport" attribute
- Mouse cursor loses objects while dragging in Zoom HOT 1
- Type error: matrix is null in Firefox 19. Chromium works without problems. HOT 1
- viewBox is not supported
- panning does not work HOT 1
- Block dezoom at 100%
- settAttributeNS of undefined or null reference
- panning on mobile browser sometimes locks into strictly vertical or horizontal panning
- Antegrate with Angular
- Problems with setCTM when the viewBox transformation is large
- svg inner xlinks fail
- Disable events after dragging
- No wheelmouse under MsIE 11
- Collaborate? HOT 4
- Add tests
- Support specifying a different root element via an attribute on the script
- svgs with viewbox already set won't work well
- preventDefault warning
- demo? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from svgpan.