feat(DefaultAnnotation): Hinzufügen der Möglichkeit, eine Annotation mit zentralen Standardwerten zu konfigurieren.

This commit is contained in:
Developer 02 2025-03-20 11:39:40 +01:00
parent b6563d71b0
commit d5b4ea46d3
2 changed files with 18 additions and 9 deletions

View File

@ -1,7 +1,9 @@
namespace EnvelopeGenerator.Web.Models; namespace EnvelopeGenerator.Web.Models;
public class AnnotationParams: Annotation public class AnnotationParams
{ {
private Annotation? DefaultAnnotation { get; init; }
private readonly Dictionary<string, Annotation> _annots = new(); private readonly Dictionary<string, Annotation> _annots = new();
public required Dictionary<string, Annotation> Annots public required Dictionary<string, Annotation> Annots
@ -14,17 +16,21 @@ public class AnnotationParams: Annotation
foreach (var name in _annots.Keys) foreach (var name in _annots.Keys)
{ {
#region set default values #region set default values
if (_annots[name]._left == default) if(DefaultAnnotation is not null)
_annots[name]._left = Left; {
// To set default value, annotation must have default (0) value but default must has non-default value
if (_annots[name]._left == default && DefaultAnnotation.Left != default)
_annots[name]._left = DefaultAnnotation.Left;
if (_annots[name]._top == default) if (_annots[name]._top == default && DefaultAnnotation.Top != default)
_annots[name]._top = Top; _annots[name]._top = DefaultAnnotation.Top;
if (_annots[name]._width == default) if (_annots[name]._width == default && DefaultAnnotation.Width != default)
_annots[name]._width = Width; _annots[name]._width = DefaultAnnotation.Width;
if (_annots[name]._height == default) if (_annots[name]._height == default && DefaultAnnotation.Height != default)
_annots[name]._height = Height; _annots[name]._height = DefaultAnnotation.Height;
}
#endregion #endregion
#region set bound annotations #region set bound annotations

View File

@ -151,6 +151,9 @@
}, },
"MainPageTitle": null, "MainPageTitle": null,
"AnnotationParams": { "AnnotationParams": {
"DefaultAnnotation": {
},
"Annotations": { "Annotations": {
"Signature": { "Signature": {