Skip to content

Commit 75ea0be

Browse files
authored
Fix: Update thumbnail when rotating image (#11635)
1 parent dae49d6 commit 75ea0be

File tree

3 files changed

+36
-45
lines changed

3 files changed

+36
-45
lines changed

src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@
263263
<Grid
264264
x:Name="HeaderGrid"
265265
Height="40"
266-
Padding="16,0,0,0"
267266
Margin="0"
267+
Padding="16,0,0,0"
268268
BorderBrush="{ThemeResource ControlStrokeColorDefault}"
269269
BorderThickness="0,0,0,1"
270270
PointerPressed="Grid_PointerPressed">
@@ -566,9 +566,9 @@
566566
<CheckBox
567567
x:Name="SelectionCheckbox"
568568
Width="20"
569-
AutomationProperties.AccessibilityView="Raw"
570569
MinWidth="0"
571570
HorizontalAlignment="Center"
571+
AutomationProperties.AccessibilityView="Raw"
572572
Checked="ItemSelected_Checked"
573573
Unchecked="ItemSelected_Unchecked"
574574
Visibility="Collapsed" />
@@ -620,6 +620,7 @@
620620
x:Name="IconOverlay"
621621
Width="16"
622622
Height="16"
623+
Margin="2"
623624
HorizontalAlignment="Left"
624625
VerticalAlignment="Bottom"
625626
x:Load="True"

src/Files.App/Views/LayoutModes/GridViewBrowser.xaml.cs

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using Files.App.EventArguments;
55
using Files.App.Filesystem;
66
using Files.App.Helpers;
7-
using Files.App.Interacts;
87
using Files.App.UserControls.Selection;
98
using Files.Shared.Enums;
109
using Microsoft.UI.Input;
@@ -47,23 +46,6 @@ public GridViewBrowser()
4746
selectionRectangle.SelectionEnded += SelectionRectangle_SelectionEnded;
4847
}
4948

50-
protected override void HookEvents()
51-
{
52-
base.HookEvents();
53-
ItemManipulationModel.RefreshItemThumbnailInvoked += ItemManipulationModel_RefreshItemThumbnail;
54-
ItemManipulationModel.RefreshItemsThumbnailInvoked += ItemManipulationModel_RefreshItemsThumbnail;
55-
}
56-
57-
private void ItemManipulationModel_RefreshItemsThumbnail(object? sender, EventArgs e)
58-
{
59-
ReloadSelectedItemsIcon();
60-
}
61-
62-
private void ItemManipulationModel_RefreshItemThumbnail(object? sender, EventArgs args)
63-
{
64-
ReloadSelectedItemIcon();
65-
}
66-
6749
protected override void ItemManipulationModel_ScrollIntoViewInvoked(object? sender, ListedItem e)
6850
{
6951
FileList.ScrollIntoView(e);
@@ -92,13 +74,6 @@ protected override void ItemManipulationModel_RemoveSelectedItemInvoked(object?
9274
FileList.SelectedItems.Remove(e);
9375
}
9476

95-
protected override void UnhookEvents()
96-
{
97-
base.UnhookEvents();
98-
ItemManipulationModel.RefreshItemThumbnailInvoked -= ItemManipulationModel_RefreshItemThumbnail;
99-
ItemManipulationModel.RefreshItemsThumbnailInvoked -= ItemManipulationModel_RefreshItemsThumbnail;
100-
}
101-
10277
protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
10378
{
10479
if (eventArgs.Parameter is NavigationArguments navArgs)
@@ -372,24 +347,6 @@ private async void ReloadItemIcons()
372347
}
373348
}
374349

