-
Notifications
You must be signed in to change notification settings - Fork 463
Conversation
df1ff8c
to
5601a80
Compare
/// <summary> | ||
/// Get smoothed path. | ||
/// </summary> | ||
public static ObservableCollection<Point> SmoothedPathWithGranularity(this ObservableCollection<Point> currentPoints, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extracted from iOS and applied smoothed path to all platforms
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will change something in the final result for the user? If so, we can't do this here.
And I'm not saying in the code point of view, but in how that will look in the application visually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is not about the new functionality. it is closer to a bug (especially for Android) if line smooth enabled.
This functionality worked only on iOS. But expected to work on all platforms.
You can compare the current version with the main branch. most likely you won't see the difference
@@ -78,7 +78,7 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE | |||
} | |||
} | |||
|
|||
void OnLinesCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) => LoadPoints(surface!); | |||
void OnLinesCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) => LoadPoints(surface); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix nullable
@@ -49,6 +50,7 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE | |||
|
|||
public override void TouchesBegan(NSSet touches, UIEvent? evt) | |||
{ | |||
DetectScrollViews(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get scrollview parent renderers only once
|
||
void LoadPoints() | ||
{ | ||
currentPath.RemoveAllPoints(); | ||
foreach (var line in Element.Lines) | ||
{ | ||
UpdatePath(line); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the root cause of the issue. infinite smoothing the path with updating all points. now points are not changed. only visual picture is smoothed
@@ -31,7 +30,9 @@ protected override void OnElementChanged(ElementChangedEventArgs<DrawingView> e) | |||
if (Element != null) | |||
{ | |||
WantsLayer = true; | |||
Layer!.BackgroundColor = Element.BackgroundColor.ToCGColor(); | |||
if (Layer is not null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix nullable
src/CommunityToolkit/Xamarin.CommunityToolkit/Views/DrawingView/Extensions/Extensions.shared.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit/Xamarin.CommunityToolkit/Views/DrawingView/Extensions/Extensions.shared.cs
Outdated
Show resolved
Hide resolved
…XamarinCommunityToolkit into 1822-drawingview-freeze
Description of Bug
Issues Fixed
Behavioral Changes
because of smoothing collection of points changed each time the user draws the line. as a result, led to more than 1 million points which took time to process. We shouldn't change the original (drawn) collection of points but should smooth the path only to visualize it.
The fix also includes enabling smoothing for all platforms (previously it was only for iOS/macOS) and minor nullable leftovers
PR Checklist
approved