Dropping "Image" on note attaches it to segment instead.

• Jan 27, 2019 - 15:35
Reported version
Ergonomical (UX)
S3 - Major
  1. write a note that lays inside the staff (eg. f4 to e5 for treble clef)
  2. drag an "image" from a palette and drop it on the note head (only reproducible with an "image" tag in the palette: use the attached palette as an example).
  3. the note head is highlighted (blue), which visually indicates that dropping the element will attach it to the note.

Result: the image is attached to the note's segment instead (clearly shown by the dashed line that appears when dragging the image). Moving the note does not move the image; removing the note does not remove the image.

Expected: the image is attached to the note (head). This is what happens when the note head lays outside the staff (e.g. c4 in treble clef) and is perceived as the correct behavior.

(side note: when typesetting 1900s/contemporary music with extended techniques, one often needs to draw his own symbols as svg images. Attaching them to notes is required for articulation symbols etc. That motivates keeping this existing feature polished and reliable).
(other note: in musescore 2, the expected results is sometimes (randomly?) obtained)

Attachment Size
test_palette_2.mpal 4.65 KB


This is caused by the fact that STAFF_LINES elements have selectable() == false; "MuseScoreView::elementsAt" sorts the elements at the mouse position using "elementLower" in mscoreview.cpp, which establishes that any unselectable element is in front of anything it is compared to. I think this behavior is not a bug since it mirrors the behavior of scoreview.cpp/elementLower, but it isn't clear to me why it is so.

Note that, in this case, comparing the z() value would yield the correct behavior.

I am willing to submit a pull request upon receiving guidance by a developer.

Regression No Yes

I can reproduce with external images as well. dragging an image to a note out side sfaff and to one inside, then change their pitch or delete them. outside staff the images will follow the pitch or vanish when removed, on notes inside staff the image will stay where it is regardless of pitch or deletion.

In 2.x it always follows the pitch (and deletion)

Fix version