refactor
This commit is contained in:
@@ -165,13 +165,9 @@ const getEventTargetElement = (event?: PointerEventLike | null): Element | null
|
||||
if (!event) {
|
||||
return null;
|
||||
}
|
||||
const ElementCtor = typeof window !== 'undefined' ? window.Element : null;
|
||||
if (!ElementCtor) {
|
||||
return null;
|
||||
}
|
||||
const nativeEvent = 'nativeEvent' in event ? (event as ReactPointerEvent).nativeEvent : null;
|
||||
const candidate = (event.target as Element | null) || (nativeEvent ? (nativeEvent.target as Element | null) : null);
|
||||
return candidate instanceof ElementCtor ? candidate : null;
|
||||
return candidate instanceof Element ? candidate : null;
|
||||
};
|
||||
|
||||
const useDocumentDrag = (options: UseDocumentDragOptions) => {
|
||||
|
||||
Reference in New Issue
Block a user