Butterfly
Butterfly copied to clipboard
[Bug]: eraser erases nearby untouched strokes
What happened?
lineageos galaxy s5e tablet using a capacitative stylus, no similar issues on other apps afaik. afaik nothing else was touching the nearby strokes on the left erased, palm wasn't on the screen
https://github.com/LinwoodDev/Butterfly/assets/148969094/9434d8d2-ecc1-4716-a446-7ed802599b3c
Version
2.0.0.beta-15
Platform
Android
Relevant log output
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
I will look at this. On my code side i will only catch pointer events and use this position to remove something.
I think I know what the problem is.
The thing is: ElementsRemoved takes a list of indexes.
An example. We have given a list ["a", "b", "c", "d"].
All events are processed in a different scheduler than the ui.
If we delete "b" and after a short time "c", we got ElementsRemoved([1]) and ElementsRemoved([2]).
Then the event handler comes in. The first handler changed the list to ["a", "c", "d"].
Now we have a problem: The next handler changes the list to ["a", "c"].
To fix this, we need to change the behavior from an index based system to an id/key based system. My suggestion would be to add an id property to every renderer with a random value. If we want to delete an element, we search for this renderer and use the key in the ElementsRemoved parameters. Maybe we should look for a method to look for already existing keys when generating the id.
It should be fixed for now in 2.0.3-rc.0, I will try to add an id system in 2.1 to make it more stable
Can you try out https://butterfly-git-feature-element-id-linwood.vercel.app/ if this solves this issue and if this doesn't break anything (elements creation, changing, arranging)?
Fixed in 2.1.0-beta.3