Real y = dir * max (0.0,
-dir * restdim[-dir] + dir * notedim[dir] + minimum_dist);
+ int stafflines = Staff_symbol_referencer::line_count (me);
+ if (!stafflines)
+ {
+ programming_error ("no staff line count");
+ stafflines = 5;
+ }
+
// move discretely by half spaces.
int discrete_y = dir * int (ceil (y / (0.5 * dir * staff_space)));
- Interval staff_span = Staff_symbol_referencer::staff_span (rest);
- staff_span.widen (1);
// move by whole spaces inside the staff.
- if (staff_span.contains
- (Staff_symbol_referencer::get_position (rest) + discrete_y))
+ if (fabs (Staff_symbol_referencer::get_position (rest)
+ + discrete_y) < stafflines + 1)
{
discrete_y = dir * int (ceil (dir * discrete_y / 2.0) * 2.0);
}