Browse Source

Fixed layers drag and drop

Krzysztof Krysiński 1 year ago
parent
commit
202cdf4d14

+ 4 - 2
src/PixiEditor.AvaloniaUI/Views/Layers/FolderControl.axaml

@@ -38,8 +38,8 @@
                 <RowDefinition Height="16"/>
                 <RowDefinition Height="16"/>
                 <RowDefinition Height="10"/>
                 <RowDefinition Height="10"/>
             </Grid.RowDefinitions>
             </Grid.RowDefinitions>
-            <Grid DragDrop.AllowDrop="True" Grid.Row="0" Grid.ColumnSpan="3" Background="Transparent" Panel.ZIndex="3"/>
-            <Grid IsVisible="False" x:Name="middleDropGrid" Grid.Row="1" DragDrop.AllowDrop="True" Panel.ZIndex="2" Background="Transparent"></Grid>
+            <Grid DragDrop.AllowDrop="True" helpers:DragDropEvents.DragEnter="Grid_DragEnter" helpers:DragDropEvents.Drop="Grid_Drop_Top" helpers:DragDropEvents.DragLeave="Grid_DragLeave" Grid.Row="0" Grid.ColumnSpan="3" Background="Transparent" Panel.ZIndex="3"/>
+            <Grid IsVisible="True" x:Name="middleDropGrid" Grid.Row="1" DragDrop.AllowDrop="True" Panel.ZIndex="2" Background="Transparent" helpers:DragDropEvents.DragEnter="Grid_CenterEnter" helpers:DragDropEvents.Drop="Grid_Drop_Center" helpers:DragDropEvents.DragLeave="Grid_CenterLeave"></Grid>
             <Grid x:Name="centerGrid" Grid.Row="0" Grid.RowSpan="3" Background="Transparent">
             <Grid x:Name="centerGrid" Grid.Row="0" Grid.RowSpan="3" Background="Transparent">
                 <Grid.ColumnDefinitions>
                 <Grid.ColumnDefinitions>
                     <ColumnDefinition Width="24"/>
                     <ColumnDefinition Width="24"/>
@@ -127,6 +127,8 @@
             </Grid>
             </Grid>
             <Grid
             <Grid
                   Grid.Row="2"
                   Grid.Row="2"
+                  helpers:DragDropEvents.DragEnter="Grid_DragEnter" helpers:DragDropEvents.Drop="Grid_Drop_Bottom"
+                  helpers:DragDropEvents.DragLeave="Grid_DragLeave"
                   DragDrop.AllowDrop="false"
                   DragDrop.AllowDrop="false"
                   Grid.ColumnSpan="2" Background="Transparent"/>
                   Grid.ColumnSpan="2" Background="Transparent"/>
         </Grid>
         </Grid>

+ 5 - 1
src/PixiEditor.AvaloniaUI/Views/Layers/FolderControl.axaml.cs

@@ -40,7 +40,11 @@ internal partial class FolderControl : UserControl
     public FolderControl()
     public FolderControl()
     {
     {
         InitializeComponent();
         InitializeComponent();
-        highlightColor = (Brush?)App.Current.Resources["SoftSelectedLayerColor"];
+        if (App.Current.TryGetResource("SoftSelectedLayerBrush", App.Current.ActualThemeVariant, out var value))
+        {
+            highlightColor = value as IBrush;
+        }
+
         Loaded += OnLoaded;
         Loaded += OnLoaded;
     }
     }
 
 

+ 18 - 5
src/PixiEditor.AvaloniaUI/Views/Layers/LayerControl.axaml

@@ -136,12 +136,25 @@
                             IsVisible="{Binding Layer.LockTransparencyBindable, ElementName=uc}"/>
                             IsVisible="{Binding Layer.LockTransparencyBindable, ElementName=uc}"/>
                     </WrapPanel>
                     </WrapPanel>
                 </StackPanel>
                 </StackPanel>
