Browse Source

Improved editable textblock event handling

Krzysztof Krysiński 3 months ago
parent
commit
8b27f665af
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/PixiEditor/Views/Input/EditableTextBlock.axaml.cs

+ 5 - 1
src/PixiEditor/Views/Input/EditableTextBlock.axaml.cs

@@ -113,10 +113,14 @@ internal partial class EditableTextBlock : UserControl
 
     private void TextBox_KeyDown(object sender, KeyEventArgs e)
     {
-        if (e.Key == Key.Enter)
+        if (e.Key is Key.Enter or Key.Escape)
         {
             DisableEditing();
+            e.Handled = true;
+            return;
         }
+
+        e.Handled = e.Key is Key.Left or Key.Right;
     }
 
     private void TextBox_LostFocus(object? sender, RoutedEventArgs routedEventArgs)