Repository: PixiEditor/PixiEditor
File: PixiEditor/Models/Controllers/BitmapOperationsUtility.cs (C#)

Code before:
                    BitmapChanged?.Invoke(this, new BitmapChangedEventArgs(
                        previewChanges.PixelChanges,
                        oldValue.PixelChanges,
                        previewChanges.LayerGuid));
                }

                Manager.ActiveDocument.GeneratePreviewLayer();
            }

            previewLayerChanges = null;
        }

        private void UseTool(List<Coordinates> mouseMoveCords, BitmapOperationTool tool, Color color)
        {
            if(sizeSetting == null)
            {
                sizeSetting = tool.Toolbar.GetSetting<SizeSetting>("ToolSize");
            }

            int thickness = sizeSetting != null ? sizeSetting.Value : 1;

            bool shiftDown = Keyboard.IsKeyDown(Key.LeftShift);
            var penTool = tool is PenTool;
            if (shiftDown && !penTool)
            {
                Debug.WriteLine("shift in BitmapOperationsUtility");
                bool mouseInLine = MouseCordsNotInLine(mouseMoveCords, thickness);

                if (!mouseInLine)
                {
                    mouseMoveCords = GetSquareCoordiantes(mouseMoveCords);
                }
                else
                {
                    mouseMoveCords = GetLineCoordinates(mouseMoveCords, thickness);
                }
            }

            if (!tool.RequiresPreviewLayer)
            {
                LayerChange[] modifiedLayers = tool.Use(Manager.ActiveLayer, mouseMoveCords, color);
                LayerChange[] oldPixelsValues = new LayerChange[modifiedLayers.Length];
                for (int i = 0; i < modifiedLayers.Length; i++)
                {
                    Layer layer = Manager.ActiveDocument.Layers.First(x => x.LayerGuid == modifiedLayers[i].LayerGuid);
                    oldPixelsValues[i] = ApplyToLayer(layer, modifiedLayers[i]);

                    BitmapChanged?.Invoke(this, new BitmapChangedEventArgs(
                        modifiedLayers[i].PixelChanges,
                        oldPixelsValues[i].PixelChanges,
                        modifiedLayers[i].LayerGuid));

Review comment (bug):
Remove the `Debug.WriteLine`, I wouldn't do it as "if tool is not Pen", but rather "if shifDown && isShapeTool"

Code after:
                        previewChanges.PixelChanges,
                        oldValue.PixelChanges,
                        previewChanges.LayerGuid));
                }

                Manager.ActiveDocument.GeneratePreviewLayer();
            }

            previewLayerChanges = null;
        }

        private void UseTool(List<Coordinates> mouseMoveCords, BitmapOperationTool tool, Color color)
        {
            if(sizeSetting == null)
            {
                sizeSetting = tool.Toolbar.GetSetting<SizeSetting>("ToolSize");
            }

            int thickness = sizeSetting != null ? sizeSetting.Value : 1;

            bool shiftDown = Keyboard.IsKeyDown(Key.LeftShift);
           
            if (shiftDown && tool.UsesShift)
            {
                bool mouseInLine = MouseCordsNotInLine(mouseMoveCords, thickness);

                if (!mouseInLine)
                {
                    mouseMoveCords = GetSquareCoordiantes(mouseMoveCords);
                }
                else
                {
                    mouseMoveCords = GetLineCoordinates(mouseMoveCords, thickness);
                }
            }

            if (!tool.RequiresPreviewLayer)
            {
                LayerChange[] modifiedLayers = tool.Use(Manager.ActiveLayer, mouseMoveCords, color);
                LayerChange[] oldPixelsValues = new LayerChange[modifiedLayers.Length];
                for (int i = 0; i < modifiedLayers.Length; i++)
                {
                    Layer layer = Manager.ActiveDocument.Layers.First(x => x.LayerGuid == modifiedLayers[i].LayerGuid);
                    oldPixelsValues[i] = ApplyToLayer(layer, modifiedLayers[i]);

                    BitmapChanged?.Invoke(this, new BitmapChangedEventArgs(
                        modifiedLayers[i].PixelChanges,
                        oldPixelsValues[i].PixelChanges,
                        modifiedLayers[i].LayerGuid));
                }
            }