- if (Grob *staff = Staff_symbol_referencer::get_staff_symbol(me))
- {
- std::vector<Real> linepos = Staff_symbol::line_positions (staff);
- std::sort(linepos.begin(), linepos.end());
- std::vector<Real>::const_iterator it
- = std::lower_bound(linepos.begin(), linepos.end(), pos);
- if (it != linepos.end())
- {
- pos = (int)ceil(*it);
- }
- }
-
- amount = ss * 0.5 * pos;
+
+ std::vector<Real>::const_iterator it
+ = std::upper_bound (linepos.begin (), linepos.end (), pos);
+ if (it != linepos.end ())
+ pos = *it;
+ else
+ pos = linepos.back ();
+ }
+ else
+ {
+ std::vector<Real>::const_iterator it
+ = std::upper_bound (linepos.begin (), linepos.end (), pos);
+ if (it != linepos.begin ())
+ --it;
+ pos = *it;