Browse Source

Fixed color property focus

flabbet 1 year ago
parent
commit
ad87ff67e3

+ 1 - 1
src/PixiEditor.AvaloniaUI/Views/Nodes/Properties/ColorPropertyView.axaml

@@ -11,6 +11,6 @@
                              x:Class="PixiEditor.AvaloniaUI.Views.Nodes.Properties.ColorPropertyView">
     <Grid HorizontalAlignment="{Binding IsInput, Converter={converters:BoolToValueConverter FalseValue='Right', TrueValue='Stretch'}}">
         <TextBlock VerticalAlignment="Center" ui:Translator.Key="{Binding DisplayName}"/>
-        <colorPicker:PortableColorPicker Width="40" Height="20" IsVisible="{Binding IsInput}" SelectedColor="{Binding Value, Mode=TwoWay}" />
+        <colorPicker:PortableColorPicker PointerPressed="InputElement_OnPointerPressed" Width="40" Height="20" IsVisible="{Binding IsInput}" SelectedColor="{Binding Value, Mode=TwoWay}" />
     </Grid>
 </properties:NodePropertyView>

+ 6 - 0
src/PixiEditor.AvaloniaUI/Views/Nodes/Properties/ColorPropertyView.axaml.cs

@@ -1,5 +1,6 @@
 using Avalonia;
 using Avalonia.Controls;
+using Avalonia.Input;
 using Avalonia.Markup.Xaml;
 
 namespace PixiEditor.AvaloniaUI.Views.Nodes.Properties;
@@ -10,5 +11,10 @@ public partial class ColorPropertyView : NodePropertyView
     {
         InitializeComponent();
     }
+
+    private void InputElement_OnPointerPressed(object? sender, PointerPressedEventArgs e)
+    {
+        e.Handled = true;
+    }
 }