Fixed minor bug getting the extent of the last unit
authorJohn Darrington <john@darrington.wattle.id.au>
Tue, 25 Nov 2008 01:14:27 +0000 (10:14 +0900)
committerJohn Darrington <john@darrington.wattle.id.au>
Tue, 25 Nov 2008 01:14:27 +0000 (10:14 +0900)
lib/gtksheet/psppire-axis.c

index 4a8de3e88508dd55ae73125eb6a31a41d121c459..7b154908b6748aab76fbbb12da88d913621ad6f5 100644 (file)
@@ -239,7 +239,11 @@ psppire_axis_get_unit_at_pixel (PsppireAxis *a, glong pixel)
   if (pixel >= tower_height (&a->tower))
     {
       glong extra = pixel - tower_height (&a->tower);
-      return  tower_count (&a->tower) + extra / a->default_size;
+
+      if ( extra > a->min_extent - tower_height (&a->tower))
+       extra = a->min_extent - tower_height (&a->tower);
+
+      return tower_count (&a->tower) - 1 + extra / a->default_size;
     }
 
   node = tower_lookup (&a->tower, pixel, &node_start);