aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/crystfelimageview.c11
-rw-r--r--src/crystfelimageview.h2
2 files changed, 11 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);
diff --git a/src/crystfelimageview.h b/src/crystfelimageview.h
index 8d3b23aa..ca2d116f 100644
--- a/src/crystfelimageview.h
+++ b/src/crystfelimageview.h
@@ -78,6 +78,8 @@ struct _crystfelimageview
double drag_start_y;
double drag_start_sp_x;
double drag_start_sp_y;
+ double offs_x;
+ double offs_y;
DataTemplate *dtempl;
char *filename;