Skip to content

Commit

Permalink
Fix: Fixed an issue where the title bar drag region was sometimes mis…
Browse files Browse the repository at this point in the history
…sing (#16549)
  • Loading branch information
XTorLukas authored and Lamparter committed Dec 10, 2024
1 parent e18728f commit 9cc83b5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
3 changes: 2 additions & 1 deletion src/Files.App/UserControls/TabBar/TabBar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@
Grid.ColumnSpan="2"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Fill="Transparent" />
Fill="Transparent"
Loaded="DragAreaRectangle_Loaded" />

</Grid>
</TabView.TabStripFooter>
Expand Down
22 changes: 12 additions & 10 deletions src/Files.App/UserControls/TabBar/TabBar.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,6 @@ public TabBar()
tabHoverTimer.Interval = TimeSpan.FromMilliseconds(Constants.DragAndDrop.HoverToOpenTimespan);
tabHoverTimer.Tick += TabHoverSelected;

var appWindow = MainWindow.Instance.AppWindow;

double rightPaddingColumnWidth =
FilePropertiesHelpers.FlowDirectionSettingIsRightToLeft
? appWindow.TitleBar.LeftInset
: appWindow.TitleBar.RightInset;

RightPaddingColumn.Width = new(rightPaddingColumnWidth >= 0 ? rightPaddingColumnWidth : 0);

AppearanceSettingsService.PropertyChanged += (s, e) =>
{
switch (e.PropertyName)
Expand Down Expand Up @@ -366,5 +357,16 @@ private void TabViewItem_Loaded(object sender, RoutedEventArgs e)
});
}
}

private void DragAreaRectangle_Loaded(object sender, RoutedEventArgs e)
{
double scaleAdjustment = DragAreaRectangle.XamlRoot.RasterizationScale;
double titleBarInset = ((FilePropertiesHelpers.FlowDirectionSettingIsRightToLeft
? MainWindow.Instance.AppWindow.TitleBar.LeftInset
: MainWindow.Instance.AppWindow.TitleBar.RightInset) / scaleAdjustment) + 40;

HorizontalTabView.Measure(new(HorizontalTabView.ActualWidth - TabBarAddNewTabButton.Width - titleBarInset, HorizontalTabView.ActualHeight));
RightPaddingColumn.Width = new(titleBarInset >= 0 ? titleBarInset : 0);
}
}
}
}
2 changes: 1 addition & 1 deletion src/Files.App/Views/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -487,4 +487,4 @@ private void PaneSplitter_ManipulationStarted(object sender, ManipulationStarted
InputSystemCursorShape.SizeWestEast : InputSystemCursorShape.SizeNorthSouth));
}
}
}
}

0 comments on commit 9cc83b5

Please sign in to comment.