Closed autc04 closed 9 years ago
This looks good to me! Thanks for opening a new pull request for this :heart:
I did notice one strange thing, though:
If I start dragging and then the mouse pointer leaves the window area -- the PDF continues scrolling, but in the opposite direction.
I'm wondering if there's a way to make that experience better. Would it be possible and would there be a downside to allowing the dragging functionality provided in this PR even when the mouse pointer leaves the window area, but preventing the automatic scrolling behavior (perhaps by adding a e.preventDefault()
to the mousedown
event handler as well)? Wondering if you tried something like this and if you have any thoughts. :thought_balloon:
I've hacked around a bit more and attached the mousemove
/mouseup
event handlers to $(document)
now, giving nicer behaviour when the mouse leaves the pane.
I got stuck at one problem which makes everything worse for now: A preventDefault
in the mousedown
handler has the unfortunate side effect of also preventing the default behaviour of activating the pane. There's probably some way of triggering that by hand, but I don't know it.
I've hacked around a bit more and attached the mousemove/mouseup event handlers to $(document) now, giving nicer behaviour when the mouse leaves the pane.
:sparkles: I think that looks much better.
I got stuck at one problem which makes everything worse for now: A preventDefault in the mousedown handler has the unfortunate side effect of also preventing the default behaviour of activating the pane. There's probably some way of triggering that by hand, but I don't know it.
I think atom.workspace.getActivePane()?.activate()
might work. See:
https://atom.io/docs/api/v1.1.0-beta.0/Workspace#instance-getActivePane https://atom.io/docs/api/v1.1.0-beta.0/Pane#instance-activate
Does that allow you to trigger the desired behavior?
Got it. atom.workspace.paneForItem(this).activate()
is the magic word.
atom.workspace.paneForItem(this).activate()
is the magic word.
:zap: Yesss. Thanks again for this!
Panning using the mouse and zooming using the mouse wheel.