(event: MouseEvent | TouchEvent)
| 303 | } |
| 304 | |
| 305 | const handleDocumentMouseMove = (event: MouseEvent | TouchEvent) => { |
| 306 | const darg = getDrag() |
| 307 | const isMouseDown = IS_MOUSEDOWN.get(editor) |
| 308 | // 未长按不触发 move 事件 |
| 309 | if (IS_TOUCHING.get(editor) && !IS_TOUCH_HOLD.get(editor)) { |
| 310 | clearTouchHoldTimer() |
| 311 | return |
| 312 | } |
| 313 | const isTouchMoving = isTouchEvent(event) |
| 314 | IS_TOUCHMOVING.set(editor, isTouchMoving) |
| 315 | |
| 316 | if ( |
| 317 | !isTouchMoving && |
| 318 | !darg && |
| 319 | ((isMouseEvent(event) && event.button !== 0) || |
| 320 | !isMouseDown || |
| 321 | event.defaultPrevented || |
| 322 | isContextMenu.current) |
| 323 | ) |
| 324 | return |
| 325 | const point = event.defaultPrevented ? null : Editable.findEventPoint(editor, event) |
| 326 | if (point && dragging && isMouseEvent(event)) { |
| 327 | setDrag({ |
| 328 | to: { |
| 329 | anchor: point, |
| 330 | focus: point, |
| 331 | }, |
| 332 | position: { |
| 333 | x: event.clientX, |
| 334 | y: event.clientY, |
| 335 | }, |
| 336 | }) |
| 337 | return |
| 338 | } |
| 339 | // 阻止 touchmove 时页面滚动 |
| 340 | if (isTouchMoving) event.preventDefault() |
| 341 | const range = handleSelecting(point) |
| 342 | if (range) editor.onSelecting() |
| 343 | } |
| 344 | |
| 345 | const handleRootTouchStart = (event: React.TouchEvent) => { |
| 346 | if (event.defaultPrevented) return |
nothing calls this directly
no test coverage detected
searching dependent graphs…