소스 검색

Fixed not being able to operate timeline stuff with digital pen

Krzysztof Krysiński 4 달 전
부모
커밋
df7889fa1e
3개의 변경된 파일15개의 추가작업 그리고 10개의 파일을 삭제
  1. 2 2
      src/PixiEditor/Styles/Templates/KeyFrame.axaml
  2. 3 2
      src/PixiEditor/Views/Animations/KeyFrame.cs
  3. 10 6
      src/PixiEditor/Views/Animations/Timeline.cs

+ 2 - 2
src/PixiEditor/Styles/Templates/KeyFrame.axaml

@@ -15,10 +15,10 @@
                             Background="{DynamicResource ThemeBackgroundBrush1}" Margin="0 15"
                             BorderBrush="{DynamicResource ThemeBorderMidBrush}" BorderThickness="1">
                         <Grid>
-                            <Panel HorizontalAlignment="Right" Name="PART_ResizePanelRight" Width="5"
+                            <Panel HorizontalAlignment="Right" Name="PART_ResizePanelRight" Width="15"
                                    Cursor="SizeWestEast" Background="Transparent" ZIndex="1" />
                             <Panel Margin="-35, 0, 0, 0" HorizontalAlignment="Left" Name="PART_ResizePanelLeft"
-                                   Width="5" Cursor="SizeWestEast" Background="Transparent" ZIndex="1" />
+                                   Width="15" Cursor="SizeWestEast" Background="Transparent" ZIndex="1" />
                         </Grid>
                     </Border>
 

+ 3 - 2
src/PixiEditor/Views/Animations/KeyFrame.cs

@@ -109,7 +109,8 @@ internal class KeyFrame : TemplatedControl
         {
             return;
         }
-        
+
+        e.PreventGestureRecognition();
         e.Pointer.Capture(sender as IInputElement);
         e.Handled = true;
     }
@@ -146,7 +147,7 @@ internal class KeyFrame : TemplatedControl
             }
             
             int oldStartFrame = Item.StartFrameBindable;
-            Item.ChangeFrameLength(frame, Item.DurationBindable + oldStartFrame - frame + 1);
+            Item.ChangeFrameLength(frame, Item.DurationBindable + oldStartFrame - frame);
         }
         
         e.Handled = true;

+ 10 - 6
src/PixiEditor/Views/Animations/Timeline.cs

@@ -378,6 +378,7 @@ internal class Timeline : TemplatedControl, INotifyPropertyChanged
 
     private void KeyFramePressed(PointerPressedEventArgs? e)
     {
+        e.PreventGestureRecognition(); // Prevents digital pen losing capture when dragging
         shouldShiftSelect = e.KeyModifiers.HasFlag(KeyModifiers.Shift);
         shouldClearNextSelection = !shouldShiftSelect && !e.KeyModifiers.HasFlag(KeyModifiers.Control);
         KeyFrame target = null;
@@ -473,7 +474,6 @@ internal class Timeline : TemplatedControl, INotifyPropertyChanged
             () =>
             {
                 newOffsetX = Math.Clamp(newOffsetX, 0, _timelineKeyFramesScroll.ScrollBarMaximum.X);
-
                 ScrollOffset = new Vector(newOffsetX, 0);
             }, DispatcherPriority.Render);
 
@@ -488,14 +488,16 @@ internal class Timeline : TemplatedControl, INotifyPropertyChanged
         }
 
         var mouseButton = e.GetMouseButton(content);
+        e.PreventGestureRecognition();
 
-        if (mouseButton == MouseButton.Left)
+        if (mouseButton == MouseButton.Left && !e.KeyModifiers.HasFlag(KeyModifiers.Control))
         {
             _selectionRectangle.IsVisible = true;
             _selectionRectangle.Width = 0;
             _selectionRectangle.Height = 0;
         }
-        else if (mouseButton == MouseButton.Middle)
+        else if (mouseButton == MouseButton.Middle ||
+                 (mouseButton == MouseButton.Left && e.KeyModifiers.HasFlag(KeyModifiers.Control)))
         {
             Cursor = new Cursor(StandardCursorType.SizeAll);
             e.Pointer.Capture(content);
@@ -517,11 +519,13 @@ internal class Timeline : TemplatedControl, INotifyPropertyChanged
             return;
         }
 
-        if (e.GetCurrentPoint(content).Properties.IsLeftButtonPressed)
+        if (e.GetCurrentPoint(content).Properties.IsLeftButtonPressed && !e.KeyModifiers.HasFlag(KeyModifiers.Control))
         {
             HandleMoveSelection(e, content);
         }
-        else if (e.GetCurrentPoint(content).Properties.IsMiddleButtonPressed)
+        else if (e.GetCurrentPoint(content).Properties.IsMiddleButtonPressed ||
+                 (e.GetCurrentPoint(content).Properties.IsLeftButtonPressed &&
+                  e.KeyModifiers.HasFlag(KeyModifiers.Control)))
         {
             HandleTimelinePan(e, content);
         }
@@ -563,7 +567,7 @@ internal class Timeline : TemplatedControl, INotifyPropertyChanged
             var translated = frame.TranslatePoint(new Point(0, 0), _contentGrid);
             Rect frameBounds = new Rect(translated.Value.X, translated.Value.Y, frame.Bounds.Width,
                 frame.Bounds.Height);
-            if (bounds.Contains(frameBounds))
+            if (bounds.Intersects(frameBounds))
             {
                 SelectKeyFrame(frame.Item, false);
             }