feat(Hintergrund): Erstellen, um den Hintergrund von Anmerkungen mit der Eigenschaft MarginRatio zu konfigurieren.
- verschiebt Anmerkungen nach
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Models;
|
||||
namespace EnvelopeGenerator.Web.Models.Annotation;
|
||||
|
||||
public record Annotation
|
||||
{
|
||||
@@ -1,13 +1,20 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Models;
|
||||
namespace EnvelopeGenerator.Web.Models.Annotation;
|
||||
|
||||
public class AnnotationParams
|
||||
{
|
||||
public AnnotationParams()
|
||||
{
|
||||
_annotationDictionaryInitor = new(() => _annots.ToDictionary(a => a.Name.ToLower(), a => a));
|
||||
}
|
||||
|
||||
public Background? Background { get; init; }
|
||||
|
||||
[JsonIgnore]
|
||||
public Annotation? DefaultAnnotation { get; init; }
|
||||
|
||||
private readonly IEnumerable<Annotation> _annots = new List<Annotation>();
|
||||
private readonly List<Annotation> _annots = new List<Annotation>();
|
||||
|
||||
public Annotation this[string name] => _annots.First(a => a.Name == name);
|
||||
|
||||
@@ -24,7 +31,7 @@ public class AnnotationParams
|
||||
get => _annots;
|
||||
init
|
||||
{
|
||||
_annots = value;
|
||||
_annots = value.ToList();
|
||||
|
||||
if (DefaultAnnotation is not null)
|
||||
foreach (var annot in _annots)
|
||||
@@ -48,10 +55,10 @@ public class AnnotationParams
|
||||
throw new InvalidOperationException($"{verBoundAnnotName} added as bound anotation. However, it is not defined.");
|
||||
#endregion
|
||||
}
|
||||
|
||||
AnnotationDictionary = _annots.ToDictionary(a => a.Name.ToLower(), a => a);
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<string, Annotation> AnnotationDictionary { get; private init; } = new();
|
||||
private readonly Lazy<Dictionary<string, Annotation>> _annotationDictionaryInitor;
|
||||
|
||||
public Dictionary<string, Annotation> AnnotationDictionary => _annotationDictionaryInitor.Value;
|
||||
}
|
||||
6
EnvelopeGenerator.Web/Models/Annotation/Background.cs
Normal file
6
EnvelopeGenerator.Web/Models/Annotation/Background.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace EnvelopeGenerator.Web.Models.Annotation;
|
||||
|
||||
public class Background
|
||||
{
|
||||
public int Margin { get; init; }
|
||||
}
|
||||
Reference in New Issue
Block a user