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

How can I make a limit on the the pan range? #46

Closed
hwoarangzk opened this issue May 29, 2014 · 6 comments
Closed

How can I make a limit on the the pan range? #46

hwoarangzk opened this issue May 29, 2014 · 6 comments

Comments

@hwoarangzk
Copy link

I mean, my svg is in a div container, and I don't want the svg pan too right or too left which can cause the user see the empty container. Can I make a limit to my svg in the container? Allow it only to move to the right side by 50px e.g.?
Thanks.
@hwoarangzk
Copy link
Author

BTW, is there any scale-like property that I could set this value directly to controll the scale of the svg?

@hwoarangzk
Copy link
Author

And could I set a time period to zoom out or zoom in the svg? I mean, just like animate in jQuery that I can set number of milliseconds for the animation to run?
Thank you :)

@bumbu
Copy link
Owner

bumbu commented May 30, 2014

I mean, my svg is in a div container, and I don't want the svg pan too right or too left which can cause the user see the empty container. Can I make a limit to my svg in the container? Allow it only to move to the right side by 50px e.g.?

No right now it is not implemented, but there is issue #37 which is similar. You can see a solution for what you are asking in that issue thread.

BTW, is there any scale-like property that I could set this value directly to controll the scale of the svg?

There is zoomScaleSensitivity option that allows controlling mouse zoom sensitivity.

And could I set a time period to zoom out or zoom in the svg? I mean, just like animate in jQuery that I can set number of milliseconds for the animation to run?

No, there is no such option.

What you can do is to disable zoom (using zoomEnabled option) and create scroll listener. And when user scrolls call API zoom method with desired parameters (you'll have to compute zoom scale and zoom point by yourself).

@bumbu bumbu closed this as completed May 30, 2014
@hwoarangzk
Copy link
Author

There is zoomScaleSensitivity option that allows controlling mouse zoom sensitivity.

I didn't mean the zoomScaleSensitivity. What I wanna say is that is there a scale method that I could change the scale of my svg directly? Like:

$('#svg1').scale(2);

Thank you~

@bumbu
Copy link
Owner

bumbu commented Jun 3, 2014

Yes, there are currently 4 methods for zooming: zoom, zoomBy, zoomAtPoint, zoomAtPointBy.
You can find examples in Readme

@hwoarangzk
Copy link
Author

Yes, zoom is what I'm looking for, thank you!

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

No branches or pull requests

2 participants