Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
RupertAvery committed Feb 10, 2024
1 parent 9c97cb5 commit 515e353
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
6 changes: 4 additions & 2 deletions Diffusion.Toolkit/Behaviors/DTBehaviors.IsScrollDisabled.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ void ElementOnPreviewMouseWheel(object sender, MouseWheelEventArgs e)

private static T GetVisualParent<T>(DependencyObject child) where T : Visual
{
var parent = default(T);

var v = (Visual?)VisualTreeHelper.GetParent(child);

var parent = v as T;
parent = v as T;

if (parent == null)
if (parent == null && v != null)
{
parent = GetVisualParent<T>(v);
}
Expand Down
1 change: 1 addition & 0 deletions Diffusion.Toolkit/Localization/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"Menu.View.FitToPreview": "_Fit to Preview",
"Menu.View.TogglePreview": "Show/Hide Preview",
"Menu.View.PopoutPreview": "Popout Preview",
"Menu.View.ResetLayout": "Reset Layout",
"Menu.Albums": "_Albums",
"Menu.Albums.AlbumPane": "Album Pane",
"Menu.Albums.Sort": "_Sort",
Expand Down
26 changes: 17 additions & 9 deletions Diffusion.Toolkit/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Diffusion.Toolkit;
public interface IScanOptions
{

List<string> ImagePaths { get; set; }
List<string> ImagePaths { get; set; }

List<string> ExcludePaths { get; set; }

Expand Down Expand Up @@ -77,8 +77,8 @@ public Settings() : this(false)
{
Instance = this;
}
public Settings(bool initialize)

public Settings(bool initialize)
{
DontShowWelcomeOnStartup = false;
ImagePaths = new List<string>();
Expand All @@ -98,6 +98,14 @@ public Settings(bool initialize)
MetadataSection = new MetadataSectionSettings();
MetadataSection.Attach(this);

MainGridWidth = "5*";
MainGridWidth2 = "*";
NavigationThumbnailGridWidth = "*";
NavigationThumbnailGridWidth2 = "3*";
PreviewGridHeight = "*";
PreviewGridHeight2 = "3*";


NavigationSection = new NavigationSectionSettings(initialize);
NavigationSection.Attach(this);

Expand All @@ -106,7 +114,7 @@ public Settings(bool initialize)
RecurseFolders = true;
}
}

public List<string> ImagePaths
{
get => _imagePaths;
Expand Down Expand Up @@ -190,7 +198,7 @@ public string? PreviewGridHeight2

private double? _top;
private double? _left;

public double? Top
{
get => _top;
Expand All @@ -202,7 +210,7 @@ public double? Left
get => _left;
set => UpdateValue(ref _left, value);
}

public WindowState? WindowState
{
get => _windowState;
Expand Down Expand Up @@ -428,7 +436,7 @@ protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

protected bool UpdateValue<T>(ref T field, T value, [CallerMemberName] string propertyName = "")
{
if (EqualityComparer<T>.Default.Equals(field, value)) return false;
Expand Down Expand Up @@ -493,7 +501,7 @@ public class NavigationSectionSettings : SettingsContainer
private bool _showFolders;
private bool _showModels;
private bool _showAlbums;

public NavigationSectionSettings()
{

Expand Down Expand Up @@ -609,7 +617,7 @@ public AccordionState SeedState
get => _seedState;
set => UpdateValue(ref _seedState, value);
}

public AccordionState SamplerState
{
get => _samplerState;
Expand Down

0 comments on commit 515e353

Please sign in to comment.