Add finger optimization for PowerPoint mode

This commit is contained in:
XY Wang 2021-12-01 00:43:37 +08:00
parent 9ed5eb203e
commit 973323fde3
5 changed files with 55 additions and 26 deletions

View File

@ -6,7 +6,7 @@
xmlns:local="clr-namespace:Ink_Canvas" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" ShowInTaskbar="False"
xmlns:ui="http://schemas.modernwpf.com/2019" FontFamily="Microsoft YaHei UI" Topmost="True"
mc:Ignorable="d" ui:WindowHelper.UseModernWindowStyle="True" Loaded="Window_Loaded" Closed="Window_Closed"
Title="" Height="400" Width="600">
Title="" Height="430" Width="600">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
@ -38,7 +38,7 @@
</Grid>
<ui:SimpleStackPanel VerticalAlignment="Bottom" Grid.Row="2" Margin="50,0">
<TextBlock Text="更新日志" FontSize="18" FontWeight="Bold" Margin="0,10,0,0"/>
<TextBlock Text="黑板模式支持多指书写(进入黑板后点击左下角“多人书写”图标)" TextWrapping="Wrap" FontSize="14" Margin="25,5,0,0"/>
<TextBlock Text="添加并默认启用“开启画板时使用手指手势进行幻灯片翻页”(启用后,在幻灯片放映模式下,当画板无墨迹时,使用手指(笔尖或手掌无法识别)左右滑动即可控制幻灯片翻页。)" TextWrapping="Wrap" FontSize="14" Margin="25,5,0,0"/>
<TextBlock Text="建议" FontSize="18" FontWeight="Bold" Margin="0,10,0,0"/>
<TextBlock Text="建议配置屏幕为3840×2160 (缩放: 250%)或1920×1080 (缩放: 125%),以获得最佳体验。" TextWrapping="Wrap" FontSize="14" Margin="25,5,-10,0"/>
</ui:SimpleStackPanel>

View File

@ -6,7 +6,7 @@
xmlns:local="clr-namespace:Ink_Canvas" xmlns:ui="http://schemas.modernwpf.com/2019"
AllowsTransparency="True" WindowStyle="None" ResizeMode="NoResize"
mc:Ignorable="d" WindowState="Maximized" Loaded="Window_Loaded" Background="Transparent" ShowInTaskbar="False"
Title="Ink Canvas 画板" Height="1000" Width="1000" FontFamily="Microsoft YaHei UI"
Title="Ink Canvas 画板" Height="10000" Width="1000" FontFamily="Microsoft YaHei UI"
Foreground="Black" Stylus.IsPressAndHoldEnabled="False">
<!--资源中添加命令-->
<Window.Resources>
@ -267,6 +267,8 @@
<ui:SimpleStackPanel Spacing="12">
<ui:ToggleSwitch Name="ToggleSwitchEnableTwoFingerRotation" Header="允许双指旋转" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchEnableTwoFingerRotation_Toggled"/>
<ui:ToggleSwitch Name="ToggleSwitchEnableTwoFingerGestureInPresentationMode" Header="允许幻灯片模式下的双指手势" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchEnableTwoFingerGestureInPresentationMode_Toggled"/>
<TextBlock Text="允许开启画板时使用手指手势进行幻灯片翻页(启用后,在幻灯片放映模式下,当画板无墨迹时,使用手指(笔尖或手掌无法识别)左右滑动即可控制幻灯片翻页。)" TextWrapping="Wrap" Foreground="#666666"/>
<ui:ToggleSwitch Name="ToggleSwitchEnableFingerGestureSlideShowControl" Header="允许使用手指手势进行幻灯片翻页" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" IsOn="True" Toggled="ToggleSwitchEnableFingerGestureSlideShowControl_Toggled"/>
</ui:SimpleStackPanel>
</GroupBox>
<GroupBox Header="墨迹识别 (Beta)">

View File

