Workshop › Klondike Solitaire › Step 29 of 40
While a card is held, every pointer move updates drag.x and drag.y. A move of more than 4 pixels marks it as a real
drag; a finger always wobbles a little, and that should still be a tap.
```js
canvas.addEventListener('pointermove', (event) => {
if (!drag) return
const p = toCanvas(event)
if (Math.hypot(p.x - drag.x, p.y - drag.y) > 4) drag.moved = true
drag.x = p.x
drag.y = p.y
})
```Math.hypot(a, b) is the length of the line with sides a and b (Pythagoras): the distance between the last point and
the new one.Under the pointerdown listener, leave an empty line and write the pointermove listener.
Skills: Keyboard and mouse input
← Where did you grab it? Draw the held cards at the pointer →