Skip to content

Commit cc793b8

Browse files
committed
Update
1 parent 7b92731 commit cc793b8

5 files changed

Lines changed: 81 additions & 32 deletions

File tree

ShadowViewer.Plugin.Local/Pages/PicPage.xaml

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
<Page.Resources>
1818
<converters:LocalReaderModeConverter x:Key="LocalReaderModeConverter" />
1919
</Page.Resources>
20-
<Grid
21-
x:Name="RootGrid"
22-
Background="{ThemeResource LayerFillColorDefaultBrush}"
23-
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
24-
BorderThickness="1" PointerWheelChanged="MangaPointerWheelChanged"
25-
CornerRadius="{ThemeResource NavigationViewContentGridCornerRadius}">
20+
<Grid Tapped="PageTapped"
21+
x:Name="RootGrid"
22+
Background="{ThemeResource LayerFillColorDefaultBrush}"
23+
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
24+
BorderThickness="1" PointerWheelChanged="MangaPointerWheelChanged"
25+
CornerRadius="{ThemeResource NavigationViewContentGridCornerRadius}">
2626
<controls:MangaReader
2727
x:Name="MangaReader"
2828
ReadMode="{x:Bind local:LocalPlugin.Settings.LocalReaderMode,Mode=OneWay}"
@@ -52,7 +52,8 @@
5252
</DataTemplate>
5353
</controls:MangaScrollingReader.ItemTemplate>
5454
</controls:MangaScrollingReader>
55-
<Grid Loaded="InitTappedGridLayout" x:Name="TappedGrid" Background="{x:Bind ViewModel.TappedGridBackground,Mode=OneWay}">
55+
<Grid Loaded="InitTappedGridLayout" x:Name="TappedGrid"
56+
Visibility="{x:Bind ViewModel.TappedGridSetting,Mode=OneWay}">
5657
<Grid.Resources>
5758
<x:Double x:Key="TextFontSize">24</x:Double>
5859
<SolidColorBrush x:Key="TextForeground">White</SolidColorBrush>
@@ -85,37 +86,33 @@
8586
<!---->
8687
</Grid.ColumnDefinitions>
8788

88-
<Rectangle Fill="Transparent" Grid.Row="0" Grid.Column="0" Tapped="PrevPageTapped" />
8989
<!---->
90-
<Grid Grid.Row="0" Grid.Column="2" Tapped="PrevPageTapped">
90+
<Grid Grid.Row="0" Grid.Column="2">
9191
<Rectangle Fill="Transparent" />
9292
<TextBlock Text="{i18N:Locale Key=PrevPage}" HorizontalAlignment="Center" VerticalAlignment="Center"
9393
FontSize="{StaticResource TextFontSize}"
9494
Foreground="{StaticResource TextForeground}" FontWeight="Bold"
9595
Visibility="{x:Bind ViewModel.TappedGridVisibility,Mode=OneWay}" />
9696
</Grid>
97-
<Rectangle Fill="Transparent" Grid.Row="4" Grid.Column="0" Tapped="PrevPageTapped" />
9897
<!---->
99-
<Grid Grid.Row="2" Grid.Column="0" Tapped="PrevPageTapped">
98+
<Grid Grid.Row="2" Grid.Column="0">
10099
<Rectangle Fill="Transparent" />
101100
<TextBlock Text="{i18N:Locale Key=PrevPage}" HorizontalAlignment="Center" VerticalAlignment="Center"
102101
FontSize="{StaticResource TextFontSize}"
103102
Foreground="{StaticResource TextForeground}" FontWeight="Bold"
104103
Visibility="{x:Bind ViewModel.TappedGridVisibility,Mode=OneWay}" />
105104
</Grid>
106-
<Rectangle Fill="Transparent" Grid.Row="0" Grid.Column="4" Tapped="NextPageTapped" />
107-
<!---->
108-
<Grid Grid.Row="4" Grid.Column="2" Tapped="NextPageTapped">
105+
<!---->
106+
<Grid Grid.Row="4" Grid.Column="2">
109107
<Rectangle Fill="Transparent" />
110108
<TextBlock Text="{i18N:Locale Key=NextPage}" HorizontalAlignment="Center" VerticalAlignment="Center"
111109
FontSize="{StaticResource TextFontSize}"
112110
Foreground="{StaticResource TextForeground}"
113111
FontWeight="Bold"
114112
Visibility="{x:Bind ViewModel.TappedGridVisibility,Mode=OneWay}" />
115113
</Grid>
116-
<Rectangle Fill="Transparent" Grid.Row="4" Grid.Column="4" Tapped="NextPageTapped" />
117114
<!---->
118-
<Grid Grid.Row="2" Grid.Column="4" Tapped="NextPageTapped">
115+
<Grid Grid.Row="2" Grid.Column="4">
119116
<Rectangle Fill="Transparent" />
120117
<TextBlock Text="{i18N:Locale Key=NextPage}" HorizontalAlignment="Center" VerticalAlignment="Center"
121118
FontSize="{StaticResource TextFontSize}"
@@ -124,7 +121,7 @@
124121
</Grid>
125122

