fix show image, fix zoom

This commit is contained in:
Alex Bezdieniezhnykh
2025-07-03 12:53:43 +03:00
parent bb6413c4f0
commit ea7c487493
4 changed files with 41 additions and 21 deletions
+16 -16
View File
@@ -40,8 +40,7 @@ public partial class Annotator
private readonly IDbFactory _dbFactory;
private readonly IInferenceService _inferenceService;
private readonly IInferenceClient _inferenceClient;
private ObservableCollection<DetectionClass> AnnotationClasses { get; set; } = new();
private bool _suspendLayout;
private bool _gpsPanelVisible = false;
@@ -181,21 +180,22 @@ public partial class Annotator
{
if (_formState.CurrentMrl == _mediaPlayer.Media?.Mrl)
return; //already loaded all the info
await Dispatcher.Invoke(async () => await ReloadAnnotations());
//show image
if (_formState.CurrentMedia?.MediaType == MediaTypes.Image)
{
await Task.Delay(100); //wait to load the frame and set on pause
ShowTimeAnnotations(TimeSpan.FromMilliseconds(_mediaPlayer.Time), showImage: true);
return;
}
_formState.CurrentMrl = _mediaPlayer.Media?.Mrl ?? "";
uint vw = 0, vh = 0;
_mediaPlayer.Size(0, ref vw, ref vh);
_formState.CurrentVideoSize = new Size(vw, vh);
_formState.CurrentVideoLength = TimeSpan.FromMilliseconds(_mediaPlayer.Length);
await Dispatcher.Invoke(async () => await ReloadAnnotations());
if (_formState.CurrentMedia?.MediaType == MediaTypes.Image)
{
await Task.Delay(100); //wait to load the frame and set on pause
ShowTimeAnnotations(TimeSpan.FromMilliseconds(_mediaPlayer.Time));
_mediaPlayer.SetPause(true);
}
};
LvFiles.MouseDoubleClick += async (_, _) =>
@@ -268,7 +268,7 @@ public partial class Annotator
Editor.ClearExpiredAnnotations(res.Annotation.Time);
});
ShowAnnotations(res.Annotation, showImage: true);
ShowAnnotation(res.Annotation, showImage: true);
}
private void SaveUserSettings()
{
@@ -281,7 +281,7 @@ public partial class Annotator
_configUpdater.Save(_appConfig);
}
private void ShowTimeAnnotations(TimeSpan time)
private void ShowTimeAnnotations(TimeSpan time, bool showImage = false)
{
Dispatcher.Invoke(() =>
{
@@ -290,10 +290,10 @@ public partial class Annotator
Editor.ClearExpiredAnnotations(time);
});
ShowAnnotations(TimedAnnotations.Query(time).FirstOrDefault());
ShowAnnotation(TimedAnnotations.Query(time).FirstOrDefault(), showImage);
}
private void ShowAnnotations(Annotation? annotation, bool showImage = false)
private void ShowAnnotation(Annotation? annotation, bool showImage = false)
{
if (annotation == null)
return;
+3 -3
View File
@@ -229,13 +229,13 @@ public class AnnotatorEventHandler(
mainWindow.Editor.ResetBackground();
formState.CurrentMedia = mediaInfo;
mainWindow.Title = $"Azaion Annotator - {mediaInfo.Name}";
//need to wait a bit for correct VLC playback event handling
await Task.Delay(100, ct);
mediaPlayer.Stop();
mainWindow.Title = $"Azaion Annotator - {mediaInfo.Name}";
mediaPlayer.Play(new Media(libVLC, mediaInfo.Path));
if (formState.CurrentMedia.MediaType == MediaTypes.Image)
mediaPlayer.SetPause(true);
}
//SAVE: MANUAL