(e: PointerEvent)
| 641 | }); |
| 642 | |
| 643 | function onRegionPointerDown(e: PointerEvent) { |
| 644 | if (!containerRef || e.button !== 0) return; |
| 645 | |
| 646 | const target = e.currentTarget as HTMLElement; |
| 647 | disposeActivePointerSession(); |
| 648 | stopAnimation(); |
| 649 | e.stopPropagation(); |
| 650 | setMouseState({ drag: "region" }); |
| 651 | let currentBounds = rawBounds(); |
| 652 | const containerRect = containerRef.getBoundingClientRect(); |
| 653 | const startOffset = { |
| 654 | x: e.clientX - containerRect.left - currentBounds.x, |
| 655 | y: e.clientY - containerRect.top - currentBounds.y, |
| 656 | }; |
| 657 | |
| 658 | trackPointerSession( |
| 659 | target, |
| 660 | e.pointerId, |
| 661 | (e) => { |
| 662 | let newX = e.clientX - containerRect.left - startOffset.x; |
| 663 | let newY = e.clientY - containerRect.top - startOffset.y; |
| 664 | |
| 665 | newX = clamp(newX, 0, containerRect.width - currentBounds.width); |
| 666 | newY = clamp(newY, 0, containerRect.height - currentBounds.height); |
| 667 | |
| 668 | currentBounds = moveBounds(currentBounds, newX, newY); |
| 669 | setRawBounds(currentBounds); |
| 670 | |
| 671 | if (!isAnimating()) setDisplayRawBounds(currentBounds); |
| 672 | }, |
| 673 | () => { |
| 674 | setMouseState({ drag: null }); |
| 675 | }, |
| 676 | ); |
| 677 | } |
| 678 | |
| 679 | let activePointerSessionDispose: (() => void) | undefined; |
| 680 |
nothing calls this directly
no test coverage detected