[longomatch] Only call StopMove if we moved an object



commit a36245d21becf9bf1522327d2df8f71644a4ad3d
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Mon Oct 13 14:43:59 2014 +0200

    Only call StopMove if we moved an object

 LongoMatch.Drawing/Canvas.cs |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/LongoMatch.Drawing/Canvas.cs b/LongoMatch.Drawing/Canvas.cs
index 5c5a1e8..3591055 100644
--- a/LongoMatch.Drawing/Canvas.cs
+++ b/LongoMatch.Drawing/Canvas.cs
@@ -142,7 +142,7 @@ namespace LongoMatch.Drawing
 
        public class SelectionCanvas: Canvas
        {
-               protected bool moving;
+               protected bool moving, moved;
                protected Point start;
                uint lastTime;
                Selection clickedSel;
@@ -374,6 +374,7 @@ namespace LongoMatch.Drawing
                                widget.ReDraw (sel.Drawable);
                                SelectionMoved (sel);
                                start = coords;
+                               moved = true;
                        } else {
                                CursorMoved (coords);
                                start = coords;
@@ -383,12 +384,14 @@ namespace LongoMatch.Drawing
                void HandleButtonReleasedEvent (Point coords, ButtonType type, ButtonModifier modifier)
                {
                        moving = false;
-                       
                        if (clickedSel != null) {
                                (clickedSel.Drawable as ICanvasSelectableObject).ClickReleased ();
                                clickedSel = null;
                        }
-                       StopMove ();
+                       if (moved) {
+                               StopMove ();
+                               moved = false;
+                       }
                }
 
                void HandleButtonPressEvent (Point coords, uint time, ButtonType type, ButtonModifier 
modifier)


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