lel

Fork of Hiltjo's Farbfeld image viewer. (It was just for fun, not much use)
Log | Files | Refs | README | LICENSE

commit 4d2dac24171ef1aa102ce20a4a26a77d0fc3d298
parent 8315a680be35167b4bbc09da84a262fb3c868c0f
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Sun, 18 Apr 2021 05:25:35 -0700

Make pan percentage easy to change

Add panperc which pans in percentage of the window size and a
variable which specifies this percentage.

Diffstat:
Mlel.c | 15+++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/lel.c b/lel.c @@ -54,6 +54,7 @@ static int done; static int winwidth = 0, winheight = 0; static int winx, winy, reqwinwidth = 320, reqwinheight = 240; static float zoominc = 0.25; +static int paninc = 20; static void edie(int e, char *s) @@ -323,6 +324,12 @@ pan(int x, int y) } static void +panperc(int x, int y) +{ + pan(winwidth / 100 * x, winheight / 100 * y); +} + +static void inczoom(float f) { if ((img.view.zoomfact + f) <= 0) @@ -374,19 +381,19 @@ keypress(XEvent *ev) break; case XK_Left: case XK_h: - pan(winwidth / 20, 0); + panperc(paninc, 0); break; case XK_Down: case XK_j: - pan(0, -(winheight / 20)); + panperc(0, -paninc); break; case XK_Up: case XK_k: - pan(0, winheight / 20); + panperc(0, paninc); break; case XK_Right: case XK_l: - pan(-(winwidth / 20), 0); + panperc(-paninc, 0); break; case XK_a: setview(FULL_ASPECT);