diff options
author | Thomas White <taw@physics.org> | 2020-03-02 16:00:25 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-07-29 18:42:24 +0200 |
commit | 9cf09264ace112c16924ccd09b43fe26bf737c48 (patch) | |
tree | 4253dd5da7e80dfb613c7e5a960eda5760fc4fe9 /src | |
parent | 7832232ae74501f08f1d530a332e7c573785c89e (diff) |
Preserve view position and zoom across image reload
Diffstat (limited to 'src')
-rw-r--r-- | src/crystfelimageview.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/crystfelimageview.c b/src/crystfelimageview.c index 65698a64..4fd2a97c 100644 --- a/src/crystfelimageview.c +++ b/src/crystfelimageview.c @@ -369,7 +369,7 @@ GtkWidget *crystfel_image_view_new() /* All values initially meaningless */ iv->detector_w = 1.0; iv->detector_h = 1.0; - iv->zoom = 1.0; + iv->zoom = -1.0; iv->filename = NULL; iv->event = NULL; iv->image = NULL; @@ -491,9 +491,12 @@ static int reload_image(CrystFELImageView *iv) 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; + if ( iv->zoom < 0.0 ) { + /* Set initial values */ + 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); return 0; |