[f-spot] Keep the current offsets when a higher quality image gets loaded.
- From: Ruben Vermeersch <rubenv src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [f-spot] Keep the current offsets when a higher quality image gets loaded.
- Date: Wed, 12 Aug 2009 13:00:21 +0000 (UTC)
commit 83290d9488b1abdd33e03cd0e0e6c8335f870eef
Author: Ruben Vermeersch <ruben savanne be>
Date: Thu Jul 23 21:16:48 2009 +0200
Keep the current offsets when a higher quality image gets loaded.
src/Widgets/ImageView.cs | 16 +++++++---------
1 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/src/Widgets/ImageView.cs b/src/Widgets/ImageView.cs
index add9637..920fef5 100644
--- a/src/Widgets/ImageView.cs
+++ b/src/Widgets/ImageView.cs
@@ -61,20 +61,18 @@ namespace FSpot.Widgets
ComputeScaledSize ();
if (is_new) {
- AdjustmentsChanged -= ScrollToAdjustments;
- Hadjustment.Value = Vadjustment.Value = 0;
- XOffset = YOffset = 0;
- AdjustmentsChanged += ScrollToAdjustments;
- prev_width = PixbufUtils.UprightWidth (Pixbuf, PixbufOrientation);
ZoomFit ();
+ ScrollTo (0, 0, true);
+ prev_width = PixbufUtils.UprightWidth (Pixbuf, PixbufOrientation);
} else {
- // TODO: Recalculate the adjustments and offsets such that the
- // view on the image is maintained.
-
- // Recalculate the zoom based on the new image size.
+ // Recalculate the zoom and offset based on the new image size.
double ratio = (double) PixbufUtils.UprightWidth (Pixbuf, PixbufOrientation) /
(double) prev_width;
+
+ int new_x = XOffset;
+ int new_y = YOffset;
Zoom /= ratio;
+ ScrollTo (new_x, new_y, true);
prev_width = PixbufUtils.UprightWidth (Pixbuf, PixbufOrientation);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]