From 53921a37b8c0a2197ea1797e6861756c67bbe005 Mon Sep 17 00:00:00 2001 From: Mingbo Peng Date: Fri, 5 Apr 2024 01:40:24 -0400 Subject: [PATCH] fix(Legend): support Embed bool --- .../ManualAdded/Model/LegendParameters.cs | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/LadybugDisplaySchema/ManualAdded/Model/LegendParameters.cs b/src/LadybugDisplaySchema/ManualAdded/Model/LegendParameters.cs index 9dbbe60..ba8e7d0 100644 --- a/src/LadybugDisplaySchema/ManualAdded/Model/LegendParameters.cs +++ b/src/LadybugDisplaySchema/ManualAdded/Model/LegendParameters.cs @@ -165,6 +165,33 @@ private Legend3DParameters init3DDefault() //public System.Drawing.Rectangle GetBoundary => new System.Drawing.Rectangle(this.X, this.Y, this.Width, this.Height); + public LegendParameters SetEmbed(bool ifEmbed) + { + var dic = this.GetUserData(); + + if (ifEmbed) + dic.TryAddUpdate("_embed", ifEmbed); + else if (dic.ContainsKey("_embed")) + { + dic.Remove("_embed"); + } + this.UserData = dic; + return this; + } + public bool IsEmbedded() + { + var dic = this.GetUserData(); + if (dic.TryGetValue("_embed", out var cached) ) + { + if (cached is bool ifCached) return ifCached; + else if (cached?.ToString()?.ToLower() == "true") + return true; + + } + + return false; + } + public LegendParameters SetNoneColor(Color color) { return this.AddUserData("_noneColor", color);