Skip to content

Commit

Permalink
Fix: Fixed crash that would occur when ungrouping from zoomed out view (
Browse files Browse the repository at this point in the history
  • Loading branch information
hishitetsu and yaira2 committed Jun 21, 2024
1 parent 016afe0 commit 109f2a9
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
5 changes: 2 additions & 3 deletions src/Files.App/Views/Layouts/BaseGroupableLayoutPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,9 @@ protected virtual void ItemManipulationModel_StartRenameItemInvoked(object? send
StartRenameItem();
}

protected virtual void ZoomIn(object? sender, GroupOption option)
protected override void ZoomIn()
{
if (option == GroupOption.None)
RootZoom.IsZoomedInViewActive = true;
RootZoom.IsZoomedInViewActive = true;
}

protected virtual void FileList_SelectionChanged(object sender, SelectionChangedEventArgs e)
Expand Down
6 changes: 6 additions & 0 deletions src/Files.App/Views/Layouts/BaseLayoutPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1314,6 +1314,8 @@ private void UpdateCollectionViewSource()
}
else
{
ZoomIn();

var newSource = new CollectionViewSource()
{
IsSourceGrouped = false,
Expand All @@ -1323,6 +1325,10 @@ private void UpdateCollectionViewSource()
}
}

protected virtual void ZoomIn()
{
}

protected void SemanticZoom_ViewChangeStarted(object sender, SemanticZoomViewChangedEventArgs e)
{
if (e.IsSourceZoomedInView)
Expand Down
2 changes: 0 additions & 2 deletions src/Files.App/Views/Layouts/ColumnLayoutPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,6 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)

base.OnNavigatedTo(eventArgs);

FolderSettings.GroupOptionPreferenceUpdated -= ZoomIn;
FolderSettings.GroupOptionPreferenceUpdated += ZoomIn;
UserSettingsService.LayoutSettingsService.PropertyChanged += LayoutSettingsService_PropertyChanged;

SetItemContainerStyle();
Expand Down
2 changes: 0 additions & 2 deletions src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
ParentShellPageInstance.FilesystemViewModel.EnabledGitProperties = GetEnabledGitProperties(ColumnsViewModel);

FolderSettings.LayoutModeChangeRequested += FolderSettings_LayoutModeChangeRequested;
FolderSettings.GroupOptionPreferenceUpdated += ZoomIn;
FolderSettings.SortDirectionPreferenceUpdated += FolderSettings_SortDirectionPreferenceUpdated;
FolderSettings.SortOptionPreferenceUpdated += FolderSettings_SortOptionPreferenceUpdated;
ParentShellPageInstance.FilesystemViewModel.PageTypeUpdated += FilesystemViewModel_PageTypeUpdated;
Expand All @@ -186,7 +185,6 @@ protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
{
base.OnNavigatingFrom(e);
FolderSettings.LayoutModeChangeRequested -= FolderSettings_LayoutModeChangeRequested;
FolderSettings.GroupOptionPreferenceUpdated -= ZoomIn;
FolderSettings.SortDirectionPreferenceUpdated -= FolderSettings_SortDirectionPreferenceUpdated;
FolderSettings.SortOptionPreferenceUpdated -= FolderSettings_SortOptionPreferenceUpdated;
ParentShellPageInstance.FilesystemViewModel.PageTypeUpdated -= FilesystemViewModel_PageTypeUpdated;
Expand Down
2 changes: 0 additions & 2 deletions src/Files.App/Views/Layouts/GridLayoutPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)

currentIconSize = FolderSettings.GetRoundedIconSize();

FolderSettings.GroupOptionPreferenceUpdated -= ZoomIn;
FolderSettings.GroupOptionPreferenceUpdated += ZoomIn;
FolderSettings.LayoutModeChangeRequested -= FolderSettings_LayoutModeChangeRequested;
FolderSettings.LayoutModeChangeRequested += FolderSettings_LayoutModeChangeRequested;
UserSettingsService.LayoutSettingsService.PropertyChanged += LayoutSettingsService_PropertyChanged;
Expand Down

0 comments on commit 109f2a9

Please sign in to comment.