GNOME Bugzilla – Bug 540210
Improved zoom behavior when using ctrl+mouse wheel button
Last modified: 2011-01-07 12:08:49 UTC
When using the mouse wheel button to zoom in and out, it may be more intuitive to maintain the drawing zoom center-point based on the cursor position. This can help orientation and prevent the drawing from "jumping" around while zooming in and out. To do this I suggest the following implementation for ddisplay_zoom in display.c: void ddisplay_zoom(DDisplay *ddisp, Point *point, real magnify) { Rectangle *visible; real width, height; // %% // cursor position ratios real rx,ry; // %% visible = &ddisp->visible; // %% // ithai - calculate cursor position ratios rx = (point->x-visible->left)/(visible->right - visible->left); ry = (point->y-visible->top)/(visible->bottom - visible->top); // %% width = (visible->right - visible->left)/magnify; height = (visible->bottom - visible->top)/magnify; if ((ddisp->zoom_factor <= DDISPLAY_MIN_ZOOM) && (magnify<=1.0)) return; if ((ddisp->zoom_factor >= DDISPLAY_MAX_ZOOM) && (magnify>=1.0)) return; ddisp->zoom_factor *= magnify; // %% // ithai - set new origin based on the calculated ratios before zooming ddisplay_set_origo(ddisp, point->x-(width*rx),point->y-(height*ry)); // %% ddisplay_update_scrollbars(ddisp); ddisplay_add_update_all(ddisp); ddisplay_flush(ddisp); update_zoom_status (ddisp); } This works better for me. Tested okay with v0.96+svn.
thanks for the suggestion, just commited: 2008-07-25 Hans Breuer <hans@breuer.org> * app/display.c(ddisplay_zoom) : improved zoom behavior when using ctrl+mouse wheel around the cursor position, based on code by Ithai Levi, bug #540210
sorry, I was too fast, see: 2008-07-26 Hans Breuer <hans@breuer.org> * app/display.c(ddisplay_zoom) : reverted changes from bug #540210, it broke the other use cases, mainly zoom all (ctrl^e)
without an updated patch this is not goind to be part of 0.97
I think it would be possible to add a setting or a key combination to chose between these two zoom mode (zoom around the mouse cursor or zoom around the center of the view) but also around selected objects or a selected area like in some drawing softwares.
The easy fix just applied is implmenting it in a new function just used for wheel zooming. See: http://git.gnome.org/browse/dia/commit/?id=dc4fccba65a30dec1c81b4506a0f44fb880ceaa4
Cherry-picked to dia-0-97 branch.