What is the correct scale to use with createComponentSnapshot() for creating an image for startDragging?

If I use getApproximateScaleFactorForComponent then my drag image shrinks a bit and is smaller the source component.

If I use getGlobalScaleFactor() then the drag image is blurry. If I use 1 than the drag image is blurry.

The text on the left is normal, the text on the right is being dragged. Why is it far blurrier?

image

Because it doesn’t take the DPI scaling into account, so the bitmap is actually smaller than the physical resolution.

Creating a higher-res image doesn’t help, as the DragAndDrop classes in JUCE have no concept of DPI, so a larger bitmap is a larger object that gets dragged around.

1 Like

Draggable TableListBox rows also suffer this annoying “feature”. I hacked JUCE once to overcome it, but my solution was too much of a hack and far too many changes to consider maintaining it going forward.