flutter_path_drawing icon indicating copy to clipboard operation
flutter_path_drawing copied to clipboard

floating point issues are causing repaints

Open shamilovtim opened this issue 5 years ago • 5 comments

the dashed path is not playing nice with doubles. here's a gif that shows the repainting going on when doubles are provided. i have had to enforce a list of integers in the mean time. toward that end, it would be nice if the circular array did not require doubles as that's not actually a requirement. <num> would be better.

72669932-c4d8a000-3a05-11ea-8b8d-b51ddcbeb164

related: https://github.com/imaNNeoFighT/fl_chart/pull/171

shamilovtim avatar Jan 19 '20 02:01 shamilovtim

I think using num should be fine. I'm not entirely clear on what is going on in the gif though.

dnfield avatar Jan 19 '20 02:01 dnfield

We would have to toDouble the num though because the underlying path API expects doubles

dnfield avatar Jan 19 '20 02:01 dnfield

@dnfield sorry I should have explained better! in the fl_chart library the click triggers a touch indicator on click. in that repaint you can see (multiple?) repaints happening where dashed path is doing arithmetic, painting, then painting again. this issue goes away when integers are passed to dashedPath. it's also not present with all doubles but probably the majority of them.

shamilovtim avatar Jan 19 '20 02:01 shamilovtim

also by "integers passed to dashedPath" i was referring to 10.0, 2.0, etc.

shamilovtim avatar Jan 19 '20 02:01 shamilovtim

I narrowed this down to dashPath because intuitively even if our Path was changing, this would not change the size and margin of the dashes. furthermore, we know that the dash List we're passing is definitely not changing. so it could only be dashPath causing this bug from the looks of things. changing the numbers to whole numbers made it go away. also a couple of different doubles did not present the bug either but it seemed like the majority of them did.

shamilovtim avatar Jan 19 '20 02:01 shamilovtim