]> O.S.I.I.S - jp/crow.git/commitdiff
Check top Objects first if current hover widget not descendant of
authorjpbruyere <jp.bruyere@hotmail.com>
Tue, 15 Sep 2015 16:22:18 +0000 (18:22 +0200)
committerjpbruyere <jp.bruyere@hotmail.com>
Tue, 15 Sep 2015 16:22:18 +0000 (18:22 +0200)
topmost GraphicObject in topContainer.GraphicObjects

src/OpenTKGameWindow.cs

index a50a05be51eb6eef4c13cedaec8d513fde924251..bc1ebda931d314c38e21d6c69ab16643de73e2e6 100755 (executable)
@@ -411,6 +411,27 @@ namespace go
                        }\r
 \r
                        if (_hoverWidget != null) {\r
+                               //check topmost graphicobject first\r
+                               GraphicObject tmp = _hoverWidget;\r
+                               GraphicObject topc = null;\r
+                               while (tmp is GraphicObject) {\r
+                                       topc = tmp;\r
+                                       tmp = tmp.Parent as GraphicObject;\r
+                               }\r
+                               int idxhw = GraphicObjects.IndexOf (topc);\r
+                               if (idxhw != 0) {\r
+                                       int i = 0;\r
+                                       while (i < idxhw) {\r
+                                               if (GraphicObjects [i].MouseIsIn (e.Position)) {\r
+                                                       _hoverWidget.onMouseLeave (this, e);\r
+                                                       GraphicObjects [i].checkHoverWidget (e);\r
+                                                       return;\r
+                                               }\r
+                                               i++;\r
+                                       }\r
+                               }\r
+                                       \r
+                                       \r
                                if (_hoverWidget.MouseIsIn (e.Position)) {\r
                                        _hoverWidget.checkHoverWidget (e);\r
                                        return;\r