dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.24k stars 1.76k forks source link

Path with ArcSegments is sporadically drawn offset from expected arc #24163

Open crhalvorson opened 3 months ago

crhalvorson commented 3 months ago

Description

When using an ArcSegment to draw an arc in a PathFigure / PathGeometry, especially a large (size) and >180 arc, it occasionally appears to slightly offset the arc from its actual starting position. This can cause it to clip against its bounds and is especially noticeable if it is overlaid on another (correctly drawn) arc. This occurs on Windows, Android and iOS.

I haven't found a particular pattern that triggers this rendering issue, although it does seem more frequent when the arc is near the 180 degree threshold. It also seems more frequent the larger the StrokeThickness used to draw the arc.

I have attempted a workaround by using multiple smaller arcs or even linking LineSegments to form an arc on my own. Multiple smaller arcs still caused the issue to occur. While the line segment approach yielded better behavior I still periodically saw the issue when animating.

Screenshot from the repro app linked below: image

Steps to Reproduce

  1. Create a new .NET Maui app
  2. Define a Path
  3. Draw an arc to a specified endpoint
  4. Update the path to be smaller, but along the same arc (i.e. calculate a new starting position that should be along the originally drawn arc)
  5. Observe that some updates cause the arc to be offset from the expected path
  6. Expectation is that given a starting ArcSegment, shrinking it by setting a StartPoint along the same arc (adjusting only the IsLargeArc parameter) should result in following the same arc path.

See reproduction project, which defines an arc and allows you to tap a button to progress it along a path that reduces its size. When the Advance button is tapped it tracks the StartPoints that have been given to the ArcSegment, so you can see the arc path that is expected as well as the actually drawn arc.

Checking the Animate box will make updates start a one-second animation in which you can also observe the same flickering.

Link to public reproduction project repository

https://github.com/crhalvorson/MauiArcSegmentRepro

Version with bug

8.0.80 SR8

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

iOS, Android, Windows

Affected platform versions

No response

Did you find any workaround?

Drawing the arc manually using LineSegments (similar to how the sample app draws the HistoryPath) reduced incidence but did not completely resolve the issue when animating.

Relevant log output

No response

github-actions[bot] commented 3 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

ninachen03 commented 3 months ago

I can repro this issue on the latest 17.11.0 Preview 7.0 (8.0.80 & 8.0.3).