-
Notifications
You must be signed in to change notification settings - Fork 22
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
drag-to-pan usually gets stuck #2
Comments
I just tried it with Actually judging by the symptoms it looks like it's the Can you try this short script, and report what it prints to the console? Just move the mouse around and press the right mouse button.
|
I don't know if it's related to 0ion9's troubles, but for me drag-to-pan typically only works if the initiating click is in the upper left quadrant of an image. If the image is zoomed such that the lower right corner of the image is in the upper left of the window, then I can click there to drag and the drag will follow across the full extent of the screen, but initiating drags in the lower right of the window doesn't work. I've been meaning to investigate this more, but haven't gotten around to it yet. Maybe it's unrelated but if so it suggests to me there might be something quite screwy going on in mpv's handling of these sort of mouse events. (this is on OSX for me) |
Ok I was just testing around and it seems like the OSC is intercepting mouse movement, such that the script never gets the events. @0ion9 can you confirm that you have the OSC enabled, and whether disabling it ( I'm not sure if there's a better fix for it |
@occivink I can confirm, the OSC being enabled seems to be responsible, at least for my problem. Thanks. |
As a work-around to the OSC intercepting mouse events, in my branch of mpv-image-viewer I've added a line to disable the OSC when an image is loaded using This is basically the equivalent of osc=no in mpv.conf, as recommended. Disabling the OSC seems like a perfectly adequate fix to me since the OSC isn't very useful for images. Though maybe a comment could be added to that config option explaining that the OSC interferes with mouse events. |
The output of that seems sensible to me -- coords vary continously as I move, and button press reports a down then an up. EDIT: aah, suddenly comments.. Hold on, I'll try to check the OSC. I do want OSC for movies (and maybe animated gifs..) so your solution sounds good jgreco.) EDIT2: No. OSC was already off, and turning it on doesn't make things any worse either. EDIT3: Stripping down mpv scripts, this appears to actually be caused by easycrop.lua (which does bind BTW: osc=yes is still way better than original conditions for me -- when OSC is up, drag is somewhat impaired, when it's hidden, drag is normal. Configuring OSC @jgreco: EDIT4: Increasing deadzonesize to 1.0 seems to be effective in preventing OSC interference. I also set minmousemove to 100, but this might be too insensitive. |
Not sure if this is related to the issues in this discussion, but when I click to drag or scroll to zoom using the features of this script, it will not work correctly unless the mouse has moved at least 1 pixel over the mpv window since mpv started. If it hasn't, the drag will move the image suddenly out of frame, and the zoom will always be centred on the top left corner of the image. I assume that when the mouse hasn't been moved, mpv doesn't pick up the actual position of the mouse on startup? |
Yeah, I wasn't aware of this but it looks like |
I am now testing mouse pan with both Anybody any ideas how to fix this? |
@dumblob the whole window? to me, right-click doesn't work just like what metioned above, you can try to bind the function with 'ctrl+MBTN_RIGHT' instead of 'MBTN_RIGHT', or add this code 'mp.commandv("script-message", "osc-visibility" ,"never")' before 'mp.add_forced_key_binding("mouse_move", "image-viewer-mouse-move", function() moved = true end)'. i fix it but i don't know the reason. maybe it's the confliction betwenn bulit-in mouse button and osc. because i use 'h' to trigger the funtion and it works too. |
@butteria I forgot to mention I have tested panning with Now I have tried it with Therefore I would call this (and similar) a special bug as Any ideas how to circumvent this "buggy" behavior? I would appreciate even very hacky solutions or workarounds 😉. |
Note that That said I have tried this trick and it does not change any of the behavior I was observing without this trick. Thanks anyway @butteria . Any other ideas? |
Finally I found out that Thanks everyone for your help! |
I have drag-to-pan bound as suggested in input.conf:
MBTN_RIGHT script-binding image-viewer/drag-to-pan
Usually this binding does not work -- ie. rightclicking or rightdragging doesn't do anything visible. However, operating the mousewheel to zoom in/out and then quickly rightdragging allows drag-to-pan to work. After that one operation, I must again perform the mousewheel -> drag dance if I want to pan again.
My conclusion is that cursor-centric-zoom (or a sideeffect of it) sets some part of mpv state in a way that allows drag-to-pan to work, but this state 'times out' (maybe something that is automatically reset by MPV). Reading the code, the only idea that occurs to me is the table["event"] == "down" check.
'pan follows cursor', which makes the same check, doesn't appear to work correctly, but fails in a slightly different, more usable way (it works as a oneshot operation that, as soon as the click comes in, takes the relative mouse position within the window as the point within the image to pan to, eg. clicking 0,0 in the window pans to the top left of image and the operation immediately ends)
MPV event API has changed in some subtle way, perhaps?
EDIT: it's also worth noting that other mpv scripts using dragging work completely normally -- eg, mpv_crop_script. I haven't yet found another script that tries to bind dragging directly (rather than within a distinct mode), but if you know of one, I'm happy to test it.
EDIT2: You'd think that 'window-dragging' might impact this, but window-dragging=yes or no, neither have any effect on the problem.
EDIT3: That's enough debugging for a bit. My current best guess is that there is some other valid state for table["event"] that should be caught.
mpv version: 0.29.0-75-gda1073c247
The text was updated successfully, but these errors were encountered: