unoplatform / uno

Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!!
https://platform.uno
Apache License 2.0
8.95k stars 726 forks source link

[Skia] Polyline shape is not displaying properly in `Stretch.None` mode when using negative coordinates #10651

Open jeromelaban opened 1 year ago

jeromelaban commented 1 year ago

Originally posted by @ToddGlodek in https://github.com/unoplatform/uno/discussions/10638

The goal is to build a charting control where the collection of vertices can be updated dynamically in a ViewModel. The chart reacts to the ViewModel change - and rebuilds the Points collection of a PolyLine by inverting the Y-axis of each of the vertices so that the origin is in the lower-left (rather than upper-left). Rescalling the size of the window - must result in the control being redrawn adaptively/fluidly to maintain the same Y-scale proportions - while allowing the X-scale to expand & contract.

This can be done using WinUI - but was WASM does not render the PolyLine when Points collection is changed dynamically. Here a PolyLine with dynamically modified Points collection (Pink) is on WinUI - but not WASM. Observe how the static line where the points collection is never changes (green) renders on both WinUI/WASM.

PolylineIssue

Repro: https://github.com/unoplatform/uno/files/10167614/PolyLinePanelWasmTest-master.zip

jeromelaban commented 1 year ago

@ToddGlodek Thanks for the report. Could you attach the contents of the repository as a zip file? The repository is not public.

ToddGlodek commented 1 year ago

The repository is now PUBLIC.

jeromelaban commented 1 year ago

The repository is now PUBLIC.

@ToddGlodek I'm still not seeing it, but it's best if you attach a zip file of the sample here anyways.

ToddGlodek commented 1 year ago

PolyLinePanelWasmTest-master.zip

jeromelaban commented 1 year ago

Thanks for the repro.

There are multiple issues here, but the first one is about https://github.com/unoplatform/uno/issues/3519, as the Loaded event is raised differently than WinUI, causing the children list of your panel to be cleared of ellipses. You may want to avoid manipulating the Children this way in your sample, which prevents your dots from appearing.

Second, the dynamicLine seems to be measured incorrectly as it has a DesiredSize of 150x0, causing it to not appear. There are no known workaround for this yet.

On a side note, you can use .OfType<Ellipse>() instead of .Where(c => c.GetType() == typeof(Ellipse)).Cast<Ellipse>() :)

jeromelaban commented 1 year ago

So there are a few issues that I found during today's stream (https://www.youtube.com/watch?v=QkMXaBAcEd8).

YouTube
Uno Platform Live Coding: Looking Polyline measure and Resource Dictionary events
Powered by Restream https://restream.ioEvery Tuesday, come join me to take a look at what's new in Uno Platform, and dive into fixing some open issues.
ToddGlodek commented 1 year ago

Thanks for taking the time to do a deep-dive into the sample/test project. I shared the YouTube video with the people who are funding the project. Unfortunately, the consensus is that there is just too much that wasn’t yet implemented in Uno or that requires special work-arounds for our project funding to be continued at the current level going into 2023.

Until these items are fixed, I think every project that attempts to use Uno is going to hit the same sequence of pot-holes until they run out of budget and conclude that it isn’t a cost effective architecture. It would be an enormous help to all the new teams looking into Uno to become aware of these issues. Adding a description of the [EPIC] Controls initialization sequencehttps://github.com/unoplatform/uno/issues/3519 & its impact on ActualSize to the Welcome to Uno Platform! / Common Issueshttps://platform.uno/docs/articles/get-started-wizard.html documentation would really valuable to anybody just getting started.

Youssef1313 commented 1 year ago

There's an issue with the bounds computation of the shape when the Stretch is None. I'll rename this issue to reflect this particular behavior, and we'll close it when fixed.

This specific point might get fixed with https://github.com/unoplatform/uno/pull/13359