interactjs
Version:
Drag and drop, resizing and multi-touch gestures with inertia and snapping for modern browsers (and also IE8+)
25 lines (21 loc) • 785 B
JavaScript
module.exports = {
base: {
accept : null,
preventDefault: 'auto',
deltaSource : 'page',
},
perAction: {
origin: { x: 0, y: 0 },
// only allow left button by default
// see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons#Return_value
mouseButtons: 1,
inertia: {
enabled : false,
resistance : 10, // the lambda in exponential decay
minSpeed : 100, // target speed must be above this for inertia to start
endSpeed : 10, // the speed at which inertia is slow enough to stop
allowResume : true, // allow resuming an action in inertia phase
smoothEndDuration: 300, // animate to snap/restrict endOnly if there's no inertia
},
},
};