Skip to content

Commit

Permalink
Store rotation angle
Browse files Browse the repository at this point in the history
  • Loading branch information
FrayxRulez committed Jan 13, 2024
1 parent 96355a4 commit 9b8c464
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
10 changes: 8 additions & 2 deletions Telegram/Controls/Gallery/GalleryContent.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion Telegram/Controls/Gallery/GalleryWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions Telegram/ViewModels/Gallery/GalleryMedia.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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();
Expand Down

0 comments on commit 9b8c464

Please sign in to comment.