[dia] Zooming per area works more consistently
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] Zooming per area works more consistently
- Date: Wed, 20 Oct 2010 19:28:48 +0000 (UTC)
commit 9a5a4f7b78122ddf31809752a0fded247d7ed745
Author: Hans Breuer <hans breuer org>
Date: Wed Oct 20 21:00:37 2010 +0200
Zooming per area works more consistently
the whole zoom rectangle should be visible, not just it's square equivalent
app/magnify.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/app/magnify.c b/app/magnify.c
index 26f1f40..8827829 100644
--- a/app/magnify.c
+++ b/app/magnify.c
@@ -63,7 +63,10 @@ magnify_button_release(MagnifyTool *tool, GdkEventButton *event,
ddisplay_add_update_all(ddisp);
ddisplay_flush(ddisp);
} else if (!(event->state & GDK_CONTROL_MASK)) {
- factor = (visible->right - visible->left) / diff;
+ /* the whole zoom rect should be visible, not just it's square equivalent */
+ real fh = fabs(p2.y - p1.y) / (visible->bottom - visible->top);
+ real fw = fabs(p2.x - p1.x) / (visible->right - visible->left);
+ factor = 1.0 / MAX(fh, fw);
tl.x += (visible->right - visible->left)/(2.0*factor);
tl.y += (visible->bottom - visible->top)/(2.0*factor);
ddisplay_zoom(ddisp, &tl, factor);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]