You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@williaster ditto! The basic physics to kick off the velocity calculations on dragmove should not be much, to feed into the dragend when inertia kicks in, but these two areas should be decided on:
Repainting mechanism: if basic requestAnimationFrame is used throughout visx, might be easy choice, but is there a performance gain from the official d3-timer? not sure, would love to hear ... considering that with inertia, multiple drag objects can be initiated, and moving at the same time
Config options: ones i can think of include (a) restrict within bounds, which visx/drag seems to already account for with a clamping mechanism, and (b) the strength of the "friction" to use on the inertia when slowing it down
Disable interaction during inertia: objects mid-flight moving during inertia should probably not be able to be interacted with until at rest again when velocity is zero
Attaching a screencast for a work-in-progress PR, to demonstrate some of those discussion points. For (1) this does use d3-timer, which seems to handle concurrent repaints very well, for (2) clamping will restrict movement along the boundary, but does not consider bouncing off the boundary, which may be desired, and for (3) grabbing an object mid-flight inertia is allowed
Enhancement Request
Add inertia option to the
visx-drag
package that allows drag to mimic inertia upon thedragEnd
event. Similar d3 extensions exists, e.g. d3-inertiaI have a good idea based on d3-inertia, but posting here in the community in case others are interested too.
The text was updated successfully, but these errors were encountered: