react-movable
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -48,4 +48,4 @@ import * as React from 'react'; | ||
onStart: (target: HTMLElement, clientX: number, clientY: number, index: number) => void; | ||
onMouseMove: (e: MouseEvent) => null | undefined; | ||
onTouchMove: (e: TouchEvent) => null | undefined; | ||
onMouseMove: (e: MouseEvent) => void; | ||
onTouchMove: (e: TouchEvent) => void; | ||
onWheel: (e: React.WheelEvent<Element>) => void; | ||
@@ -56,3 +56,3 @@ onMove: (clientX: number, clientY: number) => null | undefined; | ||
animateItems: (needle: number, movedItem: number, offset: number, animateMovedItem?: boolean) => void; | ||
onEnd: () => void; | ||
onEnd: (e: Event) => void; | ||
onKeyDown: (e: React.KeyboardEvent<Element>) => void; | ||
@@ -59,0 +59,0 @@ render(): JSX.Element; |
@@ -96,2 +96,3 @@ "use strict"; | ||
return; | ||
e.preventDefault(); | ||
document.addEventListener('mousemove', _this.onMouseMove, { passive: true }); | ||
@@ -105,2 +106,3 @@ document.addEventListener('mouseup', _this.onEnd, { passive: true }); | ||
_this.onTouchStart = function (e) { | ||
e.preventDefault(); | ||
document.addEventListener('touchmove', _this.onTouchMove, { passive: true }); | ||
@@ -139,5 +141,9 @@ document.addEventListener('touchend', _this.onEnd, { passive: true }); | ||
}; | ||
_this.onMouseMove = function (e) { return _this.onMove(e.clientX, e.clientY); }; | ||
_this.onMouseMove = function (e) { | ||
e.preventDefault(); | ||
_this.onMove(e.clientX, e.clientY); | ||
}; | ||
_this.onTouchMove = function (e) { | ||
return _this.onMove(e.touches[0].clientX, e.touches[0].clientY); | ||
e.preventDefault(); | ||
_this.onMove(e.touches[0].clientX, e.touches[0].clientY); | ||
}; | ||
@@ -237,3 +243,4 @@ _this.onWheel = function (e) { | ||
}; | ||
_this.onEnd = function () { | ||
_this.onEnd = function (e) { | ||
e.preventDefault(); | ||
document.removeEventListener('mousemove', _this.onMouseMove); | ||
@@ -346,4 +353,6 @@ document.removeEventListener('touchmove', _this.onTouchMove); | ||
var baseStyle = { | ||
userDrag: 'none', | ||
userSelect: 'none', | ||
'-webkit-user-select': 'none', | ||
'-moz-user-select': 'none', | ||
'-ms-user-select': 'none', | ||
boxSizing: 'border-box', | ||
@@ -350,0 +359,0 @@ position: 'relative' |
{ | ||
"name": "react-movable", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "Drag and drop lists.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
39995
673