|
@@ -1,6 +1,4 @@
|
|
|
-using Avalonia;
|
|
|
|
|
-using Avalonia.Controls;
|
|
|
|
|
-using Avalonia.Controls.ApplicationLifetimes;
|
|
|
|
|
|
|
+using Avalonia.Controls;
|
|
|
using Avalonia.Controls.Primitives;
|
|
using Avalonia.Controls.Primitives;
|
|
|
using PicView.Avalonia.Gallery;
|
|
using PicView.Avalonia.Gallery;
|
|
|
using PicView.Avalonia.UI;
|
|
using PicView.Avalonia.UI;
|
|
@@ -37,45 +35,43 @@ public partial class GalleryItemSizeSlider : UserControl
|
|
|
|
|
|
|
|
private void RangeBase_OnValueChanged(object? sender, RangeBaseValueChangedEventArgs e)
|
|
private void RangeBase_OnValueChanged(object? sender, RangeBaseValueChangedEventArgs e)
|
|
|
{
|
|
{
|
|
|
- if (DataContext is not MainViewModel vm ||
|
|
|
|
|
- Application.Current?.ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime desktop)
|
|
|
|
|
|
|
+ if (DataContext is not MainViewModel vm)
|
|
|
{
|
|
{
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (GalleryFunctions.IsFullGalleryOpen)
|
|
if (GalleryFunctions.IsFullGalleryOpen)
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- else if (GalleryFunctions.IsBottomGalleryOpen)
|
|
|
|
|
- {
|
|
|
|
|
- // Change the sizes of the bottom gallery items
|
|
|
|
|
// ReSharper disable once CompareOfFloatsByEqualityOperator
|
|
// ReSharper disable once CompareOfFloatsByEqualityOperator
|
|
|
- if (vm.GetBottomGalleryItemHeight == e.NewValue)
|
|
|
|
|
|
|
+ if (vm.GetFullGalleryItemHeight == e.NewValue)
|
|
|
{
|
|
{
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- SettingsHelper.Settings.Gallery.BottomGalleryItemSize = e.NewValue;
|
|
|
|
|
- vm.GetGalleryItemHeight = e.NewValue;
|
|
|
|
|
- var mainView = desktop.MainWindow.GetControl<MainView>("MainView");
|
|
|
|
|
- var gallery = mainView.GalleryView;
|
|
|
|
|
- gallery.Height = vm.GalleryHeight;
|
|
|
|
|
|
|
+ vm.GetFullGalleryItemHeight = e.NewValue;
|
|
|
|
|
+ vm.GetGalleryItemHeight = vm.GetFullGalleryItemHeight;
|
|
|
WindowHelper.SetSize(vm);
|
|
WindowHelper.SetSize(vm);
|
|
|
|
|
+ // Binding to height depends on timing of the update. Maybe find a cleaner mvvm solution one day
|
|
|
|
|
+
|
|
|
|
|
+ // Maybe save this on close or some other way
|
|
|
|
|
+ SettingsHelper.Settings.Gallery.ExpandedGalleryItemSize = e.NewValue;
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
- else
|
|
|
|
|
|
|
+ else if (SettingsHelper.Settings.Gallery.IsBottomGalleryShown)
|
|
|
{
|
|
{
|
|
|
// ReSharper disable once CompareOfFloatsByEqualityOperator
|
|
// ReSharper disable once CompareOfFloatsByEqualityOperator
|
|
|
- if (vm.GetGalleryItemHeight == e.NewValue)
|
|
|
|
|
|
|
+ if (vm.GetBottomGalleryItemHeight == e.NewValue)
|
|
|
{
|
|
{
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- vm.GetFullGalleryItemHeight = e.NewValue;
|
|
|
|
|
- if (GalleryFunctions.IsFullGalleryOpen)
|
|
|
|
|
- {
|
|
|
|
|
- WindowHelper.SetSize(vm);
|
|
|
|
|
- vm.GetGalleryItemHeight = e.NewValue;
|
|
|
|
|
- }
|
|
|
|
|
- SettingsHelper.Settings.Gallery.ExpandedGalleryItemSize = e.NewValue;
|
|
|
|
|
|
|
+ vm.GetBottomGalleryItemHeight = e.NewValue;
|
|
|
|
|
+
|
|
|
|
|
+ vm.GetGalleryItemHeight = e.NewValue;
|
|
|
|
|
+ UIHelper.GetGalleryView.Height = vm.GalleryHeight;
|
|
|
|
|
+ WindowHelper.SetSize(vm);
|
|
|
|
|
+
|
|
|
|
|
+ // Binding to height depends on timing of the update. Maybe find a cleaner mvvm solution one day
|
|
|
|
|
+ // Maybe save this on close or some other way
|
|
|
|
|
+ SettingsHelper.Settings.Gallery.BottomGalleryItemSize = e.NewValue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
_ = SettingsHelper.SaveSettingsAsync();
|
|
_ = SettingsHelper.SaveSettingsAsync();
|