From f3cef8c1dbe0b59bf6455fe648cea118bbc52d50 Mon Sep 17 00:00:00 2001 From: speleo3 Date: Sat, 16 May 2009 14:35:10 +0000 Subject: [PATCH] use area ratio instead of diagonal ratio for "Zoom when window is resized" --- src/widgets/desktop-widget.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index 07a152aad..ab09dbe8a 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -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); -- 2.30.2