diff --git a/modules/juce_gui_basics/mouse/juce_DragAndDropContainer.cpp b/modules/juce_gui_basics/mouse/juce_DragAndDropContainer.cpp index 77ef59434f..2202bbc6fd 100644 --- a/modules/juce_gui_basics/mouse/juce_DragAndDropContainer.cpp +++ b/modules/juce_gui_basics/mouse/juce_DragAndDropContainer.cpp @@ -44,7 +44,7 @@ public: : sourceDetails (desc, sourceComponent, Point()), 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 transformOffsetCoordinates (const Component* const sourceComponent, Point offsetInSource) const + { + return getLocalPoint (sourceComponent, offsetInSource) - getLocalPoint (sourceComponent, Point()); + } + DragAndDropTarget* findTarget (Point screenPos, Point& relativePos, Component*& resultComponent) const {