瀏覽代碼

removed handlingDragAndDrop_ variable, get drag object directly

rsredsq 10 年之前
父節點
當前提交
7264e3976e
共有 2 個文件被更改,包括 3 次插入9 次删除
  1. 3 7
      Source/Atomic/UI/UISelectList.cpp
  2. 0 2
      Source/Atomic/UI/UISelectList.h

+ 3 - 7
Source/Atomic/UI/UISelectList.cpp

@@ -227,11 +227,6 @@ void UISelectList::HandleUIUpdate(StringHash eventType, VariantMap& eventData)
                 select->GetScrollContainer()->ScrollBy(0, speed);
 
         }
-        handlingDragAndDrop_ = true;
-    }
-    else
-    {
-        handlingDragAndDrop_ = false;
     }
 
 }
@@ -244,8 +239,10 @@ bool UISelectList::OnEvent(const tb::TBWidgetEvent &ev)
     }
     if (ev.type == EVENT_TYPE_POINTER_MOVE)
     {
+        UIDragDrop* dragDrop = GetSubsystem<UIDragDrop>();
+
         //if we handle drag and drop then return true, to avoid panning scroll widget by turbobadger, let the widget control scroll by itself
-        if (handlingDragAndDrop_)
+        if (dragDrop->GetDraggingObject())
             return true;
     }
     return UIWidget::OnEvent(ev);
@@ -276,5 +273,4 @@ void UISelectList::SetUIListView(bool value)
 
 }
 
-
 }

+ 0 - 2
Source/Atomic/UI/UISelectList.h

@@ -77,8 +77,6 @@ protected:
     virtual bool OnEvent(const tb::TBWidgetEvent &ev);
 
 private:
-    //Returns true if we have drag and drop element on select list widget
-    bool handlingDragAndDrop_;
 };