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.
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.

1 participant