Command Palette

Search for a command to run...

Hectal
Phase 8: Interaction
3D Web · Exercise 2 of 4 PreviousNext
Intermediate

Choose on a click, not at the end of a drag

This page chooses the cube the moment the pointer goes down, so a drag that starts on the cube also chooses it. Choose on pointerup instead, and only when the pointer moved at most 6 px since it went down.

A tap on the cube writes cube into #result; a drag that starts on the cube leaves it as nothing.

What Check tests

  1. A tap on empty space writes nothing
  2. A drag that starts on the cube does not choose it
  3. A tap on the cube chooses it

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Your page

Press Run to see the page.

Console

Nothing logged yet.