فهرست منبع

Fixed save as and filter

flabbet 9 ماه پیش
والد
کامیت
f16e907f3b

+ 0 - 1
src/PixiEditor/Models/IO/ExportConfig.cs

@@ -6,7 +6,6 @@ namespace PixiEditor.Models.IO;
 
 public class ExportConfig
 {
-   public static ExportConfig Empty { get; } = new ExportConfig();
    public VecI ExportSize { get; set; }
    public bool ExportAsSpriteSheet { get; set; } = false;
    public int SpriteSheetColumns { get; set; }

+ 2 - 1
src/PixiEditor/Models/IO/Exporter.cs

@@ -60,7 +60,8 @@ internal class Exporter
         {
             var file = await desktop.MainWindow.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
             {
-                FileTypeChoices = SupportedFilesHelper.BuildSaveFilter(), DefaultExtension = "pixi"
+                FileTypeChoices = SupportedFilesHelper.BuildSaveFilter(
+                    FileTypeDialogDataSet.SetKind.Any & ~FileTypeDialogDataSet.SetKind.Video), DefaultExtension = "pixi"
             });
 
             if (file is null)

+ 2 - 1
src/PixiEditor/ViewModels/SubViewModels/FileViewModel.cs

@@ -366,7 +366,8 @@ internal class FileViewModel : SubViewModel<ViewModelMain>
         string finalPath = null;
         if (asNew || string.IsNullOrEmpty(document.FullFilePath))
         {
-            var result = await Exporter.TrySaveWithDialog(document, ExportConfig.Empty, null);
+            ExportConfig config = new ExportConfig() { ExportSize = document.SizeBindable };
+            var result = await Exporter.TrySaveWithDialog(document, config, null);
             if (result.Result == DialogSaveResult.Cancelled)
                 return false;
             if (result.Result != DialogSaveResult.Success)