getHorizontalOffset method

double getHorizontalOffset(
  1. double staffSpace
)

Get horizontal offset for this voice

Voice 2 is typically offset to avoid collision with voice 1

Implementation

double getHorizontalOffset(double staffSpace) {
  if (horizontalOffset != null) {
    return horizontalOffset! * staffSpace;
  }

  switch (number) {
    case 1:
      return 0.0; // No offset for voice 1
    case 2:
      return staffSpace * 0.6; // Offset right for voice 2
    default:
      return staffSpace * 0.6 * (number - 1); // Incremental offset
  }
}