Browse Source

Prevented drag drop race condition

flabbet 3 years ago
parent
commit
d34f91ce0b
1 changed files with 5 additions and 4 deletions
  1. 5 4
      PixiEditor/Views/UserControls/Layers/LayersManager.xaml.cs

+ 5 - 4
PixiEditor/Views/UserControls/Layers/LayersManager.xaml.cs

@@ -285,7 +285,8 @@ namespace PixiEditor.Views.UserControls.Layers
 
         private void LayerStructureItemContainer_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
         {
-            if (sender is LayerStructureItemContainer container && e.LeftButton == System.Windows.Input.MouseButtonState.Pressed)
+            if (sender is LayerStructureItemContainer container
+                && e.LeftButton == System.Windows.Input.MouseButtonState.Pressed && !container.Layer.IsRenaming)
             {
                 Dispatcher.InvokeAsync(() => DragDrop.DoDragDrop(container, container, DragDropEffects.Move));
             }
@@ -332,7 +333,8 @@ namespace PixiEditor.Views.UserControls.Layers
 
         private void LayerGroup_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
         {
-            if (sender is LayerGroupControl container && e.LeftButton == System.Windows.Input.MouseButtonState.Pressed)
+            if (sender is LayerGroupControl container && e.LeftButton == System.Windows.Input.MouseButtonState.Pressed
+                && !container.GroupData.IsRenaming)
             {
                 Dispatcher.InvokeAsync(() => DragDrop.DoDragDrop(container, container, DragDropEffects.Move));
             }
@@ -370,7 +372,6 @@ namespace PixiEditor.Views.UserControls.Layers
             }
 
             ShortcutController.UnblockShortcutExecutionAll();
-            MoveFocus(new System.Windows.Input.TraversalRequest(System.Windows.Input.FocusNavigationDirection.Next));
         }
 
         private void HandleLayerOpacityChange(float val, Layer layer)
@@ -462,4 +463,4 @@ namespace PixiEditor.Views.UserControls.Layers
             SelectedItem = sender;
         }
     }
-}
+}