Skip to content

Commit 850728e

Browse files
authored
Merge pull request LykosAI#1122 from ionite34/fix-unsupported-format
Fix unsupported format when navigating thru image galleries
2 parents 3ee8887 + 0e2763c commit 850728e

4 files changed

Lines changed: 14 additions & 11 deletions

File tree

StabilityMatrix.Avalonia/Controls/AdvancedImageBox.axaml.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public ZoomLevelCollection(IEnumerable<int> collection)
163163
5800,
164164
6800,
165165
7800,
166-
8800
166+
8800,
167167
}
168168
);
169169

@@ -426,7 +426,7 @@ public enum SizeModes : byte
426426
/// <summary>
427427
/// The image is stretched to fill as much of the client area of the control as possible, whilst retaining the same aspect ratio for the width and height.
428428
/// </summary>
429-
Fit
429+
Fit,
430430
}
431431

432432
[Flags]
@@ -435,7 +435,7 @@ public enum MouseButtons : byte
435435
None = 0,
436436
LeftButton = 1,
437437
MiddleButton = 2,
438-
RightButton = 4
438+
RightButton = 4,
439439
}
440440

441441
/// <summary>
@@ -462,7 +462,7 @@ public enum ZoomActions : byte
462462
/// <summary>
463463
/// The control zoom was reset.
464464
/// </summary>
465-
ActualSize = 4
465+
ActualSize = 4,
466466
}
467467

468468
public enum SelectionModes
@@ -480,7 +480,7 @@ public enum SelectionModes
480480
/// <summary>
481481
/// Zoom selection.
482482
/// </summary>
483-
Zoom
483+
Zoom,
484484
}
485485

486486
#endregion
@@ -511,7 +511,7 @@ public Vector Offset
511511
}
512512
}
513513

514-
public Size ViewPortSize => ViewPort.Bounds.Size;
514+
public Size ViewPortSize => ViewPort?.Bounds.Size ?? new Size(50, 50);
515515
#endregion
516516

517517
#region Private Members
@@ -1355,13 +1355,13 @@ private void RenderBackgroundGrid(DrawingContext context)
13551355
var square1Drawing = new GeometryDrawing
13561356
{
13571357
Brush = GridColorAlternate,
1358-
Geometry = new RectangleGeometry(new Rect(0.0, 0.0, size, size))
1358+
Geometry = new RectangleGeometry(new Rect(0.0, 0.0, size, size)),
13591359
};
13601360

13611361
var square2Drawing = new GeometryDrawing
13621362
{
13631363
Brush = GridColorAlternate,
1364-
Geometry = new RectangleGeometry(new Rect(size, size, size, size))
1364+
Geometry = new RectangleGeometry(new Rect(size, size, size, size)),
13651365
};
13661366

13671367
var drawingGroup = new DrawingGroup { Children = { square1Drawing, square2Drawing } };

StabilityMatrix.Avalonia/ViewModels/CheckpointBrowser/CivitDetailsPageViewModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ protected override async Task OnInitialLoadedAsync()
304304
imageCache
305305
.Connect()
306306
.Filter(showNsfwPredicate)
307+
.Filter(img => img.Type == "image")
307308
.Transform(x => new ImageSource(new Uri(x.Url)))
308309
.Bind(ImageSources)
309310
.ObserveOn(SynchronizationContext.Current!)

StabilityMatrix.Avalonia/ViewModels/Inference/ImageFolderCardViewModel.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ private async Task OnImageClick(LocalImageFile item)
211211

212212
// Preload
213213
await newImageSource.GetBitmapAsync();
214+
await newImageSource.GetOrRefreshTemplateKeyAsync();
214215

215216
// var oldImageSource = sender.ImageSource;
216217

@@ -325,9 +326,9 @@ private async Task ImageExportImpl(
325326
new(formatName)
326327
{
327328
Patterns = new[] { $"*.{formatName.ToLowerInvariant()}" },
328-
MimeTypes = new[] { $"image/{formatName.ToLowerInvariant()}" }
329-
}
330-
}
329+
MimeTypes = new[] { $"image/{formatName.ToLowerInvariant()}" },
330+
},
331+
},
331332
}
332333
);
333334

StabilityMatrix.Avalonia/ViewModels/OutputsPageViewModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ public async Task ShowImageDialog(OutputImageViewModel item)
294294

295295
// Preload
296296
await newImageSource.GetBitmapAsync();
297+
await newImageSource.GetOrRefreshTemplateKeyAsync();
297298

298299
sender.ImageSource = newImageSource;
299300
sender.LocalImageFile = newImage.ImageFile;

0 commit comments

Comments
 (0)