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

positioning.lua: add this script #15314

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

guidocella
Copy link
Contributor

This script provides script messages and bindings to pan videos and images, making mpv a better image viewer out of the box.

I've had this script for 3 years in my image config so why not upstream it to view images better out of the box. Credits to occivink for the original ideas of the bindings.

I also have a mouse gesture and a oneshot double page mode in my script but those may not be worth upstreaming.

For the reasoning behind the suppress_osd naming, see #9051 (comment)

Touch input in cursor-centric-zoom is untested.

For negative zoom, I think we need a global option like --auto-recenter-video (implemented in vo_get_src_dst_rects()?) to reset video-align to 0 when the image is smaller than the OSD, so that it also applies when changing video-zoom/panscan/video-unscaled/video-aspect-override/video-scale/changing file. Then positioning.lua should do nothing when that option is true and the image is smaller than the OSD. In my config, I use

mp.observe_property('osd-dimensions', 'native', function (_, dims)
    if dims.ml + dims.mr > 0 then
        mp.set_property('video-align-x', 0)
    end
    if dims.mt + dims.mb > 0 then
        mp.set_property('video-align-y', 0)
    end
end)

Copy link

github-actions bot commented Nov 14, 2024

Download the artifacts for this pull request:

Windows
macOS

This script provides script messages and bindings to pan videos and
images, making mpv a better image viewer out of the box.
@kasper93
Copy link
Contributor

Can we add default keybindings for those commands? Else it will become dead code.

@guidocella
Copy link
Contributor Author

Sure I was trying not to burden the original proposal with breaking changes. What about:

Move cycle pause to MBTN_LEFT
drag-to-pan on MBTN_RIGHT
align-to-cursor on MBTN_MID
cursor-centric-zoom on Ctrl+wheel
Rebind Alt+Arrows to osd-relative-pan
?

Unfortunately we can't easily set different default key bindings for images if we're set on deprecating input sections.

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 this pull request may close these issues.

2 participants