-
-
Notifications
You must be signed in to change notification settings - Fork 590
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 to use the right mouse drag #1486
Comments
We don't have direct support for that, but you could probably add it. The MouseTracker has a nonPrimaryPressHandler and nonPrimaryReleaseHandler. Those two, combined with the moveHandler, should give you the tools you need. Let me know if that makes sense. |
I don't know... that looks pretty good. It would be easier for me to try if you shared a text version of your code. Anyway, looks like the viewer already has
Let me know if that works for you! |
Thanks a lot, the OpenSeadragon version I am using is 2.3.1, I use the way you provide, it works, it prints 'non-primary drag', but the image doesn't move when I use the right mouse. |
Oh! Of course you still need to pan in the moveHandler. I was just telling you how to get the correct events. Anyway, panning might look like this:
I haven't tried running that code, but it's the basic idea at least. If you want to replicate all of the viewer's drag handling, take a look at how it does it, especially this section: https://github.com/openseadragon/openseadragon/blob/master/src/viewer.js#L2786-L2818 |
thank you very much! You gave me a lot of help. |
WIP Note to self: Add nonprimary-move (and possibly resulting gesture) event support |
I am only getting right mouse events using nonPrimaryPressHandler. Why left mouse press is not working? |
@chiliblast do you have an example of this issue in action? @msalsbery any thoughts? |
Only non-primary pointer button events are handled with nonPrimaryPressHandler/nonPrimaryReleaseHandler. Assuming your left pointer button is the primary button, you'd use pressHandler/releaseHandler. clickHandler and dragHandler only work on primary pointer button presses/releases |
I am trying to get left mouse press and release and drag events in openseadragon. Only nonPrimaryPressHandler, nonPrimaryReleaseHandler and moveHandler are working. but onPrimaryPressHandler, nonPrimaryReleaseHandler are only working for right mouse event. Also canvas events does not work for left mouse events. How can I get left mouse press, release?
|
Attaching a MouseTracker to the Viewer.container element won't work, as primary button events don't bubble from the Viewer.element element (in v3.0.0 they will) It may be easier to subscribe to the Viewer canvas-click, canvas-drag, canvas-press, canvas-release, etc. events if you want to handle primary button events on the viewer... e.g.
|
@msalsbery |
I have a question. There is a speed exceeding problem when the right button moves, and it cannot be controlled by the speed like the left button.I added event throttling but it didn't take effect. |
@Ghostisme I'm not sure what you're referring to. Can you explain further, or share a video, or a link? What settings did you use and what effect are you seeing? |
@iangilman sure, The demo case I quoted above is to achieve panning, but I found it is not very friendly, it is not as smooth as the left key panning. So I want to ask how to make the translation of the right button as smooth as the left button.And I also tried to use the source code to implement it, but it doesn't work. |
@Ghostisme Gotcha. You might be interested in #2258... Sounds like it might do what you're talking about? |
@iangilman Oh, it's not #2258, it's the current issue, it's just the right-click translation that I need to complete |
This comment was marked as resolved.
This comment was marked as resolved.
@Ghostisme I see! As I mentioned there, I hadn't tried running the code when I wrote it. I've now tried it, and sure enough, there were a couple of bugs. Here's the correct version:
Let me know if that works! I've added comments on the bits that needed fixing. |
@iangilman Whoa, cool, I tried it and it was exactly what I was looking for, thanks a lot |
@iangilman Hi! I have tried your code:
And it works really well. However, how do I make these config: |
If you want to apply the constraints while you pan you can add There is currently no way to just swap left and right button handling. |
I see. I understand. Thank you! |
WIP #2258 |
Hi @iangilman — this is helpful! Although it differs from the standard left-mouse pan behavior in that the Mousetracker doesn't fire when you drag past the edge of the canvas, nor does the |
Pointer capture needs to be used to get the primary button behavior when the pointer moves outside the tracked element. Pointer capture, along with "chorded" button presses, is what complicates implementing the feature enhancement. Hopefully I'll have something working soon... |
I added an overlay to annotate lines, but when I use the left mouse button to annotate it, I can't drag it anymore. So, I want to drag it with the right mouse button.
The text was updated successfully, but these errors were encountered: