From eb024acfa7eebd0814625e98af710fcef60c7ee7 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Thu, 20 Mar 2025 17:16:42 +0100 Subject: [PATCH] =?UTF-8?q?featAnnotation):=20Hinzuf=C3=BCgen=20von=20Verh?= =?UTF-8?q?=C3=A4ltnisanteilen,=20um=20die=20Konfiguration=20=C3=BCber=20d?= =?UTF-8?q?as=20Verh=C3=A4ltnis=20zu=20erm=C3=B6glichen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EnvelopeGenerator.Web/Models/Annotation.cs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/EnvelopeGenerator.Web/Models/Annotation.cs b/EnvelopeGenerator.Web/Models/Annotation.cs index 448365ed..fd54b68f 100644 --- a/EnvelopeGenerator.Web/Models/Annotation.cs +++ b/EnvelopeGenerator.Web/Models/Annotation.cs @@ -30,6 +30,9 @@ public record Annotation init => _marginLeft = value; } + [JsonIgnore] + public double MarginLeftRatio { get; init; } = 1; + [JsonIgnore] public double MarginTop { @@ -37,17 +40,26 @@ public record Annotation init => _marginTop = value; } + [JsonIgnore] + public double MarginTopRatio { get; init; } = 1; + public double Width { get => _width; init => _width = value; } + [JsonIgnore] + public double WidthRatio { get; init; } = 1; + public double Height { get => _height; init => _height = value; } + + [JsonIgnore] + public double HeightRatio { get; init; } = 1; #endregion #region Position @@ -79,16 +91,16 @@ public record Annotation { // To set default value, annotation must have default (0) value but default must has non-default value if (_marginLeft == default && value.MarginLeft != default) - _marginLeft = value.MarginLeft; + _marginLeft = value.MarginLeft * MarginLeftRatio; if (_marginTop == default && value.MarginTop != default) - _marginTop = value.MarginTop; + _marginTop = value.MarginTop * MarginTopRatio; if (_width == default && value.Width != default) - _width = value.Width; + _width = value.Width * WidthRatio; if (_height == default && value.Height != default) - _height = value.Height; + _height = value.Height * HeightRatio; } } }; \ No newline at end of file