Skip to content

Commit c8452c8

Browse files
authored
feat: replace mouse/touch events with pointer events (#879)
feat: replace mouse/touch events with pointer events (#879) - Use unified Pointer Events API for all drag interactions (mouse, touch, pen) - Implement pointer capture for better drag UX (prevents cursor blinking) - Add pointer ID filtering for multi-touch support - Simplify useResizer hook by removing separate mouse/touch handlers - Update DividerProps to use onPointerDown instead of onMouseDown/onTouchStart/onTouchEnd - Update ResizeEvent source type from 'mouse' | 'touch' to 'pointer' - Add PointerEvent polyfill for jsdom in test setup Closes #878
1 parent 6200524 commit c8452c8

File tree

6 files changed

+442
-302
lines changed

6 files changed

+442
-302
lines changed

src/components/Divider.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ export function Divider(props: DividerProps) {
4242
index,
4343
isDragging,
4444
disabled,
45-
onMouseDown,
46-
onTouchStart,
47-
onTouchEnd,
45+
onPointerDown,
4846
onKeyDown,
4947
className,
5048
style,
@@ -106,9 +104,7 @@ export function Divider(props: DividerProps) {
106104
tabIndex={disabled ? -1 : 0}
107105
className={combinedClassName}
108106
style={combinedStyle}
109-
onMouseDown={disabled ? undefined : onMouseDown}
110-
onTouchStart={disabled ? undefined : onTouchStart}
111-
onTouchEnd={disabled ? undefined : onTouchEnd}
107+
onPointerDown={disabled ? undefined : onPointerDown}
112108
onKeyDown={disabled ? undefined : onKeyDown}
113109
data-divider-index={index}
114110
>

src/components/SplitPane.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -273,13 +273,7 @@ export function SplitPane(props: SplitPaneProps) {
273273
);
274274

275275
// Resizer hook
276-
const {
277-
isDragging,
278-
currentSizes,
279-
handleMouseDown,
280-
handleTouchStart,
281-
handleTouchEnd,
282-
} = useResizer({
276+
const { isDragging, currentSizes, handlePointerDown } = useResizer({
283277
direction,
284278
sizes: paneSizes,
285279
minSizes,
@@ -354,9 +348,7 @@ export function SplitPane(props: SplitPaneProps) {
354348
index={index}
355349
isDragging={isDragging}
356350
disabled={!resizable}
357-
onMouseDown={handleMouseDown(index)}
358-
onTouchStart={handleTouchStart(index)}
359-
onTouchEnd={handleTouchEnd}
351+
onPointerDown={handlePointerDown(index)}
360352
onKeyDown={handleKeyDown(index)}
361353
className={dividerClassName}
362354
style={dividerStyle}

0 commit comments

Comments
 (0)