-
Notifications
You must be signed in to change notification settings - Fork 54
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
Please add a method to pan svg programmatically #98
Comments
you would use the viewbox function for that purpose. const p = { x: 200, y: 200 } // center this point
const vb = canvas.viewbox()
const {cx, cy} = vb
const deltaX = p.x - cx
const deltaY = p.y - c.y
canvas.viewbox({
...vb,
x: vb.x - deltaX,
y: vb.y - deltaY
}) Didnt test that code. Probably have some flipped negative signs there |
Thank you very much! But it's better if you can provide a pan() method based on your thoughts above. |
Feel free to create a PR to contribute this method. Unfortunately I cannot do open source full time and I am also not quite sure if a method is neccessary. For now, you can just use the code I provided :) |
I am not talented as you are at coding. Thank you very much! |
If you are able to use this library you are also able to create a PR |
I also need something similar to this and seems like a good fit for this plugin. What I'm thinking is to isolate the 'core' code inside |
I wouldnt use a private method since its only a few lines long. Just inline it :) |
I can't find any method for this purpose. Could you add one? thank you.
The text was updated successfully, but these errors were encountered: