Skip to content

Commit

Permalink
Fix AdvancedImageBox #956
Browse files Browse the repository at this point in the history
  • Loading branch information
sn4k3 committed Dec 19, 2024
1 parent e9b21a0 commit 01f4d42
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions UVtools.AvaloniaControls/AdvancedImageBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1429,20 +1429,20 @@ public override void Render(DrawingContext context)

//SkiaContext.SkCanvas.dr
// Draw pixel grid
if (zoomFactor > PixelGridZoomThreshold && SizeMode == SizeModes.Normal)
if (SizeMode == SizeModes.Normal && zoomFactor > PixelGridZoomThreshold)
{
var offsetX = Offset.X % zoomFactor;
var offsetY = Offset.Y % zoomFactor;

Pen pen = new(PixelGridColor);
for (double x = imageViewPort.X + zoomFactor - offsetX; x < imageViewPort.Right; x += zoomFactor)
{
context.DrawLine(pen, new Point(x, imageViewPort.X), new Point(x, imageViewPort.Bottom));
context.DrawLine(pen, new Point(x, imageViewPort.Y), new Point(x, imageViewPort.Bottom));
}

for (double y = imageViewPort.Y + zoomFactor - offsetY; y < imageViewPort.Bottom; y += zoomFactor)
{
context.DrawLine(pen, new Point(imageViewPort.Y, y), new Point(imageViewPort.Right, y));
context.DrawLine(pen, new Point(imageViewPort.X, y), new Point(imageViewPort.Right, y));
}

context.DrawRectangle(pen, imageViewPort);
Expand Down
2 changes: 1 addition & 1 deletion UVtools.AvaloniaControls/UVtools.AvaloniaControls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- ExtendedNumericUpDown: Initial value with a reset button and value unit label
- IndexSelector: Allow to choose an index from a collection count and display the selected number
- GroupBox: Similar to GroupBox of WinForms, it contain an Header and Content</Description>
<Version>4.0.0</Version>
<Version>4.0.1</Version>

<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/sn4k3/UVtools/tree/master/UVtools.AvaloniaControls</RepositoryUrl>
Expand Down

0 comments on commit 01f4d42

Please sign in to comment.