LogoLogo
首页示例Github
  • 概述
  • 介绍
    • 安装指南
    • 快速开始
  • API 文档
    • DndContext
      • 碰撞检测算法
      • useDndContext
      • useDndMonitor
    • Droppable
      • useDroppable
    • Draggable
      • useDraggable
      • 拖动浮层
    • Sensors
      • Pointer
      • Mouse
      • Touch
      • Keyboard
    • Modifiers
  • 预置能力
    • Sortable
      • Sortable Context
      • useSortable
  • 指南
    • 无障碍指南
  • 说明
由 GitBook 提供支持
在本页
  • Activator
  • Activation constraints

这有帮助吗?

在GitHub上编辑
  1. API 文档
  2. Sensors

Mouse

上一页Pointer下一页Touch

最后更新于1年前

这有帮助吗?

The Mouse sensor responds to . Mouse events represent events that occur due to the user interacting with a pointing device (such as a mouse).

Activator

The mouse activator is the onMouseDown event handler. The Mouse sensor is initialized if the mouse down event was triggered by the left mouse button.

Activation constraints

Like the sensor, the Mouse sensor has two activation constraints:

  • Distance constraint

  • Delay constraint

These activation constraints are mutually exclusive and may not be used simultaneously.

Distance

The distance constraint subscribes to the following interface:

interface DistanceConstraint {
  distance: number;
}

The distance property represents the distance, in pixels, by which the mouse needs to be moved before a drag start event is emitted.

Delay

The delay constraint subscribe to the following interface:

interface DelayConstraint {
  delay: number;
  tolerance: number;
}

The delay property represents the duration, in milliseconds, that a draggable item needs to be held by the mouse for before a drag start event is emitted.

The tolerance property represents the distance, in pixels, of motion that is tolerated before the drag operation is aborted. If the mouse is moved during the delay duration and the tolerance is set to zero, the drag operation will be immediately aborted. If a higher tolerance is set, for example, a tolerance of 5 pixels, the operation will only be aborted if the mouse is moved by more than 5 pixels during the delay.

Mouse events
Pointer