-                <Grid Margin="0, 0, 0, -2.5" helpers:DragDropEvents.DragEnter="Grid_DragEnter" VerticalAlignment="Bottom" helpers:DragDropEvents.Drop="Grid_Drop_Below"  helpers:DragDropEvents.DragLeave="Grid_DragLeave" Height="10" Grid.Row="2" Grid.Column="0" DragDrop.AllowDrop="True"  Background="Transparent" Name="dropBelowGrid"/>
-                <Grid Margin="0, 0, 0, -2.5" VerticalAlignment="Bottom" Height="10" Grid.Row="2" Grid.Column="1" Background="{Binding ElementName=dropBelowGrid, Path=Background}"/>
+                <Grid Margin="0, 0, 0, -2.5"
+                      helpers:DragDropEvents.DragEnter="Grid_DragEnter"
+                      VerticalAlignment="Bottom"
+                      helpers:DragDropEvents.Drop="Grid_Drop_Below"
+                      helpers:DragDropEvents.DragLeave="Grid_DragLeave"
+                      Height="10" Grid.Row="2" Grid.Column="0"
+                      DragDrop.AllowDrop="True"  Background="Transparent" Name="dropBelowGrid"/>
+                <Grid Margin="0, 0, 0, -2.5"
+                      VerticalAlignment="Bottom"
+                      Height="10" Grid.Row="2"
+                      Grid.Column="1"
+                      Background="{Binding ElementName=dropBelowGrid, Path=Background}"/>
 
 
-                <Grid Margin="0, 0, 0, -2.5" VerticalAlignment="Bottom" Height="10" Grid.Row="2" Grid.Column="2"
-                      helpers:DragDropEvents.DragEnter="Grid_DragEnter" helpers:DragDropEvents.Drop="Grid_Drop_Bottom" helpers:DragDropEvents.DragLeave="Grid_DragLeave"
-                      DragDrop.AllowDrop="True"  Background="Transparent"/>
+                <Grid Margin="0, 0, 0, -2.5" VerticalAlignment="Bottom"
+                      Height="10" Grid.Row="2" Grid.Column="2"
+                      helpers:DragDropEvents.DragEnter="Grid_DragEnter"
+                      helpers:DragDropEvents.Drop="Grid_Drop_Bottom"
+                      helpers:DragDropEvents.DragLeave="Grid_DragLeave"
+                      DragDrop.AllowDrop="True" Background="Transparent"/>
             </Grid>
             </Grid>
         </Grid>
         </Grid>
         <Border.ContextMenu>
         <Border.ContextMenu>

+ 5 - 1
src/PixiEditor.AvaloniaUI/Views/Layers/LayerControl.axaml.cs

@@ -77,7 +77,11 @@ internal partial class LayerControl : UserControl
     {
     {
         InitializeComponent();
         InitializeComponent();
         Loaded += LayerControl_Loaded;
         Loaded += LayerControl_Loaded;
-        highlightColor = (Brush?)App.Current.Resources["SoftSelectedLayerColor"];
+
+        if (App.Current.TryGetResource("SoftSelectedLayerBrush", App.Current.ActualThemeVariant, out var value))
+        {
+            highlightColor = value as IBrush;
+        }
     }
     }
 
 
     private void LayerControl_Loaded(object sender, RoutedEventArgs e)
     private void LayerControl_Loaded(object sender, RoutedEventArgs e)

+ 0 - 1
src/PixiEditor.AvaloniaUI/Views/Palettes/PaletteViewer.axaml.cs

@@ -260,7 +260,6 @@ internal partial class PaletteViewer : UserControl
                     Colors.Insert(newIndex, paletteColor);
                     Colors.Insert(newIndex, paletteColor);
                     int indexOfSource = Colors.IndexOf(paletteColorControl.Color);
                     int indexOfSource = Colors.IndexOf(paletteColorControl.Color);
                     Colors.Move(indexOfSource, currIndex);
                     Colors.Move(indexOfSource, currIndex);
-                    RefreshAllItems();
                 }
                 }
             }
             }
         }
         }