Skip to content

Commit

Permalink
Some highlight changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Equbuxu committed Oct 14, 2021
1 parent c1c3031 commit 03a99cb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion PixiEditor/Models/Controllers/BitmapManager.cs
Expand Up @@ -12,6 +12,7 @@
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Windows;
using System.Windows.Input;

namespace PixiEditor.Models.Controllers
Expand Down Expand Up @@ -234,7 +235,7 @@ private void HighlightPixels(Coordinates newPosition)
return;
}

if (ToolSize != previewLayerSize)
if (ToolSize != previewLayerSize || ActiveDocument.PreviewLayer.IsCleared)
{
cachedHighlight = CoordinatesCalculator.RectangleToCoordinates(
CoordinatesCalculator.CalculateThicknessCenter(newPosition, ToolSize));
Expand All @@ -244,10 +245,13 @@ private void HighlightPixels(Coordinates newPosition)

cachedPixels = BitmapPixelChanges.FromSingleColoredArray(cachedHighlight, new SKColor(0, 0, 0, 77));

if (!ActiveDocument.PreviewLayer.IsCleared)
ActiveDocument.PreviewLayer.Clear();
ActiveDocument.PreviewLayer.SetPixels(cachedPixels);
}

Coordinates start = newPosition - halfSize;
ActiveDocument.PreviewLayer.Offset = new Thickness(start.X, start.Y, 0, 0);

if (!IsInsideBounds(cachedHighlight))
{
Expand Down

0 comments on commit 03a99cb

Please sign in to comment.