dia r4096 - in trunk: . app
- From: hans svn gnome org
- To: svn-commits-list gnome org
- Subject: dia r4096 - in trunk: . app
- Date: Fri, 25 Jul 2008 13:03:47 +0000 (UTC)
Author: hans
Date: Fri Jul 25 13:03:47 2008
New Revision: 4096
URL: http://svn.gnome.org/viewvc/dia?rev=4096&view=rev
Log:
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
* app/mavigation.c : don't divide by zero when using the navigation
window with an empty diagram
Modified:
trunk/ChangeLog
trunk/app/display.c
trunk/app/navigation.c
Modified: trunk/app/display.c
==============================================================================
--- trunk/app/display.c (original)
+++ trunk/app/display.c Fri Jul 25 13:03:47 2008
@@ -759,11 +759,15 @@
{
Rectangle *visible;
real width, height;
+ real rx, ry;
visible = &ddisp->visible;
width = (visible->right - visible->left)/magnify;
height = (visible->bottom - visible->top)/magnify;
+ /* calculate cursor position ratios */
+ rx = (point->x - visible->left) / (visible->right - visible->left);
+ ry = (point->y - visible->top) / (visible->bottom - visible->top);
if ((ddisp->zoom_factor <= DDISPLAY_MIN_ZOOM) && (magnify<=1.0))
return;
@@ -772,7 +776,8 @@
ddisp->zoom_factor *= magnify;
- ddisplay_set_origo(ddisp, point->x - width/2.0, point->y - height/2.0);
+ /* 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);
Modified: trunk/app/navigation.c
==============================================================================
--- trunk/app/navigation.c (original)
+++ trunk/app/navigation.c Fri Jul 25 13:03:47 2008
@@ -177,6 +177,9 @@
diagram_width = (int) ddisplay_transform_length (nav->ddisp, (rect.right - rect.left));
diagram_height = (int) ddisplay_transform_length (nav->ddisp, (rect.bottom - rect.top));
+ if (diagram_width * diagram_height == 0)
+ return; /* don't crash with no size, i.e. empty diagram */
+
canvas_width = nav->ddisp->canvas->allocation.width;
canvas_height = nav->ddisp->canvas->allocation.height;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]