Top half of element is cut in the miniature cursor when being dragged

• Jun 1, 2019 - 00:54
Reported version
Graphical (UI)
S4 - Minor

When clicking on elements in the Palettes, the cursor becomes a miniature preview of the element we are dragging into a score. Unfortunately, many of those seems to be visually broken, the upper half of many of these elements is cut. In the attached image, you will see how the cursor looks like for a crescendo hairpin and for the 22a. line. This happens to many other miniature cursors too.



I'm looking into this now. The issue has to do with how these lines elements are vertically-centered when laid out. After the e->layout() call in

>    MuseScore3.exe!Ms::Palette::pixmap(int paletteIdx) Line 1180    C++
    MuseScore3.exe!Ms::Palette::mouseMoveEvent(QMouseEvent * ev) Line 394   C++

the boundary box for the mf< looks like:

        xp  -1.6250000000000000 double
        yp  -31.625000000000000 double
        w   179.87500000000000  double
        h   64.875000000000000  double

Which is has y center of 0. Seems that Y center should be 31.625 instead....

Title Top half of element is cut in the miniature cursor when beign dragged Top half of element is cut in the miniature cursor when being dragged

Typo in issue title.

Status PR created fixed

Fixed in branch master, commit 1a79a67cb0

_fix #290058 translate palette drag painter coords

If the default layout of a palette element resulted in a boundary box with negative x & y coordinates for the top-left corner, the changed line of this commit would attempt to ensure that the entire element's pixelmap would be rendered in positive coordinate space only by offseting its position according to the top-left corner coordinates. Unfortunately, that code don't seem to work, since vertically-centered elements like hairpins (which have a negative y coordinate for the top of its boundary box) only displayed the elements bottom-half when dragged from palette.

This fix uses alternate code which I think more properly does what that line intended to do, using Qt's QPainter translate function instead of e->setPos() to compensate for layout's adjustment of the element's position._

Fix version