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

Allow limits on zooming / panning #10

Closed
spoenemann opened this issue Oct 30, 2018 · 2 comments · Fixed by #356
Closed

Allow limits on zooming / panning #10

spoenemann opened this issue Oct 30, 2018 · 2 comments · Fixed by #356
Assignees
Milestone

Comments

@spoenemann
Copy link
Contributor

From theia-ide/sprotty#220:

One can get lost by zooming extremely far in or out or by panning far away. It should be possible to configure limits on how far one can zoom and pan.

@tunesmith
Copy link

Just curious if anyone has examples on how to custom implement this in a local project if the library itself does not have support? Would it just be a matter of attaching event listeners to the div that contains the svg and doing the math? I noticed that the sprotty examples (like circlegraph) can basically zoom in and out to infinity.

A long time ago I implemented something in jquery that limits zoom and pan, example here, but I don't know if it could be adapted to sprotty.

@spoenemann
Copy link
Contributor Author

A possible solution would be to bind a different implementation of SetViewportCommand (viewport.ts), for example with a subclass that limits the viewport in its constructor.

rebind(SetViewportCommand).to(CustomSetViewportCommand);

To solve this in a generic way, we could add respective optional properties to ViewerOptions and inject them in SetViewportCommand.

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

Successfully merging a pull request may close this issue.

2 participants