Add keybind to scroll to image center (#203)

There are keybinds for scrolling to the edges of an image but there's no way back to the center. This is particularly annoying while zooming.
This commit is contained in:
Nick Hanley
2022-01-15 17:51:31 -05:00
committed by GitHub
parent 7a75c42b37
commit 2ac44709bd
6 changed files with 20 additions and 0 deletions

View File

@ -744,6 +744,14 @@ bool img_pan(img_t *img, direction_t dir, int d)
return false;
}
bool img_pan_center(img_t *img)
{
float x, y;
x = (img->win->w - img->w * img->zoom) / 2.0;
y = (img->win->h - img->h * img->zoom) / 2.0;
return img_pos(img, x, y);
}
bool img_pan_edge(img_t *img, direction_t dir)
{
float ox, oy;