Browse Source

Fixed pen mode binding

flabbet 2 years ago
parent
commit
5eeee06413

+ 2 - 9
src/PixiEditor/ViewModels/SubViewModels/Main/StylusViewModel.cs

@@ -56,14 +56,7 @@ internal class StylusViewModel : SubViewModel<ViewModelMain>
 
 
     private void UpdateUseTouchGesture()
     private void UpdateUseTouchGesture()
     {
     {
-        if (Owner.ToolsSubViewModel.ActiveTool is not (MoveViewportToolViewModel or ZoomToolViewModel))
-        {
-            UseTouchGestures = IsPenModeEnabled;
-        }
-        else
-        {
-            UseTouchGestures = true;
-        }
+        UseTouchGestures = Owner.ToolsSubViewModel.ActiveTool is MoveViewportToolViewModel or ZoomToolViewModel || IsPenModeEnabled;
     }
     }
 
 
     [Command.Internal("PixiEditor.Stylus.StylusOutOfRange")]
     [Command.Internal("PixiEditor.Stylus.StylusOutOfRange")]
@@ -75,7 +68,7 @@ internal class StylusViewModel : SubViewModel<ViewModelMain>
     [Command.Internal("PixiEditor.Stylus.StylusSystemGesture")]
     [Command.Internal("PixiEditor.Stylus.StylusSystemGesture")]
     public void StylusSystemGesture(StylusSystemGestureEventArgs e)
     public void StylusSystemGesture(StylusSystemGestureEventArgs e)
     {
     {
-        if (e.SystemGesture == SystemGesture.Drag || e.SystemGesture == SystemGesture.Tap)
+        if (e.SystemGesture is SystemGesture.Drag or SystemGesture.Tap)
         {
         {
             return;
             return;
         }
         }

+ 1 - 1
src/PixiEditor/Views/UserControls/Viewport.xaml

@@ -120,7 +120,7 @@
         <zoombox:Zoombox
         <zoombox:Zoombox
             Tag="{Binding ElementName=vpUc}"
             Tag="{Binding ElementName=vpUc}"
             x:Name="zoombox"
             x:Name="zoombox"
-            UseTouchGestures="{Binding UseTouchGestures, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:Viewport}, Mode=OneWayToSource}"
+            UseTouchGestures="{Binding UseTouchGestures, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:Viewport}, Mode=OneWay}"
             Scale="{Binding ZoomboxScale, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:Viewport}, Mode=OneWayToSource}"
             Scale="{Binding ZoomboxScale, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:Viewport}, Mode=OneWayToSource}"
             Center="{Binding Center, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:Viewport}, Mode=OneWayToSource}"
             Center="{Binding Center, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:Viewport}, Mode=OneWayToSource}"
             Angle="{Binding Angle, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:Viewport}, Mode=OneWayToSource}"
             Angle="{Binding Angle, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:Viewport}, Mode=OneWayToSource}"