From b981bdd4bc4d04ccbe2cb9504c4e4c2112d5d3b0 Mon Sep 17 00:00:00 2001 From: Yan Maniez Date: Wed, 1 May 2019 11:24:43 +0200 Subject: [PATCH] Ajustements --- AideDeJeu/AideDeJeu/Views/DicesPage.xaml | 6 ++++++ AideDeJeu/AideDeJeu/Views/DicesPage.xaml.cs | 19 ++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/AideDeJeu/AideDeJeu/Views/DicesPage.xaml b/AideDeJeu/AideDeJeu/Views/DicesPage.xaml index a82f87b9..4c91d2a1 100644 --- a/AideDeJeu/AideDeJeu/Views/DicesPage.xaml +++ b/AideDeJeu/AideDeJeu/Views/DicesPage.xaml @@ -2,13 +2,19 @@ + + + + + diff --git a/AideDeJeu/AideDeJeu/Views/DicesPage.xaml.cs b/AideDeJeu/AideDeJeu/Views/DicesPage.xaml.cs index 7cc9594e..9d666eec 100644 --- a/AideDeJeu/AideDeJeu/Views/DicesPage.xaml.cs +++ b/AideDeJeu/AideDeJeu/Views/DicesPage.xaml.cs @@ -33,14 +33,6 @@ namespace AideDeJeu.Views SKImageInfo info = args.Info; SKSurface surface = args.Surface; SKCanvas canvas = surface.Canvas; - SKPaint strokePaint = new SKPaint() - { - Color = new SKColor(0x9B, 0x1C, 0x47), - Style = SKPaintStyle.Stroke, - StrokeWidth = 1, - TextSize = 12, - }; - canvas.Clear(); float minx = diceRolls.Min(kv => kv.Value); float miny = diceRolls.Min(kv => kv.Key); @@ -48,12 +40,21 @@ namespace AideDeJeu.Views float maxy = diceRolls.Max(kv => kv.Key); float sumx = diceRolls.Sum(kv => kv.Value); float sizey = info.Height / (maxy - miny + 1); + + SKPaint strokePaint = new SKPaint() + { + Color = new SKColor(0x9B, 0x1C, 0x47), + Style = SKPaintStyle.Stroke, + StrokeWidth = 1, + TextSize = sizey * 0.8f, + }; + canvas.Clear(); foreach (var diceRoll in diceRolls) { float x = diceRoll.Value; float y = diceRoll.Key; canvas.DrawRect(new SKRect(0, ((y - miny) * sizey), x * info.Width / maxx, ((y - miny) * sizey) + sizey - 5), strokePaint); - canvas.DrawText($"{y} => {x / sumx * 100}", 10, ((y - miny) * sizey) + 15, strokePaint); + canvas.DrawText($"{y} => {x / sumx * 100:0.00}%", 10, ((y - miny) * sizey) + sizey * 0.8f, strokePaint); } } }