Browse Source

DragAndDropContainer: fix positioning when source Component is transformed

v6.1.6
Attila Szarvas 4 years ago
parent
commit
823bfb0c32
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      modules/juce_gui_basics/mouse/juce_DragAndDropContainer.cpp

+ 6
- 1
modules/juce_gui_basics/mouse/juce_DragAndDropContainer.cpp 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
{


Loading…
Cancel
Save