mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 12:36:31 +00:00
fix show image, fix zoom
This commit is contained in:
@@ -149,6 +149,9 @@ public class CanvasEditor : Canvas
|
||||
_matrixTransform.Matrix = matrix;
|
||||
_isZoomedIn = true;
|
||||
}
|
||||
|
||||
foreach (var detection in CurrentDetections)
|
||||
detection.UpdateAdornerScale(scale: _matrixTransform.Matrix.M11);
|
||||
}
|
||||
|
||||
private void Init(object sender, RoutedEventArgs e)
|
||||
|
||||
@@ -43,6 +43,7 @@ public class DetectionControl : Border
|
||||
private readonly Rectangle _selectionFrame;
|
||||
|
||||
private bool _isSelected;
|
||||
|
||||
public bool IsSelected
|
||||
{
|
||||
get => _isSelected;
|
||||
@@ -53,6 +54,21 @@ public class DetectionControl : Border
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateAdornerScale(double scale)
|
||||
{
|
||||
if (Math.Abs(scale) < 0.0001)
|
||||
return;
|
||||
|
||||
var inverseScale = 1.0 / scale;
|
||||
BorderThickness = new Thickness(4 * inverseScale);
|
||||
foreach (var rect in _resizedRectangles)
|
||||
{
|
||||
rect.Width = 2 * RESIZE_RECT_SIZE * inverseScale;
|
||||
rect.Height = 2 * RESIZE_RECT_SIZE * inverseScale;;
|
||||
rect.Margin = new Thickness(-RESIZE_RECT_SIZE * 0.7);
|
||||
}
|
||||
}
|
||||
|
||||
public (HorizontalAlignment Horizontal, VerticalAlignment Vertical) DetectionLabelPosition
|
||||
{
|
||||
get => (DetectionLabelContainer.HorizontalAlignment, DetectionLabelContainer.VerticalAlignment);
|
||||
@@ -66,14 +82,15 @@ public class DetectionControl : Border
|
||||
private string _detectionLabelText(string detectionClassName) =>
|
||||
_confidence >= 0.995 ? detectionClassName : $"{detectionClassName}: {_confidence * 100:F0}%"; //double
|
||||
|
||||
public DetectionControl(DetectionClass detectionClass, TimeSpan time, Action<object, MouseButtonEventArgs> resizeStart, CanvasLabel canvasLabel)
|
||||
public DetectionControl(DetectionClass detectionClass, TimeSpan time, Action<object,
|
||||
MouseButtonEventArgs> resizeStart, CanvasLabel canvasLabel)
|
||||
{
|
||||
Width = canvasLabel.Width;
|
||||
Height = canvasLabel.Height;
|
||||
Time = time;
|
||||
_resizeStart = resizeStart;
|
||||
_confidence = canvasLabel.Confidence;
|
||||
|
||||
|
||||
DetectionLabelContainer = new Canvas
|
||||
{
|
||||
HorizontalAlignment = HorizontalAlignment.Right,
|
||||
|
||||
Reference in New Issue
Block a user