1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-19 01:04:20 +00:00

DragAndDropContainer: Fix the escape key dismissing the drag operation

This commit is contained in:
attila 2022-05-28 22:03:21 +02:00
parent edf68d209c
commit 032cc528c8

View file

@ -59,6 +59,7 @@ public:
startTimer (200);
setInterceptsMouseClicks (false, false);
setWantsKeyboardFocus (true);
setAlwaysOnTop (true);
}
@ -200,7 +201,12 @@ public:
{
if (key == KeyPress::escapeKey)
{
dismissWithAnimation (true);
const auto wasVisible = isVisible();
setVisible (false);
if (wasVisible)
dismissWithAnimation (true);
deleteSelf();
return true;
}
@ -466,8 +472,7 @@ void DragAndDropContainer::startDragging (const var& sourceDescription,
dragImageComponent->setOpaque (true);
dragImageComponent->addToDesktop (ComponentPeer::windowIgnoresMouseClicks
| ComponentPeer::windowIsTemporary
| ComponentPeer::windowIgnoresKeyPresses);
| ComponentPeer::windowIsTemporary);
}
else
{
@ -484,6 +489,7 @@ void DragAndDropContainer::startDragging (const var& sourceDescription,
dragImageComponent->sourceDetails.localPosition = sourceComponent->getLocalPoint (nullptr, lastMouseDown);
dragImageComponent->updateLocation (false, lastMouseDown);
dragImageComponent->grabKeyboardFocus();
#if JUCE_WINDOWS
// Under heavy load, the layered window's paint callback can often be lost by the OS,