diff options
author | Thomas White <taw@physics.org> | 2021-03-17 16:17:22 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2021-03-17 16:17:22 +0100 |
commit | efb6ec7b3899a90f8e1a977895e23042c35040f7 (patch) | |
tree | 4ab784e34e3a50d7e19152fc29b42dd20bddf747 /src | |
parent | cc62bcd177e8c93f1d6a19c98b2cfb680962dc47 (diff) |
CrystFELImageView: Fix zoom limits
Diffstat (limited to 'src')
-rw-r--r-- | src/crystfelimageview.c | 7 | ||||
-rw-r--r-- | src/crystfelimageview.h | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/crystfelimageview.c b/src/crystfelimageview.c index ec1e373c..8302ae44 100644 --- a/src/crystfelimageview.c +++ b/src/crystfelimageview.c @@ -146,10 +146,11 @@ static gint scroll_sig(GtkWidget *window, GdkEventScroll *event, if ( event->direction == GDK_SCROLL_LEFT ) return TRUE; if ( event->direction == GDK_SCROLL_RIGHT ) return TRUE; - ratio = iv->zoom / iv->image->detgeom->panels[0].pixel_pitch; + /* Size of a detector pixel in screen pixels */ + ratio = iv->zoom * iv->image->detgeom->panels[0].pixel_pitch; - if ( (ratio < 5e6) && (zoom_scale < 1.0) ) zoom_allowed = 0; - if ( (ratio > 1e10) && (zoom_scale > 1.0) ) zoom_allowed = 0; + if ( (ratio < 0.05) && (zoom_scale < 1.0) ) zoom_allowed = 0; + if ( (ratio > 100.0) && (zoom_scale > 1.0) ) zoom_allowed = 0; if ( claim && zoom_allowed ) { diff --git a/src/crystfelimageview.h b/src/crystfelimageview.h index 3de712db..7d3ac1f6 100644 --- a/src/crystfelimageview.h +++ b/src/crystfelimageview.h @@ -75,7 +75,7 @@ struct _crystfelimageview GtkAdjustment *vadj; double visible_width; double visible_height; - double zoom; + double zoom; /* screen pixels per m */ double drag_start_x; double drag_start_y; double drag_start_sp_x; |