From 2c022dafe608d7c075fff74f4959cdee2a21b8b7 Mon Sep 17 00:00:00 2001 From: haven1433 Date: Thu, 30 May 2024 19:37:48 -0500 Subject: [PATCH] 9-grid limit drawing range to drawing on map --- src/HexManiac.Core/ViewModels/Map/BlockMapViewModel.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/HexManiac.Core/ViewModels/Map/BlockMapViewModel.cs b/src/HexManiac.Core/ViewModels/Map/BlockMapViewModel.cs index 05a8fa2c..234e0425 100644 --- a/src/HexManiac.Core/ViewModels/Map/BlockMapViewModel.cs +++ b/src/HexManiac.Core/ViewModels/Map/BlockMapViewModel.cs @@ -982,7 +982,11 @@ namespace HavenSoft.HexManiac.Core.ViewModels.Map { } public void Draw9Grid(ModelDelta token, int[,] grid, double x, double y) { + var layout = GetLayout(); + var (width, height) = (layout.GetValue("width"), layout.GetValue("height")); var (xx, yy) = ConvertCoordinates(x, y); + xx = xx.LimitToRange(0, width - 1); + yy = yy.LimitToRange(0, height - 1); Draw9Grid(token, grid, xx, yy); }