react-use-pointer-drag
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -84,2 +84,6 @@ import React from 'react'; | ||
initialEvent?: PointerEvent; | ||
/** | ||
* PointerEvent object from current event. | ||
*/ | ||
event?: PointerEvent; | ||
} | ||
@@ -86,0 +90,0 @@ export interface IPointerDragOptions<T> { |
@@ -36,2 +36,3 @@ import { useState, useEffect, useCallback, useRef } from 'react'; | ||
distance: Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2)), | ||
event: e, | ||
}; | ||
@@ -89,7 +90,2 @@ }; | ||
onPointerDown: (e) => { | ||
const { stopPropagation = true, preventDefault = true } = optionsRef.current; | ||
if (preventDefault) | ||
e.preventDefault(); | ||
if (stopPropagation) | ||
e.stopPropagation(); | ||
setDragState(state); | ||
@@ -96,0 +92,0 @@ setIsStarted(true); |
{ | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"license": "BSD-3-Clause-Clear", | ||
@@ -4,0 +4,0 @@ "files": [ |
@@ -102,2 +102,7 @@ import React, { useState, useEffect, useCallback, useRef } from 'react'; | ||
initialEvent?: PointerEvent; | ||
/** | ||
* PointerEvent object from current event. | ||
*/ | ||
event?: PointerEvent; | ||
} | ||
@@ -189,5 +194,3 @@ | ||
const getData = ( | ||
e: PointerEvent | React.PointerEvent, | ||
): IPointerDragData<T> => { | ||
const getData = (e: PointerEvent): IPointerDragData<T> => { | ||
const { x: startX, y: startY, startedAt, initialEvent } = infoRef.current; | ||
@@ -210,2 +213,3 @@ | ||
distance: Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2)), | ||
event: e, | ||
}; | ||
@@ -272,8 +276,2 @@ }; | ||
onPointerDown: (e: React.PointerEvent) => { | ||
const { stopPropagation = true, preventDefault = true } = | ||
optionsRef.current; | ||
if (preventDefault) e.preventDefault(); | ||
if (stopPropagation) e.stopPropagation(); | ||
setDragState(state); | ||
@@ -280,0 +278,0 @@ setIsStarted(true); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
18101
477