]> git.donarmstrong.com Git - lilypond.git/commitdiff
outside-staff-padding: just one pad; issue 2910
authorKeith OHara <k-ohara5a5a@oco.net>
Thu, 13 Jun 2013 07:27:25 +0000 (00:27 -0700)
committerKeith OHara <k-ohara5a5a@oco.net>
Wed, 26 Jun 2013 02:06:18 +0000 (19:06 -0700)
The 'outside-staff-padding of the object being placed on the outside is
left between it and any objects closer to the staff.

lily/axis-group-interface.cc
scm/define-grobs.scm

index 0d786c3a2959aa201470f761c27ee3cd6a98645d..9389236d1feb6b366a1b2cba7e42088555e9004b 100644 (file)
@@ -672,15 +672,17 @@ avoid_outside_staff_collisions (Grob *elt,
   for (vsize j = 0; j < other_v_skylines.size (); j++)
     {
       Skyline_pair const &v_other = other_v_skylines[j];
-      Real pad = (padding + other_padding[j]);
       Real horizon_pad = (horizon_padding + other_horizon_padding[j]);
 
-      // We need to push elt up by at least this much to be above v_other.
-      Real up = (*v_skyline)[DOWN].distance (v_other[UP], horizon_pad) + pad;
-      // We need to push elt down by at least this much to be below v_other.
-      Real down = (*v_skyline)[UP].distance (v_other[DOWN], horizon_pad) + pad;
+      Interval collision;
+      // We need to push elt by at least this much to be outside v_other.
+      collision[dir] = ((*v_skyline)[-dir].distance (v_other[dir], horizon_pad)
+                        + padding) * dir;
+      // We need to pull elt by at least this much to be inside v_other.
+      collision[-dir] = ((*v_skyline)[dir].distance (v_other[-dir], horizon_pad)
+                         + other_padding[j]) * -dir;
 
-      forbidden_intervals.push_back (Interval (-down, up));
+      forbidden_intervals.push_back (collision);
     }
 
   Interval_set allowed_shifts
@@ -762,7 +764,8 @@ add_grobs_of_one_priority (Grob *me,
         {
           Grob *elt = elements[i];
           Real padding
-            = robust_scm2double (elt->get_property ("outside-staff-padding"), 0.25);
+            = robust_scm2double (elt->get_property ("outside-staff-padding"),
+                                 Axis_group_interface::get_default_outside_staff_padding ());
           Real horizon_padding
             = robust_scm2double (elt->get_property ("outside-staff-horizontal-padding"), 0.0);
           Interval x_extent = elt->extent (x_common, X_AXIS);
index ee71f903c71ff164acb85566e84b5512398c7bff..04f20c17ec4be1505c4ebd29df5a12e4fb2081bb 100644 (file)
         (direction . ,DOWN)
         (minimum-space . 1.2)
         (outside-staff-priority . 250)
-        (outside-staff-padding . 0.6)
         (padding . 0.6)
         (side-axis . ,Y)
         (slur-padding . 0.3)
         (font-encoding . fetaText)
         (font-size . -2)
         (outside-staff-horizontal-padding . 0.5)
-        (outside-staff-padding . 0.5)
         (outside-staff-priority . 750)
         (self-alignment-X . ,CENTER)
         (side-axis . ,Y)