mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Linux: Fixed a DragAndDrop issue between different containers
This commit is contained in:
parent
3638995f8b
commit
a3219c7fc6
1 changed files with 22 additions and 1 deletions
|
|
@ -243,13 +243,34 @@ private:
|
|||
return dynamic_cast<DragAndDropTarget*> (currentlyOverComp.get());
|
||||
}
|
||||
|
||||
static Component* findDesktopComponentBelow (Point<int> screenPos)
|
||||
{
|
||||
auto& desktop = Desktop::getInstance();
|
||||
|
||||
for (auto i = desktop.getNumComponents(); --i >= 0;)
|
||||
{
|
||||
auto* desktopComponent = desktop.getComponent (i);
|
||||
auto dPoint = desktopComponent->getLocalPoint (nullptr, screenPos);
|
||||
|
||||
if (auto* c = desktopComponent->getComponentAt (dPoint))
|
||||
{
|
||||
auto cPoint = c->getLocalPoint (desktopComponent, dPoint);
|
||||
|
||||
if (c->hitTest (cPoint.getX(), cPoint.getY()))
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DragAndDropTarget* findTarget (Point<int> screenPos, Point<int>& relativePos,
|
||||
Component*& resultComponent) const
|
||||
{
|
||||
auto* hit = getParentComponent();
|
||||
|
||||
if (hit == nullptr)
|
||||
hit = Desktop::getInstance().findComponentAt (screenPos);
|
||||
hit = findDesktopComponentBelow (screenPos);
|
||||
else
|
||||
hit = hit->getComponentAt (hit->getLocalPoint (nullptr, screenPos));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue