Interesting, The tempo markings themselves receive no space, but I guess the fact that this requires creating a bunch of segments for them does enforce some minimum amount of space. Probably there could be an optimization when calculating the segment distances to allow it to be 0 and not minimum note distance or whatever it is currently, if there are no visible elements at all. As I recall we (I) did add check for segments with no elements in order to not be thrown off by segments who only elements are on invisible staves. See https://github.com/musescore/MuseScore/pull/4769. I suspect just skipping invisible annotations in the loop Segment::createShape() might do the job, at least it's definitely a start. The key I think is to prevent the segment from being marked visible in this case.
Comments
Interesting, The tempo markings themselves receive no space, but I guess the fact that this requires creating a bunch of segments for them does enforce some minimum amount of space. Probably there could be an optimization when calculating the segment distances to allow it to be 0 and not minimum note distance or whatever it is currently, if there are no visible elements at all. As I recall we (I) did add check for segments with no elements in order to not be thrown off by segments who only elements are on invisible staves. See https://github.com/musescore/MuseScore/pull/4769. I suspect just skipping invisible annotations in the loop Segment::createShape() might do the job, at least it's definitely a start. The key I think is to prevent the segment from being marked visible in this case.