Avoid stiky move on mouse leave
This commit is contained in:
parent
c4c88880c8
commit
d1ca731928
1 changed files with 9 additions and 2 deletions
|
@ -92,12 +92,19 @@ const PanZoomRotate = ({ children }) => {
|
|||
}
|
||||
};
|
||||
|
||||
const onMouseUp = (e) => {
|
||||
const onMouseUp = React.useCallback((e) => {
|
||||
if (e.button === 1 || e.altKey) {
|
||||
stateRef.current.moving = false;
|
||||
wrapperRef.current.style.cursor = "auto";
|
||||
}
|
||||
}, []);
|
||||
|
||||
React.useEffect(() => {
|
||||
document.addEventListener("mouseup", onMouseUp);
|
||||
return () => {
|
||||
document.removeEventListener("mouseup", onMouseUp);
|
||||
};
|
||||
}, [onMouseUp]);
|
||||
|
||||
return (
|
||||
<div
|
||||
|
|
Loading…
Reference in a new issue