Skip to content

Commit

Permalink
允许默认禁用双指手势 (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
clover-yan authored Jul 18, 2024
1 parent efb2181 commit e481b84
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
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 @@ -927,6 +927,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 @@ -3317,8 +3329,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

0 comments on commit e481b84

Please sign in to comment.