diff --git a/Telegram/Controls/Gallery/GalleryContent.xaml.cs b/Telegram/Controls/Gallery/GalleryContent.xaml.cs index 30fb1e790..ce0fc2dfd 100644 --- a/Telegram/Controls/Gallery/GalleryContent.xaml.cs +++ b/Telegram/Controls/Gallery/GalleryContent.xaml.cs @@ -144,10 +144,16 @@ public void UpdateItem(IGalleryDelegate delegato, GalleryMedia item) _delegate = delegato; _item = item; - _appliedRotation = 0; + _appliedRotation = item?.RotationAngle switch + { + RotationAngle.Angle90 => 90, + RotationAngle.Angle180 => 180, + RotationAngle.Angle270 => 270, + _ => 0 + }; Tag = item; - RotationAngle = RotationAngle.Angle0; + RotationAngle = item?.RotationAngle ?? RotationAngle.Angle0; Background = null; Texture.Source = null; diff --git a/Telegram/Controls/Gallery/GalleryWindow.xaml.cs b/Telegram/Controls/Gallery/GalleryWindow.xaml.cs index a5059ce3b..d4bbcc750 100644 --- a/Telegram/Controls/Gallery/GalleryWindow.xaml.cs +++ b/Telegram/Controls/Gallery/GalleryWindow.xaml.cs @@ -1093,7 +1093,7 @@ private void Rotate_Click(object sender, RoutedEventArgs e) { if (LayoutRoot.CurrentElement is AspectView view) { - view.RotationAngle = view.RotationAngle switch + ViewModel.SelectedItem.RotationAngle = view.RotationAngle = view.RotationAngle switch { RotationAngle.Angle0 => RotationAngle.Angle270, RotationAngle.Angle270 => RotationAngle.Angle180, diff --git a/Telegram/ViewModels/Gallery/GalleryMedia.cs b/Telegram/ViewModels/Gallery/GalleryMedia.cs index d7dd6d705..8c615f0b5 100644 --- a/Telegram/ViewModels/Gallery/GalleryMedia.cs +++ b/Telegram/ViewModels/Gallery/GalleryMedia.cs @@ -4,6 +4,7 @@ // Distributed under the GNU General Public License v3.0. (See accompanying // file LICENSE or copy at https://www.gnu.org/licenses/gpl-3.0.txt) // +using Telegram.Controls; using Telegram.Services; using Telegram.Td.Api; @@ -20,6 +21,8 @@ public GalleryMedia(IClientService clientService) public IClientService ClientService => _clientService; + public RotationAngle RotationAngle { get; set; } + public abstract File GetFile(); public abstract File GetThumbnail();