Sfoglia il codice sorgente

Removed debug layer outline and moved addswatch to bitmapchanged

flabbet 5 anni fa
parent
commit
4ead6c5d88

+ 13 - 0
PixiEditor/Models/Controllers/BitmapManager.cs

@@ -190,7 +190,20 @@ namespace PixiEditor.Models.Controllers
             return BitmapUtils.CombineLayers(ActiveDocument.Layers.ToArray());
         }
 
+        /// <summary>
+        ///     Returns if selected tool is BitmapOperationTool
+        /// </summary>
+        /// <returns></returns>
+        public bool IsOperationTool()
+        {
+            return SelectedTool is BitmapOperationTool;
+        }
 
+        /// <summary>
+        ///     Returns if tool is BitmapOperationTool
+        /// </summary>
+        /// <param name="tool"></param>
+        /// <returns></returns>
         public static bool IsOperationTool(Tool tool)
         {
             return tool is BitmapOperationTool;

+ 2 - 1
PixiEditor/ViewModels/ViewModelMain.cs

@@ -518,6 +518,8 @@ namespace PixiEditor.ViewModels
             ChangesController.AddChanges(new LayerChange(e.PixelsChanged, e.ChangedLayerIndex),
                 new LayerChange(e.OldPixelsValues, e.ChangedLayerIndex));
             _unsavedDocumentModified = true;
+            if (BitmapManager.IsOperationTool())
+                AddSwatch(PrimaryColor);
         }
 
         public void SwapColors(object parameter)
@@ -602,7 +604,6 @@ namespace PixiEditor.ViewModels
                 {
                     BitmapManager.MouseController.StartRecordingMouseMovementChanges();
                     BitmapManager.MouseController.RecordMouseMovementChange(MousePositionConverter.CurrentCoordinates);
-                    AddSwatch(PrimaryColor);
                 }
         }
 

+ 2 - 4
PixiEditor/Views/MainWindow.xaml

@@ -182,12 +182,10 @@
                                 </ItemsControl.ItemsPanel>
                                 <ItemsControl.ItemTemplate>
                                     <DataTemplate>
-                                        <Border VerticalAlignment="Top" HorizontalAlignment="Left" Width="{Binding Width}" Height="{Binding Height}" Margin="{Binding Offset}"  BorderThickness="0.1" BorderBrush="DodgerBlue">
-                                        <Image Source="{Binding LayerBitmap}"
+                                        <Image VerticalAlignment="Top" HorizontalAlignment="Left" Source="{Binding LayerBitmap}"
                                                Visibility="{Binding IsVisible, Converter={StaticResource BoolToVisibilityConverter}}"
                                                RenderOptions.BitmapScalingMode="NearestNeighbor" Stretch="Uniform"
-                                               Width="{Binding Width}" Height="{Binding Height}" />
-                                        </Border>
+                                               Width="{Binding Width}" Height="{Binding Height}" Margin="{Binding Offset}" />
                                     </DataTemplate>
                                 </ItemsControl.ItemTemplate>
                             </ItemsControl>