[longomatch] Redraw seleted objects last



commit 0987383e622ccfe606ef3f6a2a6f650ae7afc224
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Mon Aug 4 13:10:37 2014 +0200

    Redraw seleted objects last

 LongoMatch.Drawing/Canvas.cs |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/LongoMatch.Drawing/Canvas.cs b/LongoMatch.Drawing/Canvas.cs
index 75bdab4..bf782dd 100644
--- a/LongoMatch.Drawing/Canvas.cs
+++ b/LongoMatch.Drawing/Canvas.cs
@@ -57,12 +57,21 @@ namespace LongoMatch.Drawing
                
                public virtual void Draw (IContext context, Area area) {
                        tk.Context = context;
-                       tk.TranslateAndScale (translation, new Point (scaleX, scaleY));
                        tk.Begin ();
-                       for (int i=Objects.Count - 1; i >= 0; i--) {
-                               ICanvasObject o = Objects[i];
-                               if (o.Visible) {
-                                       o.Draw (tk, area);
+                       tk.TranslateAndScale (translation, new Point (scaleX, scaleY));
+                       foreach (ICanvasObject co in Objects) {
+                               if (co is ICanvasSelectableObject) {
+                                       if ((co as ICanvasSelectableObject).Selected) {
+                                               continue;
+                                       }
+                               }
+                               if (co.Visible) {
+                                       co.Draw (tk, area);
+                               }
+                       }
+                       foreach (ICanvasSelectableObject co in Objects.OfType<ICanvasSelectableObject>()) {
+                               if (co.Selected && co.Visible) {
+                                       co.Draw (tk, area);
                                }
                        }
                        tk.End ();


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