Browse Source

Fixed color picker tool mouse move and layer opacity not updating value

flabbet 4 years ago
parent
commit
372e730e1e

+ 4 - 1
PixiEditor/Models/Tools/Tools/ColorPickerTool.cs

@@ -21,7 +21,10 @@ namespace PixiEditor.Models.Tools.Tools
             ViewModelMain.Current.ColorsSubViewModel.PrimaryColor = GetColorUnderMouse();
             ViewModelMain.Current.ColorsSubViewModel.PrimaryColor = GetColorUnderMouse();
         }
         }
 
 
-        public override void Use(Coordinates[] coordinates) { }
+        public override void Use(Coordinates[] coordinates)
+        {
+            ViewModelMain.Current.ColorsSubViewModel.PrimaryColor = GetColorUnderMouse();
+        }
 
 
         public Color GetColorUnderMouse()
         public Color GetColorUnderMouse()
         {
         {

+ 5 - 5
PixiEditor/Views/UserControls/LayerItem.xaml

@@ -12,8 +12,11 @@
     <UserControl.Resources>
     <UserControl.Resources>
         <converters:BoolToColorConverter x:Key="BoolToColorConverter" />
         <converters:BoolToColorConverter x:Key="BoolToColorConverter" />
     </UserControl.Resources>
     </UserControl.Resources>
-    <Border BorderThickness="0 0 0 0.5" BorderBrush="Gray" MinWidth="60"
+    <Border BorderThickness="0 0 0 0.5" BorderBrush="Gray" MinWidth="60" Focusable="True"
             Background="{Binding IsActive, Mode=TwoWay, Converter={StaticResource BoolToColorConverter}}">
             Background="{Binding IsActive, Mode=TwoWay, Converter={StaticResource BoolToColorConverter}}">
+        <i:Interaction.Behaviors>
+            <behaviors:ClearFocusOnClickBehavior/>
+        </i:Interaction.Behaviors>
         <i:Interaction.Triggers>
         <i:Interaction.Triggers>
             <i:EventTrigger EventName="MouseDown">
             <i:EventTrigger EventName="MouseDown">
                 <i:InvokeCommandAction Command="{Binding ElementName=uc, 
                 <i:InvokeCommandAction Command="{Binding ElementName=uc, 
@@ -21,15 +24,12 @@
                                        CommandParameter="{Binding Path=LayerIndex, ElementName=uc}"/>
                                        CommandParameter="{Binding Path=LayerIndex, ElementName=uc}"/>
             </i:EventTrigger>
             </i:EventTrigger>
         </i:Interaction.Triggers>
         </i:Interaction.Triggers>
-        <Grid Focusable="True">
+        <Grid>
             <Grid.ColumnDefinitions>
             <Grid.ColumnDefinitions>
                 <ColumnDefinition Width="30"/>
                 <ColumnDefinition Width="30"/>
                 <ColumnDefinition Width="199*"/>
                 <ColumnDefinition Width="199*"/>
                 <ColumnDefinition Width="20"/>
                 <ColumnDefinition Width="20"/>
             </Grid.ColumnDefinitions>
             </Grid.ColumnDefinitions>
-            <i:Interaction.Behaviors>
-                <behaviors:ClearFocusOnClickBehavior/>
-            </i:Interaction.Behaviors>
             <CheckBox Style="{StaticResource ImageCheckBox}" VerticalAlignment="Center"
             <CheckBox Style="{StaticResource ImageCheckBox}" VerticalAlignment="Center"
                       IsThreeState="False" HorizontalAlignment="Center" 
                       IsThreeState="False" HorizontalAlignment="Center" 
                       IsChecked="{Binding Path=IsVisibleUndoTriggerable, Mode=TwoWay}" Grid.Column="0" Height="16" />
                       IsChecked="{Binding Path=IsVisibleUndoTriggerable, Mode=TwoWay}" Grid.Column="0" Height="16" />