@ -164,13 +164,12 @@ namespace Ink_Canvas
private void InkCanvas_Gesture(object sender, InkCanvasGestureEventArgs e)
{
ReadOnlyCollection<GestureRecognitionResult> gestures = e.GetGestureRecognitionResults();
try
{
foreach (GestureRecognitionResult gest in gestures)
{
//Trace.WriteLine(string.Format("Gesture: {0}, Confidence: {1}", gest.ApplicationGesture, gest.RecognitionConfidence));
if ((DateTime.Now - lastGestureTime).TotalMilliseconds <= 1500 &&
StackPanelPPTControls.Visibility == Visibility.Visible &&
lastApplicationGesture == gest.ApplicationGesture)
if (StackPanelPPTControls.Visibility == Visibility.Visible)
{
if (gest.ApplicationGesture == ApplicationGesture.Left)
{
@ -178,15 +177,12 @@ namespace Ink_Canvas
}
if (gest.ApplicationGesture == ApplicationGesture.Right)
{
BtnPPTSlidesDown_Click(BtnPPTSlidesDown, null);
BtnPPTSlidesUp_Click(BtnPPTSlidesUp, null);
}
}
lastApplicationGesture = gest.ApplicationGesture;
lastGestureTime = DateTime.Now;
}
inkCanvas.Strokes.Add(e.Strokes);
}
catch { }
}
private void inkCanvas_EditingModeChanged(object sender, RoutedEventArgs e)
{
@ -524,6 +520,14 @@ namespace Ink_Canvas
{
ToggleSwitchEnableTwoFingerGestureInPresentationMode.IsOn = false;
}
if (Settings.Gesture.IsEnableFingerGestureSlideShowControl)
{
ToggleSwitchEnableFingerGestureSlideShowControl.IsOn = true;
}
else
{
ToggleSwitchEnableFingerGestureSlideShowControl.IsOn = false;
}
if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\InkCanvas" + ".lnk"))
{
@ -1358,6 +1362,7 @@ namespace Ink_Canvas
BorderClearInDelete.Visibility = Visibility.Collapsed;
iniP = e.GetTouchPoint(inkCanvas).Position;
inkCanvas.Opacity = 1;
double boundsWidth = GetTouchBoundWidth(e);
if (boundsWidth > BoundsWidth)
@ -1370,6 +1375,14 @@ namespace Ink_Canvas
inkCanvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
}
else
{
if (StackPanelPPTControls.Visibility == Visibility.Visible && inkCanvas.Strokes.Count == 0 && Settings.Gesture.IsEnableFingerGestureSlideShowControl)
{
isLastTouchEraser = false;
inkCanvas.EditingMode = InkCanvasEditingMode.GestureOnly;
inkCanvas.Opacity = 0.1;
}
else
{
inkCanvas.EraserShape = new EllipseStylusShape(5, 5);
//inkCanvas.EraserShape = new RectangleStylusShape(8, 8);
@ -1377,6 +1390,7 @@ namespace Ink_Canvas
inkCanvas.EditingMode = InkCanvasEditingMode.EraseByStroke;
}
}
}
else
{
isLastTouchEraser = false;
@ -2267,6 +2281,16 @@ namespace Ink_Canvas
#region Gesture
private void ToggleSwitchEnableFingerGestureSlideShowControl_Toggled(object sender, RoutedEventArgs e)
{
if (!isLoaded) return;
Settings.Gesture.IsEnableFingerGestureSlideShowControl = ToggleSwitchEnableFingerGestureSlideShowControl.IsOn;
SaveSettingsToFile();
}
private void ToggleSwitchEnableTwoFingerRotation_Toggled(object sender, RoutedEventArgs e)
{
if (!isLoaded) return;
@ -3055,6 +3079,7 @@ namespace Ink_Canvas
{
try
{
inkCanvas.Opacity = 1;
if (Settings.InkToShape.IsInkToShapeEnabled)
{
try

View File

@ -51,5 +51,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.0.1.0")]
[assembly: AssemblyFileVersion("3.0.1.0")]
[assembly: AssemblyVersion("3.0.2.0")]
[assembly: AssemblyFileVersion("3.0.2.0")]

View File

@ -51,6 +51,8 @@ namespace Ink_Canvas
public bool IsEnableTwoFingerRotation { get; set; } = false;
[JsonProperty("isEnableTwoFingerGestureInPresentationMode")]
public bool IsEnableTwoFingerGestureInPresentationMode { get; set; } = false;
[JsonProperty("isEnableFingerGestureSlideShowControl")]
public bool IsEnableFingerGestureSlideShowControl { get; set; } = true;
}
public class Startup