-
Notifications
You must be signed in to change notification settings - Fork 389
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
Add right-click to reset zoom and pan #87
Conversation
Thanks for the pull. I'm not sure if this should be a core functionality as right click has default behavior in majority of browsers (for me on OS X Chrome it displays a contextual menu). And I would expect it to work that way. But even if we're going to add this functionality it is necessary first to:
|
Will do. (Mainly wanted to make sure that it was interesting to someone other than me before spending too much time.)Do you think that double-right-clicking should have a distinctive behavior? Options (and I only want to implement one):- Right click to zoom out. Double right-click to reset zoom and pan. - Right click to reset zoom and pan. Double right-click to reset pan. - ?? |
Sincerely I think that we shouldn't touch right click at all as it is not a feature on which we can and should rely. Some browser may even not allow you to block contextual menu on right click. So you'll have pan zoom functionality and the menu. And this will be confusing. But I would like to hear opinions of other people. @ariutta? |
Hmm... would it be possible for this functionality to work as a plugin? I appreciate the pull request, but I agree with @bumbu that this may not belong in the core of the library. |
Because of how deeply click handling is intertwined with the library, it seems like a plugin wouldn't work particularly well. (I think that the current code doesn't -- depending on the options set -- distinguish between double-right and double-left clicks.) |
The application, by the way, is viewing SVGs rather the size of blueprints which require a large amount of zooming-in, zooming-out, and panning on a computer screen. I'm open to suggestions as to the right way to do this... (Right now I'm using this trivial patch internally.) |
It should be possible to create a plugin without changing the core via It is an idea for a future version to allow easier manipulation of inner used events. |
I like that. We'll refactor to allow easier manipulation of inner used events. Then the code from this pull request can become the first plugin, thanks to @dlg-yahoo! At this point, the core of the library seems nearly feature complete to me. To keep the size reasonable, let's think twice before adding new features to the core. But once the above refactoring is done, we can freely add unlimited new features as plugins. |
@dlg-yahoo, thanks again for the pull request and sorry for my delay in responding. I added you as a collaborator so you can contribute more easily. Feel free to edit examples/documentation/etc. at any time. Just give me or @bumbu a chance to review first if you want to commit to the core code in the master branch. |
This code may be moved into a plugin (as per #98) but it will be not merged into core. |
Add an option to enable right clicking to reset the zoom and pan.