From d5b4ea46d30f5d849202af7bff2eb5f6e8891832 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Thu, 20 Mar 2025 11:39:40 +0100 Subject: [PATCH] =?UTF-8?q?feat(DefaultAnnotation):=20Hinzuf=C3=BCgen=20de?= =?UTF-8?q?r=20M=C3=B6glichkeit,=20eine=20Annotation=20mit=20zentralen=20S?= =?UTF-8?q?tandardwerten=20zu=20konfigurieren.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Models/AnnotationParams.cs | 24 ++++++++++++------- EnvelopeGenerator.Web/appsettings.json | 3 +++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/EnvelopeGenerator.Web/Models/AnnotationParams.cs b/EnvelopeGenerator.Web/Models/AnnotationParams.cs index f46486ac..2f6d6995 100644 --- a/EnvelopeGenerator.Web/Models/AnnotationParams.cs +++ b/EnvelopeGenerator.Web/Models/AnnotationParams.cs @@ -1,7 +1,9 @@ namespace EnvelopeGenerator.Web.Models; -public class AnnotationParams: Annotation +public class AnnotationParams { + private Annotation? DefaultAnnotation { get; init; } + private readonly Dictionary _annots = new(); public required Dictionary 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 diff --git a/EnvelopeGenerator.Web/appsettings.json b/EnvelopeGenerator.Web/appsettings.json index 3bf5e281..68165506 100644 --- a/EnvelopeGenerator.Web/appsettings.json +++ b/EnvelopeGenerator.Web/appsettings.json @@ -151,6 +151,9 @@ }, "MainPageTitle": null, "AnnotationParams": { + "DefaultAnnotation": { + + }, "Annotations": { "Signature": {