occivink / mpv-image-viewer

Configuration, scripts and tips for using mpv as an image viewer
The Unlicense
284 stars 23 forks source link

align-border not fully aligned on smaller pics #26

Open eugenesvk opened 1 year ago

eugenesvk commented 1 year ago

I've noticed when viewing smaller pictures with 100% window size that they're not fully aligned to the window borders with your align-border commands due to it's limits of -3/3 on panning Then I realized that there is a video-align-x command that does exactly that, so was wondering why you're using the panning command video-pan-x for alignment, a simple replacement seems to work and actually align to borders even for smaller pics?

occivink commented 1 year ago

You're right, and it looks like this property has existed for a long time too. The only problem that I can really see is that since there are multiple types of interaction to move the image provided by these scripts, it's best to use the same properties in all cases and not mix them up (same with pan-scan and zoom, you don't really want to combine both). And since video-pan- are the most flexible (except for the [-3..3]), that's what I ended up using in all commands. If you're using mpv in a way that you only care about aligning the image, it might just be better to only use video-align-.

eugenesvk commented 1 year ago

not mix them up

Interesting, I've found the interaction with video-align-x to be useful precisely due to this stupid -3 limit on panning: currently you can't push a small image past the window limits, but if you align to a border, then the whole "reference point" for the video-pan- shifts to the side where the border is at, so now you can do that! (weird API architecture for a simple "move the pic around" case) Then, of course, you lose the ability to align perfectly to borders, need to pan the pic a bit (with constrained option not to overshoot again)

Also, I've noticed another issue with panning — you can't really be pixel-perfect there, sometimes you overshoot on multiple successive commands (so you can't move exactly by margin / vid_size, you might be 1 pixel off or even a hundred pixels off). Weirdly, if you move back and forth, it gets aligned just fine

So if that were fixed and the limit were lifted, then I guess it'd make sense to just use the panning and manualy check for the margin and stop when it reaches 0

eugenesvk commented 1 year ago

For the last bug I've added (margin - 0.5) / vid_size and it seems to fix many of the 1pixel overshoots, but at the same time it doesn't help with bigger ones