Browse Source

Escape cancels ui dragging

Chris Friesen 11 years ago
parent
commit
eb565b81ad
1 changed files with 8 additions and 0 deletions
  1. 8 0
      Source/Engine/UI/UI.cpp

+ 8 - 0
Source/Engine/UI/UI.cpp

@@ -1282,6 +1282,14 @@ void UI::HandleKeyDown(StringHash eventType, VariantMap& eventData)
     qualifiers_ = eventData[P_QUALIFIERS].GetInt();
     int key = eventData[P_KEY].GetInt();
 
+    // Cancel UI Dragging
+    if (key == KEY_ESC && dragElement_)
+    {
+        dragElement_.Reset();
+        dragBeginPending_ = false;
+        return;
+    }
+
     // Dismiss modal element if any when ESC key is pressed
     if (key == KEY_ESC && HasModalElement())
     {