[longomatch] Draw position object lines and make size relative to the background



commit 98ebffe15e60c70acab53bac6e6ef75c94de3baf
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Thu Jun 19 12:47:59 2014 +0200

    Draw position object lines and make size relative to the background

 LongoMatch.Drawing/CanvasObject/PositionObject.cs |   19 ++++++++++++++-----
 LongoMatch.Drawing/Common.cs                      |    1 +
 2 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/LongoMatch.Drawing/CanvasObject/PositionObject.cs 
b/LongoMatch.Drawing/CanvasObject/PositionObject.cs
index d068325..a5dfdc7 100644
--- a/LongoMatch.Drawing/CanvasObject/PositionObject.cs
+++ b/LongoMatch.Drawing/CanvasObject/PositionObject.cs
@@ -100,7 +100,10 @@ namespace LongoMatch.Drawing.CanvasObject
                }
                
                public override void Draw (IDrawingToolkit tk, Area area) {
-                       Color color;
+                       Color color, scolor;
+                       double relSize;
+                       
+                        relSize = Math.Max (1, (double) Width / 200);
                        
                        tk.Begin ();
                        if (Play != null) {
@@ -108,12 +111,18 @@ namespace LongoMatch.Drawing.CanvasObject
                        } else {
                                color = Common.TAGGER_POINT_COLOR;
                        }
-                       tk.FillColor = color;
-                       tk.StrokeColor = color;
-                       tk.LineWidth = 2;
+                       scolor = color;
                        
-                       tk.DrawCircle (Start, Common.TAGGER_POINT_SIZE);
+                       if (Selected) {
+                               scolor = Common.TAGGER_SELECTION_COLOR;
+                               color = Common.TAGGER_SELECTION_COLOR;
+                       }
+                       tk.FillColor = color;
+                       tk.StrokeColor = scolor;
+                       tk.LineWidth = (int) relSize;
+                       tk.DrawCircle (Start, (int) relSize * 2);
                        if (Points.Count == 2) {
+                               tk.LineWidth = (int) relSize * 2;
                                tk.DrawLine (Start, Stop);
                        }
                        tk.End ();
diff --git a/LongoMatch.Drawing/Common.cs b/LongoMatch.Drawing/Common.cs
index e54956a..bf38e7e 100644
--- a/LongoMatch.Drawing/Common.cs
+++ b/LongoMatch.Drawing/Common.cs
@@ -32,6 +32,7 @@ namespace LongoMatch.Drawing
                public const int TAGGER_POINT_SIZE = 5;
                public const int TAGGER_LINE_WIDTH = 3;
                public static Color TAGGER_POINT_COLOR = Color.Blue1;
+               public static Color TAGGER_SELECTION_COLOR = Color.Grey1;
 
                public const double TIMELINE_ACCURACY = 5;
                public static Color TEXT_COLOR = Color.Black;


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