Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

允许默认禁用双指手势 #142

Merged
merged 3 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Ink Canvas/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@
</GroupBox>
<GroupBox Header="手势">
<ui:SimpleStackPanel Spacing="12">
<ui:ToggleSwitch Name="ToggleSwitchDisableLockSmithByDefault" Header="默认启用双指手势" FontFamily="Microsoft YaHei UI" IsOn="True" OnContent="开" OffContent="关" Toggled="ToggleSwitchDisableLockSmithByDefault_Toggled"/>
<ui:ToggleSwitch Name="ToggleSwitchEnableTwoFingerZoom" Header="允许双指缩放" FontFamily="Microsoft YaHei UI" IsOn="True" OnContent="开" OffContent="关" Toggled="ToggleSwitchEnableTwoFingerZoom_Toggled"/>
<ui:ToggleSwitch Name="ToggleSwitchEnableTwoFingerTranslate" Header="允许双指移动" FontFamily="Microsoft YaHei UI" IsOn="True" OnContent="开" OffContent="关" Toggled="ToggleSwitchEnableTwoFingerTranslate_Toggled"/>
<ui:ToggleSwitch Name="ToggleSwitchEnableTwoFingerRotation" Header="允许双指旋转" FontFamily="Microsoft YaHei UI" OnContent="开" OffContent="关" Toggled="ToggleSwitchEnableTwoFingerRotation_Toggled"/>
Expand Down
23 changes: 21 additions & 2 deletions Ink Canvas/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,18 @@ private void LoadSettings(bool isStartup = true)
{
Settings.Gesture = new Gesture();
}
if (Settings.Gesture.IsDisableLockSmithByDefault)
{
ToggleSwitchDisableLockSmithByDefault.IsOn = true;
_lockSmith = false;
LockSmithSymbol.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.Pin;
}
else
{
ToggleSwitchDisableLockSmithByDefault.IsOn = false;
_lockSmith = true;
LockSmithSymbol.Symbol = iNKORE.UI.WPF.Modern.Controls.Symbol.UnPin;
}
if (Settings.Gesture.IsEnableTwoFingerZoom)
{
ToggleSwitchEnableTwoFingerZoom.IsOn = true;
Expand Down Expand Up @@ -3297,8 +3309,15 @@ private void ToggleSwitchEnableFingerGestureSlideShowControl_Toggled(object send
SaveSettingsToFile();
}

private void ToggleSwitchEnableTwoFingerZoom_Toggled(object sender, RoutedEventArgs e)
{
private void ToggleSwitchDisableLockSmithByDefault_Toggled(object sender, RoutedEventArgs e) {
if (!isLoaded) return;

Settings.Gesture.IsDisableLockSmithByDefault = ToggleSwitchDisableLockSmithByDefault.IsOn;

SaveSettingsToFile();
}

private void ToggleSwitchEnableTwoFingerZoom_Toggled(object sender, RoutedEventArgs e) {
if (!isLoaded) return;

Settings.Gesture.IsEnableTwoFingerZoom = ToggleSwitchEnableTwoFingerZoom.IsOn;
Expand Down
2 changes: 2 additions & 0 deletions Ink Canvas/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public class Gesture
{
[JsonIgnore]
public bool IsEnableTwoFingerGesture => IsEnableTwoFingerZoom || IsEnableTwoFingerTranslate || IsEnableTwoFingerRotation;
[JsonProperty("isDisableLockSmithByDefault")]
public bool IsDisableLockSmithByDefault { get; set; } = true;
[JsonProperty("isEnableTwoFingerZoom")]
public bool IsEnableTwoFingerZoom { get; set; } = true;
[JsonProperty("isEnableTwoFingerTranslate")]
Expand Down
Loading