375-
private async void ReloadSelectedItemIcon()
376-
{
377-
ParentShellPageInstance.FilesystemViewModel.CancelExtendedPropertiesLoading();
378-
ParentShellPageInstance.SlimContentPage.SelectedItem.ItemPropertiesInitialized = false;
379-
await ParentShellPageInstance.FilesystemViewModel.LoadExtendedItemProperties(ParentShellPageInstance.SlimContentPage.SelectedItem, currentIconSize);
380-
}
381-
382-
private async void ReloadSelectedItemsIcon()
383-
{
384-
ParentShellPageInstance.FilesystemViewModel.CancelExtendedPropertiesLoading();
385-
386-
foreach (var selectedItem in ParentShellPageInstance.SlimContentPage.SelectedItems)
387-
{
388-
selectedItem.ItemPropertiesInitialized = false;
389-
await ParentShellPageInstance.FilesystemViewModel.LoadExtendedItemProperties(selectedItem, currentIconSize);
390-
}
391-
}
392-
393350
private async void FileList_ItemTapped(object sender, TappedRoutedEventArgs e)
394351
{
395352
var clickedItem = e.OriginalSource as FrameworkElement;
@@ -460,6 +417,7 @@ private void FileList_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
460417
}
461418
ResetRenameDoubleClick();
462419
}
420+
463421
private void ItemSelected_Checked(object sender, RoutedEventArgs e)
464422
{
465423
if (sender is CheckBox checkBox && checkBox.DataContext is ListedItem item && !FileList.SelectedItems.Contains(item))

src/Files.App/Views/LayoutModes/StandardLayoutMode.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ protected override void HookEvents()
6060
ItemManipulationModel.FocusSelectedItemsInvoked += ItemManipulationModel_FocusSelectedItemsInvoked;
6161
ItemManipulationModel.StartRenameItemInvoked += ItemManipulationModel_StartRenameItemInvoked;
6262
ItemManipulationModel.ScrollIntoViewInvoked += ItemManipulationModel_ScrollIntoViewInvoked;
63+
ItemManipulationModel.RefreshItemThumbnailInvoked += ItemManipulationModel_RefreshItemThumbnail;
64+
ItemManipulationModel.RefreshItemsThumbnailInvoked += ItemManipulationModel_RefreshItemsThumbnail;
6365
}
6466

6567
protected override void UnhookEvents()
@@ -76,6 +78,36 @@ protected override void UnhookEvents()
7678
ItemManipulationModel.FocusSelectedItemsInvoked -= ItemManipulationModel_FocusSelectedItemsInvoked;
7779
ItemManipulationModel.StartRenameItemInvoked -= ItemManipulationModel_StartRenameItemInvoked;
7880
ItemManipulationModel.ScrollIntoViewInvoked -= ItemManipulationModel_ScrollIntoViewInvoked;
81+
ItemManipulationModel.RefreshItemThumbnailInvoked -= ItemManipulationModel_RefreshItemThumbnail;
82+
ItemManipulationModel.RefreshItemsThumbnailInvoked -= ItemManipulationModel_RefreshItemsThumbnail;
83+
}
84+
85+
protected virtual void ItemManipulationModel_RefreshItemsThumbnail(object? sender, EventArgs e)
86+
{
87+
ReloadSelectedItemsIcon();
88+
}
89+
90+
protected virtual void ItemManipulationModel_RefreshItemThumbnail(object? sender, EventArgs args)
91+
{
92+
ReloadSelectedItemIcon();
93+
}
94+
95+
protected virtual async void ReloadSelectedItemIcon()
96+
{
97+
ParentShellPageInstance.FilesystemViewModel.CancelExtendedPropertiesLoading();
98+
ParentShellPageInstance.SlimContentPage.SelectedItem.ItemPropertiesInitialized = false;
99+
await ParentShellPageInstance.FilesystemViewModel.LoadExtendedItemProperties(ParentShellPageInstance.SlimContentPage.SelectedItem, IconSize);
100+
}
101+
102+
protected virtual async void ReloadSelectedItemsIcon()
103+
{
104+
ParentShellPageInstance.FilesystemViewModel.CancelExtendedPropertiesLoading();
105+
106+
foreach (var selectedItem in ParentShellPageInstance.SlimContentPage.SelectedItems)
107+
{
108+
selectedItem.ItemPropertiesInitialized = false;
109+
await ParentShellPageInstance.FilesystemViewModel.LoadExtendedItemProperties(selectedItem, IconSize);
110+
}
79111
}
80112

81113
protected virtual void ItemManipulationModel_FocusFileListInvoked(object? sender, EventArgs e)

0 commit comments

Comments
 (0)