X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fstaff-symbol-referencer.cc;h=3b8aa6ba187698bb8ea6a92f1580c3069c9f787e;hb=90cbea4bb9a398033b6ede5e6175d53546ace20c;hp=74c2c448c61c2407bb14778050b62c354f91b3ab;hpb=1c24c56886cd85f04283ac61e8a0deea172035ed;p=lilypond.git diff --git a/lily/staff-symbol-referencer.cc b/lily/staff-symbol-referencer.cc index 74c2c448c6..3b8aa6ba18 100644 --- a/lily/staff-symbol-referencer.cc +++ b/lily/staff-symbol-referencer.cc @@ -41,7 +41,8 @@ Staff_symbol_referencer::on_line (Grob *me, int pos) bool Staff_symbol_referencer::on_staff_line (Grob *me, int pos) { - return on_line (me, pos) && abs (pos) <= 2 * staff_radius (me); + Grob *st = get_staff_symbol (me); + return st ? Staff_symbol::on_line (st, pos, false) : false; } Grob * @@ -188,11 +189,23 @@ Staff_symbol_referencer::internal_set_position (Grob *me, Real p, bool pure) me->translate_axis ((p - oldpos) * ss * 0.5, Y_AXIS); } -/* Half of the height, in staff space, i.e. 2.0 for a normal staff. */ +Interval +Staff_symbol_referencer::staff_span (Grob *me) +{ + Interval result; + if (me) + if (Grob *symb = get_staff_symbol (me)) + result = Staff_symbol::line_span (symb); + return result; +} + Real Staff_symbol_referencer::staff_radius (Grob *me) { - return (line_count (me) - 1) / 2.0; + /* + line_span is measured in pitch steps, not in staff spaces + */ + return staff_span (me).length () / 4.0; } int