1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

DragAndDropContainer: fix positioning when source Component is transformed

This commit is contained in:
Attila Szarvas 2021-09-27 10:05:19 +00:00
parent a7915ec47e
commit 823bfb0c32

View file

@ -44,7 +44,7 @@ public:
: sourceDetails (desc, sourceComponent, Point<int>()),
image (im), owner (ddc),
mouseDragSource (draggingSource->getComponentUnderMouse()),
imageOffset (offset),
imageOffset (transformOffsetCoordinates (sourceComponent, offset)),
originalInputSourceIndex (draggingSource->getIndex()),
originalInputSourceType (draggingSource->getType())
{
@ -263,6 +263,11 @@ private:
return nullptr;
}
Point<int> transformOffsetCoordinates (const Component* const sourceComponent, Point<int> offsetInSource) const
{
return getLocalPoint (sourceComponent, offsetInSource) - getLocalPoint (sourceComponent, Point<int>());
}
DragAndDropTarget* findTarget (Point<int> screenPos, Point<int>& relativePos,
Component*& resultComponent) const
{