29 lines
626 B
JavaScript
29 lines
626 B
JavaScript
import { isDragging } from './is-active.mjs';
|
|
|
|
function setDragLock(axis) {
|
|
if (axis === "x" || axis === "y") {
|
|
if (isDragging[axis]) {
|
|
return null;
|
|
}
|
|
else {
|
|
isDragging[axis] = true;
|
|
return () => {
|
|
isDragging[axis] = false;
|
|
};
|
|
}
|
|
}
|
|
else {
|
|
if (isDragging.x || isDragging.y) {
|
|
return null;
|
|
}
|
|
else {
|
|
isDragging.x = isDragging.y = true;
|
|
return () => {
|
|
isDragging.x = isDragging.y = false;
|
|
};
|
|
}
|
|
}
|
|
}
|
|
|
|
export { setDragLock };
|