Browse code

Fix unit mismatch in comparison.

distance was in device units, visible was in pixels, the if condition made
no sense. Also, I've essentially replaced the nonfunctional if with a
working min(), so remove the now-redundant check anyway.

From: Marius Gedminas <marius@gedmin.as>

Jose.R.Fonseca authored on 13/07/2008 03:21:02
Showing 1 changed files

  • xdot.py index 17a2454..f3988d9 100755
... ...
@@ -676,10 +676,10 @@ class ZoomToAnimation(MoveToAnimation):
676 676
         distance = math.hypot(self.source_x - self.target_x,
677 677
                               self.source_y - self.target_y)
678 678
         rect = self.dot_widget.get_allocation()
679
-        visible = min(rect.width, rect.height) * .9
680
-        if distance > visible:
681
-            desired_middle_zoom = visible / distance
682
-            self.extra_zoom = min(0, 4 * (desired_middle_zoom - middle_zoom))
679
+        visible = min(rect.width, rect.height) * self.dot_widget.zoom_ratio
680
+        visible *= 0.9
681
+        desired_middle_zoom = visible / distance
682
+        self.extra_zoom = min(0, 4 * (desired_middle_zoom - middle_zoom))
683 683
 
684 684
     def animate(self, t):
685 685
         a, b, c = self.source_zoom, self.extra_zoom, self.target_zoom