Browse Source

Merge pull request #522 from AtomicGameEngine/JME-ATOMIC-REVERTUIPOINTER

Jme atomic revertuipointer
JoshEngebretson 10 years ago
parent
commit
a50f0954bc

+ 1 - 0
Source/Atomic/UI/UIListView.cpp

@@ -252,6 +252,7 @@ ListViewItemWidget::ListViewItemWidget(ListViewItem *item, ListViewItemSource *s
     SetLayoutDistribution(LAYOUT_DISTRIBUTION_GRAVITY);
     SetLayoutDistribution(LAYOUT_DISTRIBUTION_GRAVITY);
     SetLayoutDistributionPosition(LAYOUT_DISTRIBUTION_POSITION_LEFT_TOP);
     SetLayoutDistributionPosition(LAYOUT_DISTRIBUTION_POSITION_LEFT_TOP);
     SetPaintOverflowFadeout(false);
     SetPaintOverflowFadeout(false);
+    SetCapturing(false);
 
 
     item_->widget_ = this;
     item_->widget_ = this;
 
 

+ 2 - 8
Source/Atomic/UI/UISelectList.cpp

@@ -227,6 +227,7 @@ void UISelectList::HandleUIUpdate(StringHash eventType, VariantMap& eventData)
                 select->GetScrollContainer()->ScrollBy(0, speed);
                 select->GetScrollContainer()->ScrollBy(0, speed);
 
 
         }
         }
+
     }
     }
 
 
 }
 }
@@ -237,14 +238,6 @@ bool UISelectList::OnEvent(const tb::TBWidgetEvent &ev)
     {
     {
         GetTBSelectList()->SetFocus(WIDGET_FOCUS_REASON_POINTER);
         GetTBSelectList()->SetFocus(WIDGET_FOCUS_REASON_POINTER);
     }
     }
-    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 (dragDrop->GetDraggingObject())
-            return true;
-    }
     return UIWidget::OnEvent(ev);
     return UIWidget::OnEvent(ev);
 }
 }
 
 
@@ -273,4 +266,5 @@ void UISelectList::SetUIListView(bool value)
 
 
 }
 }
 
 
+
 }
 }

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

@@ -77,6 +77,7 @@ protected:
     virtual bool OnEvent(const tb::TBWidgetEvent &ev);
     virtual bool OnEvent(const tb::TBWidgetEvent &ev);
 
 
 private:
 private:
+
 };
 };
 
 
 
 

+ 4 - 0
Source/AtomicEditor/Editors/ResourceEditor.cpp

@@ -61,6 +61,10 @@ public:
 
 
     bool OnEvent(const TBWidgetEvent &ev)
     bool OnEvent(const TBWidgetEvent &ev)
     {
     {
+        // Don't process pointer down, we only respond to click events
+        if (ev.type == EVENT_TYPE_POINTER_DOWN)
+            return true;
+
         if (ev.type == EVENT_TYPE_CLICK)
         if (ev.type == EVENT_TYPE_CLICK)
         {
         {
             if (ev.target->GetID() == TBIDC("unsaved_modifications_dialog"))
             if (ev.target->GetID() == TBIDC("unsaved_modifications_dialog"))

+ 21 - 32
Source/ThirdParty/TurboBadger/tb_widgets.cpp

@@ -1353,45 +1353,33 @@ void TBWidget::InvokePointerDown(int x, int y, int click_count, MODIFIER_KEYS mo
 
 
 void TBWidget::InvokePointerUp(int x, int y, MODIFIER_KEYS modifierkeys, bool touch, int touchId)
 void TBWidget::InvokePointerUp(int x, int y, MODIFIER_KEYS modifierkeys, bool touch, int touchId)
 {
 {
-    //save the old coordinates, because it will be changed due to convertion it from root
-    int ox = x;
-    int oy = y;
-    //old_capture to keep pointer on captured_widget if it was released
-    TBWidget *old_capture = nullptr;
-    //First check for the captured widget
-    if (captured_widget && captured_widget->touchId_ == touchId)
-    {
-        captured_widget->ConvertFromRoot(x, y);
-        TBWidgetEvent ev_up(EVENT_TYPE_POINTER_UP, x, y, touch, modifierkeys);
-        TBWidgetEvent ev_click(EVENT_TYPE_CLICK, x, y, touch, modifierkeys);
-        captured_widget->InvokeEvent(ev_up);
-        if (!cancel_click && captured_widget->GetHitStatus(x, y))
-        {
-            captured_widget->InvokeEvent(ev_click);
-        }
-        old_capture = captured_widget;
-        captured_widget->ReleaseCapture();
-    }
-    //restore coordinates
-    x = ox;
-    y = oy;
     TBWidget* down_widget = GetWidgetAt(x, y, true);
     TBWidget* down_widget = GetWidgetAt(x, y, true);
-    //then if we have any down widgets, then make sure that it's not captured_widget otherwise events will be sent twice
-    if (down_widget && down_widget->touchId_ == touchId && old_capture != down_widget)
-    {
-        down_widget->ConvertFromRoot(x, y);
+	if ((down_widget && down_widget->touchId_ == touchId) || captured_widget)
+	{
         TBWidgetEvent ev_up(EVENT_TYPE_POINTER_UP, x, y, touch, modifierkeys);
         TBWidgetEvent ev_up(EVENT_TYPE_POINTER_UP, x, y, touch, modifierkeys);
         TBWidgetEvent ev_click(EVENT_TYPE_CLICK, x, y, touch, modifierkeys);
         TBWidgetEvent ev_click(EVENT_TYPE_CLICK, x, y, touch, modifierkeys);
-        down_widget->InvokeEvent(ev_up);
-        if (!cancel_click && down_widget->GetHitStatus(x, y))
-        {
-            down_widget->InvokeEvent(ev_click);
-        }
         down_widget->Invalidate();
         down_widget->Invalidate();
         down_widget->InvalidateSkinStates();
         down_widget->InvalidateSkinStates();
         down_widget->OnCaptureChanged(false);
         down_widget->OnCaptureChanged(false);
-    }
+		down_widget->ConvertFromRoot(x, y);
+		down_widget->InvokeEvent(ev_up);
+        if (!cancel_click && down_widget->GetHitStatus(x, y))
+        {
+			down_widget->InvokeEvent(ev_click);
+        }
+        if (captured_widget)
+        {
+            captured_widget->ConvertFromRoot(x, y);
+            if (!cancel_click && captured_widget->GetHitStatus(x, y))
+            {
+                captured_widget->InvokeEvent(ev_click);
+            }
+            captured_widget->InvokeEvent(ev_up);
+            captured_widget->ReleaseCapture();
+        }
+	}
 }
 }
+
 void TBWidget::InvokeRightPointerDown(int x, int y, int click_count, MODIFIER_KEYS modifierkeys)
 void TBWidget::InvokeRightPointerDown(int x, int y, int click_count, MODIFIER_KEYS modifierkeys)
 {
 {
     // note we're not capturing the widget as with normal pointer down
     // note we're not capturing the widget as with normal pointer down
@@ -1419,6 +1407,7 @@ void TBWidget::InvokeRightPointerUp(int x, int y, MODIFIER_KEYS modifierkeys)
 
 
 }
 }
 
 
+
 void TBWidget::MaybeInvokeLongClickOrContextMenu(bool touch)
 void TBWidget::MaybeInvokeLongClickOrContextMenu(bool touch)
 {
 {
 	StopLongClickTimer();
 	StopLongClickTimer();