[gthumb] fixed zoom not centered on the current position
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] fixed zoom not centered on the current position
- Date: Sat, 2 Jan 2016 13:35:55 +0000 (UTC)
commit f84ac9ef9a2b8f5a5d9a992c0008c065484897fc
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sat Jan 2 11:00:32 2016 +0100
fixed zoom not centered on the current position
gthumb/gth-image-viewer.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/gthumb/gth-image-viewer.c b/gthumb/gth-image-viewer.c
index 7d10ac0..0ab0f67 100644
--- a/gthumb/gth-image-viewer.c
+++ b/gthumb/gth-image-viewer.c
@@ -347,18 +347,18 @@ set_zoom (GthImageViewer *self,
image = gth_image_viewer_get_current_image (self);
if (image != NULL) {
double quality_zoom;
- double zoom;
+ double old_zoom_level;
int x, y;
int frame_border;
int new_center_x, new_center_y;
quality_zoom = (double) self->priv->original_width / cairo_image_surface_get_width
(image);
- zoom = self->priv->zoom_level * quality_zoom;
- x = (center_x + self->visible_area.x - self->image_area.x) / zoom;
- y = (center_y + self->visible_area.y - self->image_area.y) / zoom;
+ old_zoom_level = self->priv->zoom_level * quality_zoom;
+ x = (center_x + self->visible_area.x - self->image_area.x) / old_zoom_level;
+ y = (center_y + self->visible_area.y - self->image_area.y) / old_zoom_level;
frame_border = _gth_image_viewer_get_frame_border (self);
- new_center_x = x * zoom_level * quality_zoom + frame_border;
- new_center_y = y * zoom_level * quality_zoom + frame_border;
+ new_center_x = x * zoom_level * quality_zoom + frame_border + 1;
+ new_center_y = y * zoom_level * quality_zoom + frame_border + 1;
self->visible_area.x = new_center_x - (self->visible_area.width / 2);
self->visible_area.y = new_center_y - (self->visible_area.height / 2);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]