Fixed #24243.

The problem was that the canvas was ajusting its position using the
segment, but the segment starts from the first staff.
Fix: find the first element in the selection and set the canvas
     position there