mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 23:06:31 +00:00
add autodetection
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Shapes;
|
||||
using Azaion.Annotator.DTO;
|
||||
using Label = System.Windows.Controls.Label;
|
||||
|
||||
namespace Azaion.Annotator.Controls;
|
||||
|
||||
@@ -14,7 +15,9 @@ public class AnnotationControl : Border
|
||||
|
||||
private readonly Grid _grid;
|
||||
private readonly TextBlock _classNameLabel;
|
||||
private readonly Label _probabilityLabel;
|
||||
public TimeSpan? Time { get; set; }
|
||||
public double? Probability { get; set; }
|
||||
|
||||
private AnnotationClass _annotationClass = null!;
|
||||
public AnnotationClass AnnotationClass
|
||||
@@ -41,7 +44,7 @@ public class AnnotationControl : Border
|
||||
}
|
||||
}
|
||||
|
||||
public AnnotationControl(AnnotationClass annotationClass, TimeSpan? time, Action<object, MouseButtonEventArgs> resizeStart)
|
||||
public AnnotationControl(AnnotationClass annotationClass, TimeSpan? time, Action<object, MouseButtonEventArgs> resizeStart, double? probability = null)
|
||||
{
|
||||
Time = time;
|
||||
_resizeStart = resizeStart;
|
||||
@@ -54,6 +57,13 @@ public class AnnotationControl : Border
|
||||
FontSize = 14,
|
||||
Cursor = Cursors.SizeAll
|
||||
};
|
||||
_probabilityLabel = new Label
|
||||
{
|
||||
Content = probability?.ToString("F1") ?? string.Empty,
|
||||
HorizontalAlignment = HorizontalAlignment.Right,
|
||||
VerticalAlignment = VerticalAlignment.Top,
|
||||
Margin = new Thickness(0, -15, 0, 0),
|
||||
};
|
||||
_selectionFrame = new Rectangle
|
||||
{
|
||||
HorizontalAlignment = HorizontalAlignment.Stretch,
|
||||
|
||||
@@ -312,7 +312,7 @@ public class CanvasEditor : Canvas
|
||||
|
||||
public AnnotationControl CreateAnnotation(AnnotationClass annClass, TimeSpan? time, CanvasLabel canvasLabel)
|
||||
{
|
||||
var annotationControl = new AnnotationControl(annClass, time, AnnotationResizeStart)
|
||||
var annotationControl = new AnnotationControl(annClass, time, AnnotationResizeStart, canvasLabel.Probability)
|
||||
{
|
||||
Width = canvasLabel.Width,
|
||||
Height = canvasLabel.Height
|
||||
|
||||
Reference in New Issue
Block a user