From db8bde5ba66dc4e5ae06539a80115945d6aed1ec Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Fri, 17 Sep 2010 14:27:43 +0000 Subject: [PATCH] Fix issue 380: Exiting zoom mode in a large image jumps the viewport to a 'random' position git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1620 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- src/buttons.c | 16 ++++------------ src/global.h | 8 -------- src/main.c | 4 ---- 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/src/buttons.c b/src/buttons.c index bf1bc301..4fd87b97 100644 --- a/src/buttons.c +++ b/src/buttons.c @@ -1522,8 +1522,6 @@ void Button_Page(void) SWAP_WORDS (Main_visible_image.Height,Spare_visible_image.Height) SWAP_SHORTS(Main_offset_X,Spare_offset_X) SWAP_SHORTS(Main_offset_Y,Spare_offset_Y) - SWAP_SHORTS(Old_main_offset_X,Old_spare_offset_X) - SWAP_SHORTS(Old_main_offset_Y,Old_spare_offset_Y) SWAP_SHORTS(Main_separator_position,Spare_separator_position) SWAP_SHORTS(Main_X_zoom,Spare_X_zoom) SWAP_FLOATS(Main_separator_proportion,Spare_separator_proportion) @@ -3736,8 +3734,6 @@ void Button_Magnify(void) } else { - Old_main_offset_X=Main_offset_X; - Old_main_offset_Y=Main_offset_Y; Compute_magnifier_data(); if ((!Config.Fast_zoom) || (Mouse_Y>=Menu_Y) || Coming_from_zoom_factor_menu) { @@ -3830,24 +3826,20 @@ void Button_Unselect_magnifier(void) // On sort du mode loupe Main_magnifier_mode=0; - /* + // --> Recalculer le décalage de l'écran lorsqu'on sort de la loupe <-- // Centrage "brut" de lécran par rapport à la loupe Main_offset_X=Main_magnifier_offset_X-((Screen_width-Main_magnifier_width)>>1); Main_offset_Y=Main_magnifier_offset_Y-((Menu_Y-Main_magnifier_height)>>1); - */ + // Correction en cas de débordement de l'image - if (Old_main_offset_X+Screen_width>Main_image_width) + if (Main_offset_X+Screen_width>Main_image_width) Main_offset_X=Main_image_width-Screen_width; - else - Main_offset_X=Old_main_offset_X; if (Main_offset_X<0) Main_offset_X=0; - if (Old_main_offset_Y+Menu_Y>Main_image_height) + if (Main_offset_Y+Menu_Y>Main_image_height) Main_offset_Y=Main_image_height-Menu_Y; - else - Main_offset_Y=Old_main_offset_Y; if (Main_offset_Y<0) Main_offset_Y=0; diff --git a/src/global.h b/src/global.h index 3da8af4a..56bce551 100644 --- a/src/global.h +++ b/src/global.h @@ -300,10 +300,6 @@ GFX2_GLOBAL short Main_image_height; GFX2_GLOBAL short Main_offset_X; /// Y position (in image space) of the pixel to display in the top left corner of screen. GFX2_GLOBAL short Main_offset_Y; -/// Backup of ::Main_offset_X, used to store it while the magnifier is open. -GFX2_GLOBAL short Old_main_offset_X; -/// Backup of ::Main_offset_Y, used to store it while the magnifier is open. -GFX2_GLOBAL short Old_main_offset_Y; /// Name of the directory that holds the image currently edited. GFX2_GLOBAL char Main_file_directory[1024]; /// Filename (without directory) of the image currently edited. @@ -370,10 +366,6 @@ GFX2_GLOBAL short Spare_image_height; GFX2_GLOBAL short Spare_offset_X; /// Y position (in image space) of the pixel to display in the top left corner of screen. GFX2_GLOBAL short Spare_offset_Y; -/// Backup of ::Main_offset_X, used to store it while the magnifier is open. -GFX2_GLOBAL short Old_spare_offset_X; -/// Backup of ::Main_offset_Y, used to store it while the magnifier is open. -GFX2_GLOBAL short Old_spare_offset_Y; /// Name of the directory that holds the image currently edited as spare page. GFX2_GLOBAL char Spare_file_directory[MAX_PATH_CHARACTERS]; /// Filename (without directory) of the image currently edited as spare page. diff --git a/src/main.c b/src/main.c index 5619cf08..9beef5af 100644 --- a/src/main.c +++ b/src/main.c @@ -475,8 +475,6 @@ int Init_program(int argc,char * argv[]) // On initialise d'ot' trucs Main_offset_X=0; Main_offset_Y=0; - Old_main_offset_X=0; - Old_main_offset_Y=0; Main_separator_position=0; Main_X_zoom=0; Main_separator_proportion=INITIAL_SEPARATOR_PROPORTION; @@ -488,8 +486,6 @@ int Init_program(int argc,char * argv[]) Main_magnifier_offset_Y=0; Spare_offset_X=0; Spare_offset_Y=0; - Old_spare_offset_X=0; - Old_spare_offset_Y=0; Spare_separator_position=0; Spare_X_zoom=0; Spare_separator_proportion=INITIAL_SEPARATOR_PROPORTION;