Browse Source

Merge pull request #265 from ionite34/fixes

pull/165/head
Ionite 1 year ago committed by GitHub
parent
commit
dc534aa54f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      StabilityMatrix.Avalonia/Controls/AdvancedImageBoxView.axaml
  2. 4
      StabilityMatrix.Avalonia/Controls/ImageFolderCard.axaml
  3. 19
      StabilityMatrix.Avalonia/ViewModels/Dialogs/ImageViewerViewModel.cs
  4. 18
      StabilityMatrix.Avalonia/Views/Dialogs/ImageViewerDialog.axaml
  5. 1
      StabilityMatrix.Avalonia/Views/Inference/InferenceImageUpscaleView.axaml
  6. 1
      StabilityMatrix.Avalonia/Views/Inference/InferenceTextToImageView.axaml

7
StabilityMatrix.Avalonia/Controls/AdvancedImageBoxView.axaml

@ -17,13 +17,6 @@
Image="{Binding BitmapAsync^}">
<controls:AdvancedImageBox.ContextFlyout>
<ui:FAMenuFlyout>
<!--<ui:MenuFlyoutItem
Command="{ReflectionBinding #ImageCarousel.DataContext.FlyoutPreviewCommand}"
CommandParameter="{Binding #ImageView.Image}"
Text="Expanded Preview"
HotKey="Space"
IconSource="ZoomInFilled" />
<ui:MenuFlyoutSeparator/>-->
<ui:MenuFlyoutItem
x:Name="CopyMenuItem"
IsEnabled="{OnPlatform Windows=True, Default=False}"

4
StabilityMatrix.Avalonia/Controls/ImageFolderCard.axaml

@ -140,11 +140,11 @@
<ui:FAMenuFlyout>
<ui:MenuFlyoutItem
HotKey="{x:Null}"
Command="{StaticResource ImageCopyCommand}"
Command="{StaticResource ImageDeleteCommand}"
CommandParameter="{Binding $self.DataContext}"/>
<ui:MenuFlyoutItem
HotKey="{x:Null}"
Command="{StaticResource ImageDeleteCommand}"
Command="{StaticResource ImageCopyCommand}"
CommandParameter="{Binding $self.DataContext}"/>
<ui:MenuFlyoutSeparator/>

19
StabilityMatrix.Avalonia/ViewModels/Dialogs/ImageViewerViewModel.cs

@ -1,16 +1,20 @@
using System;
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls.Primitives;
using Avalonia.Media.Imaging;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using FluentAvalonia.Core;
using Microsoft.Extensions.DependencyInjection;
using StabilityMatrix.Avalonia.Controls;
using StabilityMatrix.Avalonia.Helpers;
using StabilityMatrix.Avalonia.Models;
using StabilityMatrix.Avalonia.ViewModels.Base;
using StabilityMatrix.Avalonia.Views;
using StabilityMatrix.Avalonia.Views.Dialogs;
using StabilityMatrix.Core.Attributes;
using StabilityMatrix.Core.Helper;
using StabilityMatrix.Core.Models.Database;
using Size = StabilityMatrix.Core.Helper.Size;
@ -74,6 +78,21 @@ public partial class ImageViewerViewModel : ContentDialogViewModelBase
NavigationRequested?.Invoke(this, DirectionalNavigationEventArgs.Down);
}
[RelayCommand]
private async Task CopyImage(Bitmap? image)
{
if (image is null || !Compat.IsWindows)
return;
await Task.Run(() =>
{
if (Compat.IsWindows)
{
WindowsClipboard.SetBitmap(image);
}
});
}
public BetterContentDialog GetDialog()
{
var margins = new Thickness(64, 32);

18
StabilityMatrix.Avalonia/Views/Dialogs/ImageViewerDialog.axaml

@ -47,7 +47,23 @@
VerticalAlignment="Stretch"
RowDefinitions="*,Auto">
<controls:AdvancedImageBox Image="{Binding ImageSource.BitmapAsync^}" SizeMode="Fit" />
<controls:AdvancedImageBox
Name="ImageBox"
Image="{Binding ImageSource.BitmapAsync^}"
SizeMode="Fit">
<controls:AdvancedImageBox.ContextFlyout>
<ui:FAMenuFlyout>
<ui:MenuFlyoutItem
x:Name="CopyMenuItem"
IsEnabled="{OnPlatform Windows=True, Default=False}"
Command="{Binding CopyImageCommand}"
CommandParameter="{Binding #ImageBox.Image}"
Text="Copy"
HotKey="Ctrl+C"
IconSource="Copy" />
</ui:FAMenuFlyout>
</controls:AdvancedImageBox.ContextFlyout>
</controls:AdvancedImageBox>
<!-- Info button -->
<Grid

1
StabilityMatrix.Avalonia/Views/Inference/InferenceImageUpscaleView.axaml

@ -171,6 +171,7 @@
Proportion="0.1">
<Tool
x:Name="ImageFolderTool"
Title="Gallery"
x:DataType="Tool"
CanClose="False"
Id="ImageFolderTool">

1
StabilityMatrix.Avalonia/Views/Inference/InferenceTextToImageView.axaml

@ -202,6 +202,7 @@
<Tool
x:Name="ImageFolderTool"
x:DataType="Tool"
Title="Gallery"
Id="ImageFolderTool"
CanClose="False">

Loading…
Cancel
Save