Browse Source

Right click now selects layer

flabbet 4 years ago
parent
commit
f437e2d01c

+ 6 - 0
PixiEditor/ViewModels/SubViewModels/Main/LayersViewModel.cs

@@ -60,6 +60,12 @@ namespace PixiEditor.ViewModels.SubViewModels.Main
         public void SetActiveLayer(object parameter)
         {
             int index = (int)parameter;
+
+            if (Owner.BitmapManager.ActiveDocument.Layers[index].IsActive && Mouse.RightButton == MouseButtonState.Pressed)
+            {
+                return;
+            }
+
             if (Keyboard.IsKeyDown(Key.LeftCtrl))
             {
                 Owner.BitmapManager.ActiveDocument.ToggleLayer(index);

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

@@ -10,12 +10,12 @@
              d:DesignHeight="60" d:DesignWidth="250" Name="uc"
              MouseLeave="LayerItem_OnMouseLeave" MouseEnter="LayerItem_OnMouseEnter">
     <Border BorderThickness="0 0 0 0.5" BorderBrush="Gray" MinWidth="60" Focusable="True"
-            Background="{Binding LayerColor, ElementName=uc}">
+            Background="{Binding LayerColor, ElementName=uc}" >
         <i:Interaction.Behaviors>
             <behaviors:ClearFocusOnClickBehavior/>
         </i:Interaction.Behaviors>
         <i:Interaction.Triggers>
-            <i:EventTrigger EventName="MouseLeftButtonDown">
+            <i:EventTrigger EventName="MouseDown">
                 <i:InvokeCommandAction Command="{Binding ElementName=uc, 
                             Path=SetActiveLayerCommand}"
                                        CommandParameter="{Binding Path=LayerIndex, ElementName=uc}"/>