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;
public class AnnotationParams: Annotation
public class AnnotationParams
{
private Annotation? DefaultAnnotation { get; init; }
private readonly Dictionary<string, Annotation> _annots = new();
public required Dictionary<string, Annotation> Annots
@ -14,17 +16,21 @@ public class AnnotationParams: Annotation
foreach (var name in _annots.Keys)
{
#region set default values
if (_annots[name]._left == default)
_annots[name]._left = Left;
if(DefaultAnnotation is not null)
{
// 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)
_annots[name]._top = Top;
if (_annots[name]._top == default && DefaultAnnotation.Top != default)
_annots[name]._top = DefaultAnnotation.Top;
if (_annots[name]._width == default)
_annots[name]._width = Width;
if (_annots[name]._width == default && DefaultAnnotation.Width != default)
_annots[name]._width = DefaultAnnotation.Width;
if (_annots[name]._height == default)
_annots[name]._height = Height;
if (_annots[name]._height == default && DefaultAnnotation.Height != default)
_annots[name]._height = DefaultAnnotation.Height;
}
#endregion
#region set bound annotations

View File

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