diff --git a/DesktopUI2/DesktopUI2/ViewModels/StreamViewModel.cs b/DesktopUI2/DesktopUI2/ViewModels/StreamViewModel.cs index 9dce1117f4..0c0e5f99a1 100644 --- a/DesktopUI2/DesktopUI2/ViewModels/StreamViewModel.cs +++ b/DesktopUI2/DesktopUI2/ViewModels/StreamViewModel.cs @@ -472,6 +472,13 @@ public Avalonia.Media.Imaging.Bitmap PreviewImage360 set => this.RaiseAndSetIfChanged(ref _previewImage360, value); } + private bool _previewImage360Loaded; + public bool PreviewImage360Loaded + { + get => _previewImage360Loaded; + set => this.RaiseAndSetIfChanged(ref _previewImage360Loaded, value); + } + public bool CanOpenCommentsIn3DView { get; set; } = false; private bool _isAddingBranches = false; @@ -1017,6 +1024,10 @@ public async Task DownloadImage360(string url) _previewImage360 = new Bitmap(stream); this.RaisePropertyChanged(nameof(PreviewImage360)); + //the default 360 image width is 34300 + //this is a quick hack to see if the returned image is not an error image like "you do not have access" etc + if (_previewImage360.Size.Width > 30000) + PreviewImage360Loaded = true; } catch (Exception ex) diff --git a/DesktopUI2/DesktopUI2/Views/Controls/StreamEditControls/Receive.xaml b/DesktopUI2/DesktopUI2/Views/Controls/StreamEditControls/Receive.xaml index 55b5106572..1257dd67d0 100644 --- a/DesktopUI2/DesktopUI2/Views/Controls/StreamEditControls/Receive.xaml +++ b/DesktopUI2/DesktopUI2/Views/Controls/StreamEditControls/Receive.xaml @@ -211,6 +211,7 @@ diff --git a/DesktopUI2/DesktopUI2/Views/Controls/StreamEditControls/Receive.xaml.cs b/DesktopUI2/DesktopUI2/Views/Controls/StreamEditControls/Receive.xaml.cs index 29fa4945b9..afd8d97c18 100644 --- a/DesktopUI2/DesktopUI2/Views/Controls/StreamEditControls/Receive.xaml.cs +++ b/DesktopUI2/DesktopUI2/Views/Controls/StreamEditControls/Receive.xaml.cs @@ -1,6 +1,7 @@ using Avalonia; using Avalonia.Controls; using Avalonia.Markup.Xaml; +using DesktopUI2.ViewModels; using System; namespace DesktopUI2.Views.Controls.StreamEditControls @@ -18,14 +19,20 @@ public Receive() Image360 = this.FindControl("Image360"); ImageBasic = this.FindControl("ImageBasic"); - - PreviewBox360.PointerMoved += PreviewBox360_PointerMoved; + } + + private void PreviewBox360_PointerMoved(object sender, Avalonia.Input.PointerEventArgs e) { + var svm = PreviewBox360.DataContext as StreamViewModel; + if (!svm.PreviewImage360Loaded) + return; + Image360.Opacity = 1; ImageBasic.IsVisible = false; + var mouseX = e.GetPosition(PreviewBox360).X + PreviewBox360.Margin.Left; SetMargin(mouseX); }