featAnnotation): Hinzufügen von Verhältnisanteilen, um die Konfiguration über das Verhältnis zu ermöglichen

This commit is contained in:
Developer 02 2025-03-20 17:16:42 +01:00
parent 210ce072f8
commit eb024acfa7

View File

@ -30,6 +30,9 @@ public record Annotation
init => _marginLeft = value; init => _marginLeft = value;
} }
[JsonIgnore]
public double MarginLeftRatio { get; init; } = 1;
[JsonIgnore] [JsonIgnore]
public double MarginTop public double MarginTop
{ {
@ -37,17 +40,26 @@ public record Annotation
init => _marginTop = value; init => _marginTop = value;
} }
[JsonIgnore]
public double MarginTopRatio { get; init; } = 1;
public double Width public double Width
{ {
get => _width; get => _width;
init => _width = value; init => _width = value;
} }
[JsonIgnore]
public double WidthRatio { get; init; } = 1;
public double Height public double Height
{ {
get => _height; get => _height;
init => _height = value; init => _height = value;
} }
[JsonIgnore]
public double HeightRatio { get; init; } = 1;
#endregion #endregion
#region Position #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 // To set default value, annotation must have default (0) value but default must has non-default value
if (_marginLeft == default && value.MarginLeft != default) if (_marginLeft == default && value.MarginLeft != default)
_marginLeft = value.MarginLeft; _marginLeft = value.MarginLeft * MarginLeftRatio;
if (_marginTop == default && value.MarginTop != default) if (_marginTop == default && value.MarginTop != default)
_marginTop = value.MarginTop; _marginTop = value.MarginTop * MarginTopRatio;
if (_width == default && value.Width != default) if (_width == default && value.Width != default)
_width = value.Width; _width = value.Width * WidthRatio;
if (_height == default && value.Height != default) if (_height == default && value.Height != default)
_height = value.Height; _height = value.Height * HeightRatio;
} }
} }
}; };