|
|
|
@@ -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));
|
|
|
|
|
|
|
|
|