Closed jrmoulton closed 1 week ago
Do you mean the pointer could have moved between the time that it is painted? But if we don't receive the pointermove event, there's no information the pointer has been moved.
Do I understand this issue correctly?
https://github.com/user-attachments/assets/8e01fe36-bd85-420c-b9eb-6f176ab26c5a
The pointer move event is registered on the view, it is dragging so it computes an offset relative to the view and then requests a paint. but if the same events causes the view to move (as it does in this dragging example) when it does eventually paint the offset that was relative to the view is now incorrect
Thanks for the clarification.
Because the dragged view should be always follows the pointer, maybe we can simply it by storing the offset of the view relative to the pointer at drag start, and then at paint time, we know where it should be according to the pointer position. i.e. we don't use the relative value with the original view which could have moved as well, but use the relative value to the pointer and it should always be right.
this fixes some jitter when dragging views. because the view could have moved between the time that it is painted, the computed offset can be outdated. This causes lots of jitter in the draggable example.
I feel like there should be a simpler way of doing this but I couldn't figure out another way