useMove

通过触摸和鼠标事件处理移动交互。


import { useMove } from 'primereact/hooks';
         

拖动标记到元素上以跟踪位置。

X: 20Y: 60

const { ref, x, y, active, reset } = useMove({ initialValue: { x: 0.2, y: 0.6 } });
         

仅使用 x 轴实现的水平滑块。

值: 20

const { ref, x } = useMove({ initialValue: { x: 0.2 } });
         

仅使用 y 轴实现的垂直滑块。

值: 20

const { ref, y } = useMove({ initialValue: { y: 0.2 } });