diff options
| author | Daniel Friesel <derf@derf.homelinux.org> | 2010-04-22 14:55:45 +0200 | 
|---|---|---|
| committer | Daniel Friesel <derf@derf.homelinux.org> | 2010-04-22 14:55:45 +0200 | 
| commit | 0da6b6d254be180d921d07996289389bea13fc4b (patch) | |
| tree | 18a142e166aeec113dc975a576dfdf36f08ebafd | |
| parent | 9e0afdfee30fc32afaf03c9a44f2f05a7704f3ba (diff) | |
Fix zoom mode once and for all[tm]
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | TODO | 2 | ||||
| -rw-r--r-- | src/events.c | 21 | ||||
| -rw-r--r-- | src/winwidget.h | 6 | 
4 files changed, 13 insertions, 20 deletions
| @@ -1,5 +1,9 @@  * git HEAD       * Warp the pointer when reaching a window border in pan mode +     * Various zoom mode improvements, should be more intuitive now +       + When entering zoom mode, always continue from previous zoom level +       + The image part you clicked on to start zoom mode will remain where it +         is. The zoom happen around at that pixel.  Fri Apr  2 16:20:55 CEST 2010  Daniel Friesel <derf@chaosdorf.de> @@ -26,4 +26,4 @@ Maybe I'll someday find out how to fix that :>  Make --start-at work with paths as well -Fix zooming with middle mouse button +Document new zoom behaviour diff --git a/src/events.c b/src/events.c index a642ca4..54321be 100644 --- a/src/events.c +++ b/src/events.c @@ -132,8 +132,10 @@ static void feh_event_handle_ButtonPress(XEvent * ev)  			winwid->zoom = 1.0;  			/* required to adjust the image position in zoom mode */ -			winwid->orig_im_x = winwid->im_x; -			winwid->orig_im_y = winwid->im_y; +			winwid->im_click_offset_x = (winwid->click_offset_x +					- winwid->im_x) / winwid->old_zoom; +			winwid->im_click_offset_y = (winwid->click_offset_y +					- winwid->im_y) / winwid->old_zoom;  			/* center the image */  			if (winwid->full_screen) { @@ -152,15 +154,6 @@ static void feh_event_handle_ButtonPress(XEvent * ev)  				}  			} -			if (winwid->click_offset_x < 0) -				winwid->click_offset_x = 0; -			if (winwid->click_offset_y < 0) -				winwid->click_offset_y = 0; -			if (winwid->click_offset_x > winwid->w) -				winwid->click_offset_x = winwid->w; -			if (winwid->click_offset_y > winwid->h) -				winwid->click_offset_y = winwid->h; -  			winwidget_render_image(winwid, 0, 0);  		}  	} else if (ev->xbutton.button == opt.reload_button) { @@ -438,11 +431,9 @@ static void feh_event_handle_MotionNotify(XEvent * ev)  			/* center around click_offset */  			winwid->im_x = winwid->click_offset_x -					- (winwid->click_offset_x * winwid->zoom); -					/*+ (winwid->orig_im_x * winwid->zoom);*/ +					- (winwid->im_click_offset_x * winwid->zoom);  			winwid->im_y = winwid->click_offset_y -					- (winwid->click_offset_y * winwid->zoom); -					/*+ (winwid->orig_im_y * winwid->zoom);*/ +					- (winwid->im_click_offset_y * winwid->zoom);  			winwidget_render_image(winwid, 0, 0);  		} diff --git a/src/winwidget.h b/src/winwidget.h index 8f03323..137ceda 100644 --- a/src/winwidget.h +++ b/src/winwidget.h @@ -101,10 +101,6 @@ struct __winwidget {  	int im_x;  	int im_y; -	/* same, as cache for zoom mode */ -	int orig_im_x; -	int orig_im_y; -  	/* From 0 (not visible) to 1.00 (actual size)  	 * all the way up to INT_MAX (eww)  	 */ @@ -113,6 +109,8 @@ struct __winwidget {  	int click_offset_x;  	int click_offset_y; +	int im_click_offset_x; +	int im_click_offset_y;  	unsigned char has_rotated;  }; | 
