Let a click on the separator wander a little before it counts as a drag (#34580)
The separator has to tell a click apart from a drag, because dragging it also ends in a click, and it did so by treating any pointer movement at all between press and release as a drag. A pointer rarely holds perfectly still, least of all on a trackpad, so clicking the separator to open the room list often did nothing and had to be tried again. Movement is now measured from where the pointer went down and only counts as a drag past a few pixels, which means the handlers need the pointer position and the separator passes its events through to get it. Movement with nothing held down is ignored too: those events fire on hover, and one of them used to spend the click that came after it. Tests: a click that wanders a couple of pixels still opens the panel, as does one that follows moving across the separator, while a real drag is still no click. Co-authored-by: R Midhun Suresh <hi@midhun.dev>
This commit is contained in:
co-authored by
R Midhun Suresh
parent
354aa7de2b
commit
ba5eb6b463
@@ -23,14 +23,16 @@ export interface SeparatorViewActions {
|
||||
onPointerUp: () => void;
|
||||
|
||||
/**
|
||||
* onPointerMove handler for separator.
|
||||
* onPointerMove handler for separator. Takes the event so that how far the pointer has travelled
|
||||
* since it went down can be measured.
|
||||
*/
|
||||
onPointerMove: () => void;
|
||||
onPointerMove: (event: React.PointerEvent) => void;
|
||||
|
||||
/**
|
||||
* onPointerDown handler for separator.
|
||||
* onPointerDown handler for separator. Takes the event so that where the pointer went down can be
|
||||
* measured from.
|
||||
*/
|
||||
onPointerDown: () => void;
|
||||
onPointerDown: (event: React.PointerEvent) => void;
|
||||
|
||||
/**
|
||||
* onDoubleClick handler for the separator.
|
||||
|
||||
Reference in New Issue
Block a user