126123
<!---->
127-
<Grid Grid.Row="2" Grid.Column="2" Tapped="MenuTapped">
124+
<Grid Grid.Row="2" Grid.Column="2">
128125
<Rectangle Fill="Transparent" />
129126
<TextBlock Text="{i18N:Locale Key=Menu}" HorizontalAlignment="Center" VerticalAlignment="Center"
130127
FontSize="{StaticResource TextFontSize}"
@@ -165,7 +162,8 @@
165162
x:Name="Menu"
166163
Padding="20,5"
167164
HorizontalAlignment="Center"
168-
Background="{ThemeResource SolidBackgroundFillColorBaseBrush}"
165+
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
166+
169167
CornerRadius="5">
170168
<StackPanel>
171169
<Grid Height="48" ColumnSpacing="10"
@@ -202,10 +200,14 @@
202200
</Button.Flyout>
203201
</Button>
204202

205-
<ToggleButton Checked="TappedGridSet" IsChecked="{x:Bind ViewModel.TappedGridSetting,Mode=TwoWay}"
203+
<ToggleButton Checked="TappedGridSet"
204+
IsChecked="{x:Bind ViewModel.TappedGridSetting,Mode=TwoWay}"
206205
Style="{StaticResource PointerOverToggleButtonStyle}"
207206
Grid.Column="2">
208-
<TextBlock Text="{i18N:Locale Key=ReaderTappedGridSetting}"></TextBlock>
207+
<StackPanel Spacing="4" Orientation="Horizontal">
208+
<winUi:FluentIcon Icon="SelectObjectSkew"/>
209+
<TextBlock Text="{i18N:Locale Key=ReaderTappedGridSetting}"></TextBlock>
210+
</StackPanel>
209211
</ToggleButton>
210212
</Grid>
211213
<NavigationViewItemSeparator Visibility="{x:Bind ReaderSettingButton.IsChecked,Mode=OneWay}" />

ShadowViewer.Plugin.Local/Pages/PicPage.xaml.cs

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Microsoft.UI.Xaml.Controls;
55
using Microsoft.UI.Xaml.Controls.Primitives;
66
using Microsoft.UI.Xaml.Input;
7+
using Microsoft.UI.Xaml.Media;
78
using Microsoft.UI.Xaml.Navigation;
89
using Serilog;
910
using ShadowPluginLoader.WinUI;
@@ -51,7 +52,8 @@ protected override void OnNavigatedTo(NavigationEventArgs e)
5152
{
5253
await Task.Delay(TimeSpan.FromSeconds(0.3));
5354
ViewModel.IsPageSliderPressed = true;
54-
await PicViewer.SmoothScrollIntoViewWithIndexAsync(ViewModel.CurrentPage - 1, ScrollItemPlacement.Top,true);
55+
await PicViewer.SmoothScrollIntoViewWithIndexAsync(ViewModel.CurrentPage - 1, ScrollItemPlacement.Top,
56+
true);
5557
ViewModel.IsPageSliderPressed = false;
5658
};
5759
ViewModel.Init(arg);
@@ -94,6 +96,7 @@ await PicViewer.SmoothScrollIntoViewWithIndexAsync(ViewModel.CurrentPage - 1,
9496
Log.Error("监听是否松开点击进度条报错: {e}", ex);
9597
}
9698
}
99+
97100
/// <summary>
98101
/// 滚轮翻页响应
99102
/// </summary>
@@ -123,18 +126,62 @@ private void MangaPointerWheelChanged(object sender, PointerRoutedEventArgs e)
123126
}
124127
}
125128

126-
private void MenuTapped(object sender, TappedRoutedEventArgs e)
129+
private void PageTapped(object sender, TappedRoutedEventArgs e)
130+
{
131+
if (sender is not Grid grid) return;
132+
var position = e.GetPosition(grid);
133+
var colStar = 0D;
134+
var col0 = TappedGrid.ColumnDefinitions[0].Width;
135+
var col2 = TappedGrid.ColumnDefinitions[2].Width;
136+
var col4 = TappedGrid.ColumnDefinitions[4].Width;
137+
if (col0.GridUnitType == GridUnitType.Star) colStar += col0.Value;
138+
if (col2.GridUnitType == GridUnitType.Star) colStar += col2.Value;
139+
if (col4.GridUnitType == GridUnitType.Star) colStar += col4.Value;
140+
var avWidth = grid.ActualWidth / colStar;
141+
142+
var x1 = col0.GridUnitType == GridUnitType.Star ? col0.Value * avWidth : col0.Value;
143+
var x2 = x1 + (col2.GridUnitType == GridUnitType.Star ? col2.Value * avWidth : col2.Value);
144+
145+
var rowStar = 0D;
146+
var row0 = TappedGrid.RowDefinitions[0].Height;
147+
var row2 = TappedGrid.RowDefinitions[2].Height;
148+
var row4 = TappedGrid.RowDefinitions[4].Height;
149+
if (row0.GridUnitType == GridUnitType.Star) rowStar += row0.Value;
150+
if (row2.GridUnitType == GridUnitType.Star) rowStar += row2.Value;
151+
if (row4.GridUnitType == GridUnitType.Star) rowStar += row4.Value;
152+
var avHeight = grid.ActualHeight / rowStar;
153+
154+
var y1 = row0.GridUnitType == GridUnitType.Star ? row0.Value * avHeight : row0.Value;
155+
var y2 = y1 + (row2.GridUnitType == GridUnitType.Star ? row2.Value * avHeight : row2.Value);
156+
157+
if (position.X < x1 || position.X < x2 && position.Y < y1)
158+
{
159+
PrevPageTapped();
160+
}
161+
else if (position.X > x2 || position.X > x1 && position.Y > y2)
162+
{
163+
NextPageTapped();
164+
}
165+
else
166+
{
167+
MenuTapped();
168+
}
169+
170+
}
171+
172+
private void MenuTapped()
127173
{
128174
ViewModel.IsMenu = !ViewModel.IsMenu;
129175
}
130176

