mirror of
https://github.com/drawdb-io/drawdb.git
synced 2025-09-01 18:35:24 +00:00
fix: release pointer capture when using onPointerLeave
events
Certain input sources (such as touch) are "captured" when they press an element. This means the pointer is always considered "inside" the element by the browser, even when they visually are not. This caused some issues on mobile browsers where touch and stylus events could not connect table columns with each other. Just to be safe, I've added the required `releasePointerCapture` call everywhere `onPointerEnter` or `onPointerLeave` is used.
This commit is contained in:
@@ -352,6 +352,11 @@ export default function WorkSpace() {
|
||||
onPointerUp={(e) => e.isPrimary && setResize(false)}
|
||||
onPointerLeave={(e) => e.isPrimary && setResize(false)}
|
||||
onPointerMove={(e) => e.isPrimary && handleResize(e)}
|
||||
onPointerDown={(e) => {
|
||||
// Required for onPointerLeave to trigger when a touch pointer leaves
|
||||
// https://stackoverflow.com/a/70976017/1137077
|
||||
e.target.releasePointerCapture(e.pointerId);
|
||||
}}
|
||||
>
|
||||
{layout.sidebar && (
|
||||
<SidePanel resize={resize} setResize={setResize} width={width} />
|
||||
|
Reference in New Issue
Block a user