Comments (7)
Could you please give an example here https://jsfiddle.net or somewhere else where I could test it?
from panzoom.
yes It seems to work now, i will reverify that it's broken.....
If it is I will give example, thanks again
from panzoom.
The example fiddle that was given actually has an invalid zoom point:
https://jsfiddle.net/uwxcmbyg/
If you resize the windows (especially shrink the javascript window to the left) then it will be very obvious (at least it is on Chrome).
from panzoom.
As far as I can tell, this has something to do with the viewBox
attribute. I can reproduce with the following files:
HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Panzoom test</title>
<script src="panzoom.min.js"></script>
<script>
window.addEventListener('load', function () {
panzoom(document.getElementById('container'));
});
</script>
</head>
<body>
<svg viewBox="0 0 800 500">
<g id="container"><circle cx="150" cy="150" r="40"/></g>
</svg>
</body>
</html>
Or with pure SVG:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 800 500">
<defs>
<script xlink:href="panzoom.min.js"/>
<script>//<![CDATA[
window.addEventListener('load', function () {
panzoom(document.getElementById('container'));
});
//]]></script>
</defs>
<g id="container"><circle cx="150" cy="150" r="40"/></g>
</svg>
When I open any of these files in my browser and try to zoom with the mouse cursor over the center of the circle, I'd expect the circle to stay in its place and just zoom, but it actually also moves.
When I remove the viewBox
attribute, zooming works as expected in both cases.
from panzoom.
Yup. viewBox
is causing the bug. Not sure yet how to fix it.
from panzoom.
This should be fixed now. Demo: http://jsbin.com/siyipif/1/edit?html,output
from panzoom.
thanks anvaka this is wonderful news
from panzoom.
Related Issues (20)
- Two finger pan is already implemented? HOT 3
- Why is there a black border when I press the keyboard HOT 4
- Artifacts appearing when pan/zooming with audio element HOT 1
- Is there a way to resume paused panzoom while holding mousedown? HOT 1
- Pause/resume the panzoom not working?
- Speed for SmoothZoom
- How to track zoom-in and zoom-out when zooming image in carousel
- Pan restrict only to image view HOT 1
- Bounds doesn't work when you rotate the parent div.
- Multiple panzoom?
- Brake/destroy pan animation
- Disable pan on zoom/scale == 1?
- Pan is too sensitive
- Disable zoom on ios and android? HOT 1
- Zoom and Pan iframe array HOT 1
- Images drifting off screen
- Remove and restore transform styles
- zoomAbs, smoothZoom, moveTo etc weird effects HOT 1
- swipe left / right to change "page"
- onDoubleClick zoom in zoom out
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 panzoom.