Skip to content

Commit

Permalink
Revert "Make right-alignment smoother by growing the window"
Browse files Browse the repository at this point in the history
This reverts commit 8452eb4df26348702180f93af8deaa433bad36f0.
  • Loading branch information
danielchalmers committed Dec 20, 2023
1 parent 2d25a4e commit 67fee6f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
2 changes: 1 addition & 1 deletion DesktopClock/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
MenuActivation="LeftOrRightClick" />
</Window.Resources>

<Viewbox Height="{Binding Height, Source={x:Static p:Settings.Default}, Mode=OneWay}" HorizontalAlignment="{Binding ViewboxHorizontalAlignment}">
<Viewbox Height="{Binding Height, Source={x:Static p:Settings.Default}, Mode=OneWay}">
<Border CornerRadius="{Binding BackgroundCornerRadius, Source={x:Static p:Settings.Default}, Mode=OneWay}" Padding="1,0,1,0">
<Border.Style>
<Style TargetType="Border">
Expand Down
13 changes: 0 additions & 13 deletions DesktopClock/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ public MainWindow()
ConfigureTrayIcon(!Settings.Default.ShowInTaskbar, true);
}

/// <summary>
/// If the clock is right-aligned we grow the clock's invisible bounds and align it here to make it smoother than just forcing the position.
/// </summary>
public HorizontalAlignment ViewboxHorizontalAlignment => Settings.Default.RightAligned ? HorizontalAlignment.Right : HorizontalAlignment.Left;

/// <summary>
/// Copies the current time string to the clipboard.
/// </summary>
Expand Down Expand Up @@ -301,10 +296,6 @@ private void Settings_PropertyChanged(object sender, PropertyChangedEventArgs e)
case nameof(Settings.Default.CountdownTo):
UpdateCountdownEnabled();
break;

case nameof(Settings.Default.RightAligned):
OnPropertyChanged(nameof(ViewboxHorizontalAlignment));
break;
}
}

Expand Down Expand Up @@ -408,10 +399,6 @@ private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
{
if (e.WidthChanged && !_isDragging && Settings.Default.RightAligned)
{
// Keep the width high so next time the clock changes we won't have to re-align the window, which can look jarring.
MinWidth = Math.Max(MinWidth, ActualWidth);

// Align to the anchor from settings or dragging the window.
Left = _rightAnchor - ActualWidth;
}
}
Expand Down

0 comments on commit 67fee6f

Please sign in to comment.