From 05f4e2ae83082a57499f52f53e18950296c77140 Mon Sep 17 00:00:00 2001 From: Mike Chambers Date: Tue, 30 Apr 2024 10:36:02 +0100 Subject: [PATCH] Update LegacyMapConfig.cs to allow string or int zoom value --- .../Models/Legacy/LegacyMapConfig.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Our.Umbraco.GMaps.Core/Models/Legacy/LegacyMapConfig.cs b/Our.Umbraco.GMaps.Core/Models/Legacy/LegacyMapConfig.cs index 4fb2c53..172c2fb 100644 --- a/Our.Umbraco.GMaps.Core/Models/Legacy/LegacyMapConfig.cs +++ b/Our.Umbraco.GMaps.Core/Models/Legacy/LegacyMapConfig.cs @@ -9,8 +9,20 @@ internal class LegacyMapConfig : MapConfig [JsonPropertyName("mapcenter")] public string MapCenter { get; set; } + [Newtonsoft.Json.JsonIgnore] + [System.Text.Json.Serialization.JsonIgnore] + public new string Zoom { get; set; } + [JsonProperty("zoom")] [JsonPropertyName("zoom")] - public new string Zoom { get; set; } + public object _value + { + get + { + if (int.TryParse(Zoom, out var intValue)) return intValue; + return this.Zoom; + } + set { this.Zoom = value.ToString(); } + } } }