diff --git a/src/Microsoft.Maui.Graphics/Android/PlatformCanvasState.cs b/src/Microsoft.Maui.Graphics/Android/PlatformCanvasState.cs index 2d21602..9e353db 100644 --- a/src/Microsoft.Maui.Graphics/Android/PlatformCanvasState.cs +++ b/src/Microsoft.Maui.Graphics/Android/PlatformCanvasState.cs @@ -123,14 +123,16 @@ namespace Microsoft.Maui.Graphics.Platform if (scaledStrokeSize == 1) { - StrokePaint.SetPathEffect(new DashPathEffect(pattern, 0)); + StrokePaint.SetPathEffect(new DashPathEffect(pattern, strokeDashOffset)); } else { var scaledPattern = new float[pattern.Length]; for (int i = 0; i < pattern.Length; i++) scaledPattern[i] = pattern[i] * scaledStrokeSize; - StrokePaint.SetPathEffect(new DashPathEffect(scaledPattern, 0)); + + var scaledStrokeDashOffset = strokeDashOffset * scaledStrokeSize; + StrokePaint.SetPathEffect(new DashPathEffect(scaledPattern, scaledStrokeDashOffset)); } } } diff --git a/src/Microsoft.Maui.Graphics/MaciOS/PlatformCanvas.cs b/src/Microsoft.Maui.Graphics/MaciOS/PlatformCanvas.cs index 26b8360..40e38e0 100644 --- a/src/Microsoft.Maui.Graphics/MaciOS/PlatformCanvas.cs +++ b/src/Microsoft.Maui.Graphics/MaciOS/PlatformCanvas.cs @@ -299,7 +299,9 @@ namespace Microsoft.Maui.Graphics.Platform actualDashPattern[i] = strokePattern[i] * actualStrokeSize; } - _context.SetLineDash(0, actualDashPattern, actualDashPattern.Length); + var actualDashOffset = strokeDashOffset * actualStrokeSize; + + _context.SetLineDash(actualDashOffset, actualDashPattern, actualDashPattern.Length); } }