Rendering Shapes without explicit bounds.#5817
Conversation
|
The fix also fixes other demo scenarios like Polygon, Polyline and Path. |
|
|
||
| protected override Size MeasureOverride(double widthConstraint, double heightConstraint) | ||
| { | ||
| var result = base.MeasureOverride(widthConstraint, heightConstraint); |
There was a problem hiding this comment.
Nice. This is the important part that was missing.
| return result; | ||
| } | ||
|
|
||
| var boundsByFlattening = this.GetPath().Bounds.Size; |
There was a problem hiding this comment.
There was a problem hiding this comment.
if the spiral path scenario is similar to one in repro project for #4044, then I believe the reason for the 0x0 size is that we do not invalidate the Height/Width request for the PolyLine when after replacing its Points. I think we should.
If I do invalidation, then the spiral path renders correctly for me (at least in the repro project):
There was a problem hiding this comment.
As for the ellipse scenario, I think my repro does not have an equivalent. There is a scenario with ellipses, but it is just a few simple fixed sized ellipse shapes and they show just fine.
How can I get the AutoSize Shapes Gallery ?
There was a problem hiding this comment.
There was a problem hiding this comment.
Open the .NET MAUI Gallery and navigate to Controls -> Shapes. Then tap the "More samples" Button and select the "AutoSize Shapes Gallery".
There was a problem hiding this comment.
There were two issues:
GetBoundsByFlatteningwith default0.01flatness produces clearly incorrect results for ellipse curves. Usingflatness == 1temporarily is a workaround, but there is likely a bug inGetBoundsByFlatteningMeasureOverrideon Shape should consider Aspect. That was missing
|
Is this ok to merge? I can't tell if failures on |
|
Running the one another time, but I suspect the last failure is unrelated. |
|
What is the purpose of the pages in the sandbox app? Should we move that to the gallery? |







Description of Change
Bounds of a Shape can be inferred from its shape and specifying that should not be required.
Currently not specifying Height and Width makes lines and other shapes not render.
Issues Fixed
Fixes #4044
Fixes #6204
Fixes #4051