aboutsummaryrefslogtreecommitdiff
path: root/src/crystfelimageview.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-02-29 14:35:13 +0100
committerThomas White <taw@physics.org>2020-07-29 18:42:24 +0200
commitff5de8079c5caa80405127ccc02c258b99002cbf (patch)
tree6b32344af850b5bee7c7953032decedce1e817e7 /src/crystfelimageview.c
parent00fef1ce0333b4a0a425ea1cbd5855caa16b4041 (diff)
Make scrolling work properly
Diffstat (limited to 'src/crystfelimageview.c')
-rw-r--r--src/crystfelimageview.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/crystfelimageview.c b/src/crystfelimageview.c
index 001a7ca7..5fa16976 100644
--- a/src/crystfelimageview.c
+++ b/src/crystfelimageview.c
@@ -93,14 +93,14 @@ static void configure_scroll_adjustments(CrystFELImageView *iv)
double pos = gtk_adjustment_get_value(iv->hadj);
double vis_size = iv->visible_width / iv->zoom;
gtk_adjustment_configure(iv->hadj, pos,
- -2*iv->detector_w, 2*iv->detector_w,
+ 0.0, iv->detector_w,
0.0001, 0.1, vis_size);
}
if ( iv->vadj != NULL ) {
double pos = gtk_adjustment_get_value(iv->vadj);
double vis_size = iv->visible_height / iv->zoom;
gtk_adjustment_configure(iv->vadj, pos,
- -2*iv->detector_h, 2*iv->detector_h,
+ 0.0, iv->detector_h,
0.0001, 0.1, vis_size);
}
}
@@ -201,6 +201,7 @@ static gint draw_sig(GtkWidget *window, cairo_t *cr, CrystFELImageView *iv)
cairo_scale(cr, iv->zoom, iv->zoom);
cairo_scale(cr, 1.0, -1.0);
+ cairo_translate(cr, iv->offs_x, iv->offs_y);
cairo_translate(cr, -gtk_adjustment_get_value(iv->hadj),
gtk_adjustment_get_value(iv->vadj));
@@ -452,6 +453,7 @@ static int reload_image(CrystFELImageView *iv)
int i;
int n_pb;
double min_x, min_y, max_x, max_y;
+ double border;
if ( iv->dtempl == NULL ) return 0;
if ( iv->filename == NULL ) return 0;
@@ -479,6 +481,11 @@ static int reload_image(CrystFELImageView *iv)
STATUS("Extents: %f %f %f %f\n", min_x, min_y, max_x, max_y);
iv->detector_w = max_x - min_x;
iv->detector_h = max_y - min_y;
+ border = iv->detector_w * 0.1;
+ iv->detector_w += border;
+ iv->detector_h += border;
+ iv->offs_x = -min_x + border/2.0;
+ iv->offs_y = -max_y - border/2.0;
iv->zoom = 1.0/iv->image->detgeom->panels[0].pixel_pitch;
configure_scroll_adjustments(iv);