dnfield / flutter_path_drawing

MIT License
164 stars 26 forks source link

floating point issues are causing repaints #5

Open shamilovtim opened 4 years ago

shamilovtim commented 4 years ago

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

dnfield commented 4 years ago

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

dnfield commented 4 years ago

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

shamilovtim commented 4 years ago

@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 commented 4 years ago

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

shamilovtim commented 4 years ago

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.