mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 12:56:30 +00:00
fix editing non-timed annotations
This commit is contained in:
@@ -34,13 +34,13 @@ public class CanvasEditor : Canvas
|
||||
public static readonly DependencyProperty GetTimeFuncProp =
|
||||
DependencyProperty.Register(
|
||||
nameof(GetTimeFunc),
|
||||
typeof(Func<TimeSpan>),
|
||||
typeof(Func<TimeSpan?>),
|
||||
typeof(CanvasEditor),
|
||||
new PropertyMetadata(null));
|
||||
|
||||
public Func<TimeSpan> GetTimeFunc
|
||||
public Func<TimeSpan?> GetTimeFunc
|
||||
{
|
||||
get => (Func<TimeSpan>)GetValue(GetTimeFuncProp);
|
||||
get => (Func<TimeSpan?>)GetValue(GetTimeFuncProp);
|
||||
set => SetValue(GetTimeFuncProp, value);
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ public class CanvasEditor : Canvas
|
||||
});
|
||||
}
|
||||
|
||||
public AnnotationControl CreateAnnotation(AnnotationClass annClass, TimeSpan time, CanvasLabel canvasLabel)
|
||||
public AnnotationControl CreateAnnotation(AnnotationClass annClass, TimeSpan? time, CanvasLabel canvasLabel)
|
||||
{
|
||||
var annotationControl = new AnnotationControl(annClass, time, AnnotationResizeStart)
|
||||
{
|
||||
@@ -354,7 +354,10 @@ public class CanvasEditor : Canvas
|
||||
|
||||
public void ClearExpiredAnnotations(TimeSpan time)
|
||||
{
|
||||
var expiredAnns = CurrentAnns.Where(x => Math.Abs((time - x.Time).TotalMilliseconds) > _viewThreshold.TotalMilliseconds).ToList();
|
||||
var expiredAnns = CurrentAnns.Where(x =>
|
||||
x.Time.HasValue &&
|
||||
Math.Abs((time - x.Time.Value).TotalMilliseconds) > _viewThreshold.TotalMilliseconds)
|
||||
.ToList();
|
||||
RemoveAnnotations(expiredAnns);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user