Kaynağa Gözat

Folder indexes wip

flabbet 4 yıl önce
ebeveyn
işleme
6733b708ff

+ 0 - 5
PixiEditor/Helpers/Converters/LayersToStructuredLayersConverter.cs

@@ -22,11 +22,6 @@ namespace PixiEditor.Helpers.Converters
 
         public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
         {
-            if (value is ObservableCollection<object> tree)
-            {
-
-            }
-
             throw new ArgumentException("Value is not a StructuredLayerTree");
         }
     }

+ 12 - 0
PixiEditor/Models/Layers/GuidStructureItem.cs

@@ -37,6 +37,18 @@ namespace PixiEditor.Models.Layers
             }
         }
 
+        private int folderDisplayIndex;
+
+        public int FolderDisplayIndex
+        {
+            get => folderDisplayIndex;
+            set
+            {
+                folderDisplayIndex = value;
+                RaisePropertyChanged(nameof(FolderDisplayIndex));
+            }
+        }
+
         public GuidStructureItem(string name, IEnumerable<Guid> children, IEnumerable<GuidStructureItem> subfolders)
         {
             Name = name;

+ 1 - 1
PixiEditor/Views/UserControls/LayerFolder.xaml

@@ -17,7 +17,7 @@
                 <RowDefinition Height="7.5"/>
             </Grid.RowDefinitions>
             <Grid AllowDrop="True" DragEnter="Grid_DragEnter" Drop="Grid_Drop_Top" DragLeave="Grid_DragLeave" Grid.Row="0" Grid.ColumnSpan="3" Background="Transparent"/>
-            <Grid Grid.Row="1" Drop="Grid_Drop_Middle" DragEnter="Grid_DragEnter" DragLeave="Grid_DragLeave">
+            <Grid Grid.Row="1" Drop="Grid_Drop_Middle" AllowDrop="True" DragEnter="Grid_DragEnter" DragLeave="Grid_DragLeave">
                 <Grid.ColumnDefinitions>
                     <ColumnDefinition Width="30"/>
                     <ColumnDefinition Width="1*"/>

+ 11 - 0
PixiEditor/Views/UserControls/LayerFolder.xaml.cs

@@ -49,12 +49,16 @@ namespace PixiEditor.Views.UserControls
 
         private void Grid_DragEnter(object sender, DragEventArgs e)
         {
+            Grid item = sender as Grid;
 
+            item.Background = LayerItem.HighlightColor;
         }
 
         private void Grid_DragLeave(object sender, DragEventArgs e)
         {
+            Grid grid = (Grid)sender;
 
+            LayerItem.RemoveDragEffect(grid);
         }
 
         private void Grid_Drop_Top(object sender, DragEventArgs e)
@@ -69,7 +73,14 @@ namespace PixiEditor.Views.UserControls
 
         private void Grid_Drop_Middle(object sender, DragEventArgs e)
         {
+            Grid grid = (Grid)sender;
 
+            LayerItem.RemoveDragEffect(grid);
+
+            if (e.Data.GetDataPresent("PixiEditor.Views.UserControls.LayerStructureItemContainer"))
+            {
+
+            }
         }
 
         private void FolderControl_MouseMove(object sender, MouseEventArgs e)

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

@@ -125,6 +125,11 @@ namespace PixiEditor.Views
             set { SetValue(MoveToFrontCommandProperty, value); }
         }
 
+        public static void RemoveDragEffect(Grid grid)
+        {
+            grid.Background = Brushes.Transparent;
+        }
+
         private void LayerItem_OnMouseEnter(object sender, MouseEventArgs e)
         {
             ControlButtonsVisible = Visibility.Visible;
@@ -136,11 +141,6 @@ namespace PixiEditor.Views
 
         }
 
-        private void RemoveDragEffect(Grid grid)
-        {
-            grid.Background = Brushes.Transparent;
-        }
-
         private void Grid_DragEnter(object sender, DragEventArgs e)
         {
             Grid item = sender as Grid;
@@ -165,16 +165,6 @@ namespace PixiEditor.Views
                 var data = (LayerStructureItemContainer)e.Data.GetData("PixiEditor.Views.UserControls.LayerStructureItemContainer");
                 Guid layer = data.Layer.LayerGuid;
 
-                //var folder = data.LayerCommandsViewModel.Owner.BitmapManager.ActiveDocument.LayerStructure.GetFolderByLayer(
-                //    data.LayerCommandsViewModel.Owner.BitmapManager.ActiveDocument.Layers[LayerIndex + moveBy].LayerGuid);
-
-                //Guid? folderGuid = null;
-
-                //if (folder != null)
-                //{
-                //    folderGuid = folder.FolderGuid;
-                //}
-
                 data.LayerCommandsViewModel.Owner.BitmapManager.ActiveDocument.MoveLayerInStructure(layer, LayerGuid, above);
             }
         }