]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/beam.cc
Use distance to original point rather than size of allowed region for
[lilypond.git] / lily / beam.cc
index f39bf9f62c06e55f0914bf5e83004ad775b96bde..6845b1346be59a2eefe2b3499965057993ee1b69 100644 (file)
@@ -1303,9 +1303,10 @@ Beam::shift_region_to_valid (SCM grob, SCM posns)
            || !collision_free[UP].is_empty ())
     {
       // We have space above or below collisions (or, no collisions at
-      // all).
+      // all).  Should we factor in the size of the collision_free
+      // interval as well?
       Interval best =  
-        (collision_free[DOWN].length () > collision_free[UP].length ()) ?
+        (collision_free[DOWN].distance(beam_left_y) < collision_free[UP].distance (beam_left_y)) ?
         collision_free[DOWN] : collision_free[UP];
 
       beam_left_y = point_in_interval (best, 2.0);