diff --git a/EnvelopeGenerator.Web/Models/Annotation/AnnotationParams.cs b/EnvelopeGenerator.Web/Models/Annotation/AnnotationParams.cs index 96a3e7f9..785d7046 100644 --- a/EnvelopeGenerator.Web/Models/Annotation/AnnotationParams.cs +++ b/EnvelopeGenerator.Web/Models/Annotation/AnnotationParams.cs @@ -6,11 +6,12 @@ public class AnnotationParams { public AnnotationParams() { - _AnnotationJSObjectInitor = new(() => _annots.ToDictionary(a => a.Name.ToLower(), a => a)); + _AnnotationJSObjectInitor = new(CreateAnnotationJSObject); } public Background? Background { get; init; } + #region Annotation [JsonIgnore] public Annotation? DefaultAnnotation { get; init; } @@ -55,8 +56,21 @@ public class AnnotationParams } } } + #endregion - private readonly Lazy> _AnnotationJSObjectInitor; + #region AnnotationJSObject + private Dictionary CreateAnnotationJSObject() + { + var dict = _annots.ToDictionary(a => a.Name.ToLower(), a => a as IAnnotation); - public Dictionary AnnotationJSObject => _AnnotationJSObjectInitor.Value; + if (Background is not null) + dict.Add(Background.Name.ToLower(), Background); + + return dict; + } + + private readonly Lazy> _AnnotationJSObjectInitor; + + public Dictionary AnnotationJSObject => _AnnotationJSObjectInitor.Value; + #endregion } diff --git a/EnvelopeGenerator.Web/Models/Annotation/Background.cs b/EnvelopeGenerator.Web/Models/Annotation/Background.cs index aa770b87..fc0b76a4 100644 --- a/EnvelopeGenerator.Web/Models/Annotation/Background.cs +++ b/EnvelopeGenerator.Web/Models/Annotation/Background.cs @@ -2,6 +2,10 @@ namespace EnvelopeGenerator.Web.Models.Annotation; +/// +/// The Background is an annotation for the PSPDF Kit. However, it has no function. +/// It is only the first annotation as a background for other annotations. +/// public record Background : IAnnotation { [JsonIgnore]