Code

use area ratio instead of diagonal ratio for "Zoom when window is resized"
authorspeleo3 <speleo3@users.sourceforge.net>
Sat, 16 May 2009 14:35:10 +0000 (14:35 +0000)
committerspeleo3 <speleo3@users.sourceforge.net>
Sat, 16 May 2009 14:35:10 +0000 (14:35 +0000)
src/widgets/desktop-widget.cpp

index 07a152aad3a5b45af3b22a38640cc3f8255a82c2..ab09dbe8a77441571c3ee577fec5d85672369044 100644 (file)
@@ -656,12 +656,10 @@ sp_desktop_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
         }
 
         if (SP_BUTTON_IS_DOWN(dtw->sticky_zoom)) {
-            /* Calculate zoom per pixel */
-            double const zpsp = zoom / hypot (area.dimensions()[Geom::X], area.dimensions()[Geom::Y]);
             /* Find new visible area */
             Geom::Rect newarea = dtw->desktop->get_display_area();
             /* Calculate adjusted zoom */
-            zoom = zpsp * hypot(newarea.dimensions()[Geom::X], newarea.dimensions()[Geom::Y]);
+            zoom *= sqrt(newarea.area() / area.area());
         }
         dtw->desktop->zoom_absolute(area.midpoint()[Geom::X], area.midpoint()[Geom::Y], zoom);