Skip to content

Commit

Permalink
Code Quality: Follow up fixes for the title bar drag region (files-co…
Browse files Browse the repository at this point in the history
…mmunity#16595)

Co-authored-by: Yair <[email protected]>
  • Loading branch information
XTorLukas and yaira2 authored Dec 12, 2024
1 parent 5629c8d commit 2aab17e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/Files.App/UserControls/TabBar/TabBar.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -358,15 +358,19 @@ private void TabViewItem_Loaded(object sender, RoutedEventArgs e)
}
}

private void DragAreaRectangle_Loaded(object sender, RoutedEventArgs e)
private async void DragAreaRectangle_Loaded(object sender, RoutedEventArgs e)
{
double scaleAdjustment = DragAreaRectangle.XamlRoot.RasterizationScale;
double titleBarInset = ((FilePropertiesHelpers.FlowDirectionSettingIsRightToLeft
if (HorizontalTabView.ActualWidth <= 0 && TabBarAddNewTabButton.Width <= 0)
await Task.Delay(100);

var titleBarInset = ((FilePropertiesHelpers.FlowDirectionSettingIsRightToLeft
? MainWindow.Instance.AppWindow.TitleBar.LeftInset
: MainWindow.Instance.AppWindow.TitleBar.RightInset) / scaleAdjustment) + 40;
: MainWindow.Instance.AppWindow.TitleBar.RightInset) / DragAreaRectangle.XamlRoot.RasterizationScale) + 40;

HorizontalTabView.Measure(new(HorizontalTabView.ActualWidth - TabBarAddNewTabButton.Width - titleBarInset, HorizontalTabView.ActualHeight));
RightPaddingColumn.Width = new(titleBarInset >= 0 ? titleBarInset : 0);
RightPaddingColumn.Width = new(titleBarInset > 40 ? titleBarInset : 138);
HorizontalTabView.Measure(new(
HorizontalTabView.ActualWidth - TabBarAddNewTabButton.Width - titleBarInset,
HorizontalTabView.ActualHeight));
}
}
}
1 change: 1 addition & 0 deletions src/Files.App/Views/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ private void UserSettingsService_OnSettingChangedEvent(object? sender, SettingCh
private void HorizontalMultitaskingControl_Loaded(object sender, RoutedEventArgs e)
{
TabControl.DragArea.SizeChanged += (_, _) => MainWindow.Instance.RaiseSetTitleBarDragRegion(SetTitleBarDragRegion);
TabControl.SizeChanged += (_, _) => MainWindow.Instance.RaiseSetTitleBarDragRegion(SetTitleBarDragRegion);
if (ViewModel.MultitaskingControl is not TabBar)
{
ViewModel.MultitaskingControl = TabControl;
Expand Down

0 comments on commit 2aab17e

Please sign in to comment.