Skip to content

Commit

Permalink
Add ScrollViewer when BGPathDisplay doesn't fit screen
Browse files Browse the repository at this point in the history
  • Loading branch information
gablm committed Apr 2, 2024
1 parent ebc90c3 commit ce93669
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,34 @@ internal static class WindowSize
"Normal",
new WindowSizeProp()
{
WindowBounds = new Size(1280, 720),
EventPostCarouselBounds = new Size(399, 185),
PostPanelBounds = new Size(399, 134),
PostPanelBottomMargin = new Thickness(0, 0, 0, 52),
PostPanelPaimonHeight = 138,
PostPanelPaimonMargin = new Thickness(0, -48, -32, 0),
PostPanelPaimonInnerMargin = new Thickness(0, 0, 0, 48),
PostPanelPaimonTextMargin = new Thickness(0, 0, 142, 0),
BannerIconWidth = 136,
BannerIconMargin = new Thickness(0, 0, 80, 70)
WindowBounds = new Size(1280, 720),
EventPostCarouselBounds = new Size(399, 185),
PostPanelBounds = new Size(399, 134),
PostPanelBottomMargin = new Thickness(0, 0, 0, 52),
PostPanelPaimonHeight = 138,
PostPanelPaimonMargin = new Thickness(0, -48, -32, 0),
PostPanelPaimonInnerMargin = new Thickness(0, 0, 0, 48),
PostPanelPaimonTextMargin = new Thickness(0, 0, 142, 0),
BannerIconWidth = 136,
BannerIconMargin = new Thickness(0, 0, 80, 70),
SettingsPanelWidth = 676
}
},
{
"Small",
new WindowSizeProp()
{
WindowBounds = new Size(1024, 576),
EventPostCarouselBounds = new Size(336, 156),
PostPanelBounds = new Size(336, 118),
PostPanelBottomMargin = new Thickness(0, 0, 0, 38),
PostPanelPaimonHeight = 138,
PostPanelPaimonMargin = new Thickness(0, -48, -32, 0),
PostPanelPaimonInnerMargin = new Thickness(0, 0, 0, 48),
PostPanelPaimonTextMargin = new Thickness(0, 0, 142, 0),
BannerIconWidth = 136,
BannerIconMargin = new Thickness(0,0,70,38)
WindowBounds = new Size(1024, 576),
EventPostCarouselBounds = new Size(336, 156),
PostPanelBounds = new Size(336, 118),
PostPanelBottomMargin = new Thickness(0, 0, 0, 38),
PostPanelPaimonHeight = 138,
PostPanelPaimonMargin = new Thickness(0, -48, -32, 0),
PostPanelPaimonInnerMargin = new Thickness(0, 0, 0, 48),
PostPanelPaimonTextMargin = new Thickness(0, 0, 142, 0),
BannerIconWidth = 136,
BannerIconMargin = new Thickness(0, 0, 70, 38),
SettingsPanelWidth = 424
}
}
};
Expand Down Expand Up @@ -68,15 +70,16 @@ internal static string CurrentWindowSizeName

internal class WindowSizeProp
{
public Size WindowBounds { get; set; }
public Size EventPostCarouselBounds { get; set; }
public Size PostPanelBounds { get; set; }
public Thickness PostPanelBottomMargin { get; set; }
public int PostPanelPaimonHeight { get; set; }
public Thickness PostPanelPaimonMargin { get; set; }
public Size WindowBounds { get; set; }
public Size EventPostCarouselBounds { get; set; }
public Size PostPanelBounds { get; set; }
public Thickness PostPanelBottomMargin { get; set; }
public int PostPanelPaimonHeight { get; set; }
public Thickness PostPanelPaimonMargin { get; set; }
public Thickness PostPanelPaimonInnerMargin { get; set; }
public Thickness PostPanelPaimonTextMargin { get; set; }
public int BannerIconWidth { get; set; }
public Thickness BannerIconMargin { get; set; }
public Thickness PostPanelPaimonTextMargin { get; set; }
public int BannerIconWidth { get; set; }
public Thickness BannerIconMargin { get; set; }
public int SettingsPanelWidth { get; set; }
}
}
14 changes: 9 additions & 5 deletions CollapseLauncher/XAMLs/MainApp/Pages/SettingsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
xmlns:helper="using:Hi3Helper"
xmlns:innerConfig="using:Hi3Helper.Shared.Region"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:localWindowSize="using:CollapseLauncher.WindowSize"
CacheMode="BitmapCache"
Loaded="Page_Loaded"
NavigationCacheMode="Enabled"
Expand Down Expand Up @@ -141,12 +142,15 @@
</StackPanel>
</Button>
<ScrollViewer HorizontalScrollMode="Enabled"
Margin="12,0,0,0"
Width="384">
<TextBlock x:Name="BGPathDisplay"
VerticalScrollMode="Disabled"
HorizontalScrollBarVisibility="Visible"
x:Name="BGPathDisplayViewer"
Margin="12,-4,0,-4"
Width="{x:Bind localWindowSize:WindowSize.CurrentWindowSize.SettingsPanelWidth}">
<TextBlock Margin="0, 4"
x:Name="BGPathDisplay"
VerticalAlignment="Center"
Text=""
TextTrimming="CharacterEllipsis" />
Text=""/>
</ScrollViewer>
</StackPanel>
<TextBlock x:Name="AppBGCustomizerNote"
Expand Down
5 changes: 3 additions & 2 deletions CollapseLauncher/XAMLs/MainApp/Pages/SettingsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -815,10 +815,11 @@ private int SelectedWindowSizeProfile
set
{
if (value < 0) return;
CurrentWindowSizeName = WindowSizeProfilesKey[value];
CurrentWindowSizeName = WindowSizeProfilesKey[value];
BGPathDisplayViewer.Width = CurrentWindowSize.SettingsPanelWidth;
var delayedDragAreaChange = async () =>
{
await System.Threading.Tasks.Task.Delay(250);
await Task.Delay(250);
ChangeTitleDragArea.Change(DragAreaTemplate.Default);
};
delayedDragAreaChange();
Expand Down

0 comments on commit ce93669

Please sign in to comment.