[longomatch] Always try first with the selected element



commit 60df812f92005c638b836c25cffa376b255a0e9f
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Thu Jun 19 12:45:32 2014 +0200

    Always try first with the selected element

 LongoMatch.Drawing/Canvas.cs |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/LongoMatch.Drawing/Canvas.cs b/LongoMatch.Drawing/Canvas.cs
index 8c91b1f..7c85f09 100644
--- a/LongoMatch.Drawing/Canvas.cs
+++ b/LongoMatch.Drawing/Canvas.cs
@@ -144,11 +144,18 @@ namespace LongoMatch.Drawing
                void HandleLeftButton (Point coords, ButtonModifier modif) {
                        Selection sel = null;
 
-                       foreach (object o in Objects) {
-                               ICanvasSelectableObject co = o as ICanvasSelectableObject;
-                               sel = co.GetSelection (coords, Accuracy);
-                               if (sel != null) {
-                                       break;
+                       /* Try with the selected item first */
+                       if (Selections.Count > 0) {
+                               sel = Selections.LastOrDefault().Drawable.GetSelection (coords, Accuracy);
+                       }
+                       
+                       if (sel == null) {
+                               foreach (object o in Objects) {
+                                       ICanvasSelectableObject co = o as ICanvasSelectableObject;
+                                       sel = co.GetSelection (coords, Accuracy);
+                                       if (sel != null) {
+                                               break;
+                                       }
                                }
                        }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]