131-
private void NextPageTapped(object sender, TappedRoutedEventArgs e)
177+
private void NextPageTapped()
132178
{
133179
if (ViewModel.TappedGridSetting) return;
134180
if (!ViewModel.NextPageCommand.CanExecute(null)) return;
135181
ViewModel.NextPageCommand.Execute(null);
136182
}
137-
private void PrevPageTapped(object sender, TappedRoutedEventArgs e)
183+
184+
private void PrevPageTapped()
138185
{
139186
if (ViewModel.TappedGridSetting) return;
140187
if (!ViewModel.PrevPageCommand.CanExecute(null)) return;
@@ -186,5 +233,4 @@ private void InitTappedGridLayout(object sender, RoutedEventArgs e)
186233
if (layout.TryGetValue("Col4", out var col4) && layout.TryGetValue("Col4_Unit", out var col4Unit))
187234
TappedGrid.ColumnDefinitions[4].Width = new GridLength((double)col4, (GridUnitType)(int)col4Unit);
188235
}
189-
190236
}

ShadowViewer.Plugin.Local/ShadowViewer.Plugin.Local.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
<!--插件版本号(nuget包版本号)-->
14-
<Version>1.3.21</Version>
14+
<Version>1.3.23</Version>
1515
<!--插件仓库地址(nuget包仓库地址)-->
1616
<RepositoryUrl>https://github.com/kitUIN/ShadowViewer.Plugin.Local</RepositoryUrl>
1717
<!--插件介绍(nuget包介绍)-->
@@ -37,7 +37,7 @@
3737
<WebUri>$(RepositoryUrl)</WebUri>
3838
<Description>$(Description)</Description>
3939
<Authors>$(Authors)</Authors>
40-
<CoreVersion>2025.4.14.1</CoreVersion>
40+
<CoreVersion>2025.4.15.7</CoreVersion>
4141
<PluginManage>
4242
<CanOpenFolder>false</CanOpenFolder>
4343
<CanSwitch>false</CanSwitch>
@@ -58,10 +58,10 @@
5858
<PackageReference Include="CommunityToolkit.WinUI.Controls.Sizers" Version="8.1.240916" />
5959
</ItemGroup>
6060
<ItemGroup Condition="'$(Configuration)' == 'Debug'">
61-
<PackageReference Include="ShadowViewer.Core" Version="2025.4.14.1" />
61+
<PackageReference Include="ShadowViewer.Core" Version="2025.4.15.7" />
6262
<!-- <ProjectReference Include="..\..\ShadowViewer.Core\ShadowViewer.Core\ShadowViewer.Core.csproj"/> -->
6363
</ItemGroup>
6464
<ItemGroup Condition="'$(Configuration)' == 'Release'">
65-
<PackageReference Include="ShadowViewer.Core" Version="2025.4.14.1" />
65+
<PackageReference Include="ShadowViewer.Core" Version="2025.4.15.7" />
6666
</ItemGroup>
6767
</Project>

ShadowViewer.Plugin.Local/plugin.d.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@
180180
"Nullable": false,
181181
"Item": {
182182
"Type": "System.String",
183-
"Nullable": false
183+
"Nullable": false,
184+
"ConstructionTemplate": "new ShadowPluginLoader.WinUI.Models.PluginDependency(\u0022{{ RAW }}\u0022)"
184185
}
185186
}
186187
}

ShadowViewer.Plugin.Local/plugin.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
"Icon": "fluent://regular/ResizeImage",
1616
"PluginId": "Local"
1717
},
18-
"CoreVersion": "2025.4.14.1",
18+
"CoreVersion": "2025.4.15.7",
1919
"Id": "Local",
2020
"Name": "本地阅读器",
21-
"Version": "1.3.21",
21+
"Version": "1.3.23",
2222
"Dependencies": []
2323
}

0 commit comments

Comments
 (0)