[longomatch] Add a min width and height for empty dashboards



commit a1182ded4e9d0c5a5d115608a0a593ebfc064437
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Thu Oct 16 01:51:40 2014 +0200

    Add a min width and height for empty dashboards

 LongoMatch.Core/Store/Templates/Dashboard.cs |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/LongoMatch.Core/Store/Templates/Dashboard.cs b/LongoMatch.Core/Store/Templates/Dashboard.cs
index d56f9b0..77142e7 100644
--- a/LongoMatch.Core/Store/Templates/Dashboard.cs
+++ b/LongoMatch.Core/Store/Templates/Dashboard.cs
@@ -46,6 +46,8 @@ namespace LongoMatch.Core.Store.Templates
 
                const int CAT_WIDTH = 120;
                const int CAT_HEIGHT = 80;
+               const int MIN_WIDTH = 320;
+               const int MIN_HEIGHT = 240;
                
                /// <summary>
                /// Creates a new template
@@ -108,14 +110,20 @@ namespace LongoMatch.Core.Store.Templates
                [JsonIgnore]
                public int CanvasWidth {
                        get {
-                               return (int) List.Max (c => c.Position.X + c.Width);
+                               if (List.Count == 0) {
+                                       return MIN_WIDTH;
+                               }
+                               return Math.Max (MIN_WIDTH, (int) List.Max (c => c.Position.X + c.Width));
                        }
                }
                
                [JsonIgnore]
                public int CanvasHeight {
                        get {
-                               return (int) List.Max (c => c.Position.Y + c.Height);
+                               if (List.Count == 0) {
+                                       return MIN_HEIGHT;
+                               }
+                               return Math.Max (MIN_WIDTH, (int) List.Max (c => c.Position.Y + c.Height));
                        }
                }
                


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