Skip to content

Label: Don't draw border when line width is 0#3572

Merged
swharden merged 3 commits intoScottPlot:mainfrom
bwedding:Label-draws-border-if-border-width-is-0-#3538
Apr 3, 2024
Merged

Label: Don't draw border when line width is 0#3572
swharden merged 3 commits intoScottPlot:mainfrom
bwedding:Label-draws-border-if-border-width-is-0-#3538

Conversation

@bwedding
Copy link
Contributor

@bwedding bwedding commented Apr 1, 2024

For issue #3538
In SkiaSharp, setting the StrokeWidth to 0 does not guarantee that no border will be drawn. A StrokeWidth of 0 is interpreted as the thinnest line that can be drawn on the device, which is not the same as not drawing a line at all.

So I just wrapped the code to draw the border with a conditional to only paint it if borderwidth is greater than 0. This works fine on the recipe code when setting BorderWidth = 0;

image

Issue 3538

[ScottPlot.Plot myPlot = new();
if (BorderWidth > 0)
{
    ApplyBorderPaint(paint);
    canvas.DrawRect(backgroundRect.ToSKRect(), paint);
}

@bwedding bwedding changed the title Don't draw Label border when it is 0 # Don't draw Label border when it is 0 #3538 Apr 1, 2024
@swharden swharden linked an issue Apr 3, 2024 that may be closed by this pull request
@swharden
Copy link
Member

swharden commented Apr 3, 2024

Another great fix @bwedding, I'm happy to merge this in and it will be in the next release! 🚀

@swharden swharden changed the title Don't draw Label border when it is 0 #3538 Label: Don't draw border when line width is 0 Apr 3, 2024
@swharden swharden merged commit 0020384 into ScottPlot:main Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Label: draws a border even if border width is 0

2 participants