--- orphan: true --- # Gestures as controls pinch, twist and pan a map, long-press to drop a pin ```{raw} html ▶ Run in browser ``` **Tags:** `input` `touch` `gestures` `mouse` `mobile` A map you move with two fingers or a mouse. Every gesture is a control bound in the node's ``input_context`` exactly as a key is: ``zoom`` takes ``Touch.PINCH`` and ``Mouse.WHEEL * 0.1``, ``twist`` takes ``Touch.ROTATE`` and ``pan`` the stick ``Touch.PAN``. ``Input.touch_secondary = Touch.LONG_PRESS`` makes a long press the finger's right click, so ``drop`` bound to ``Pointer.SECONDARY`` drops a pin under a right click and under a held finger alike, and ``Touch.TWO_FINGER_TAP`` resets the view. ## What it demonstrates - ``Touch.PINCH``, ``Touch.ROTATE`` and ``Mouse.WHEEL`` as axes, read with ``Input.value``: each is the frame's motion and rests at zero. - A scaled binding: ``Mouse.WHEEL * 0.1`` puts a wheel notch in the pinch's unit, so one ``zoom`` action serves both. - ``Touch.PAN`` as a stick, bound once into a ``Vec2`` action. - ``Touch.TWO_FINGER_TAP`` as a button. - ``Input.touch_secondary``: a long press joins ``Pointer.SECONDARY``, so one binding serves the mouse's right button and a finger held still. - Recognition costs nothing unless something names a gesture: this scene names them, so it pays for them. Controls: Pinch / mouse wheel - Zoom Twist two fingers / Q, E - Rotate Two-finger drag / left drag - Pan Long press / right click - Drop a pin Two-finger tap / R - Reset the view ESC - Quit Run: simvx examples run features_input_touch_gestures Headless self-check: simvx examples run features_input_touch_gestures --test ## Source ```{literalinclude} ../../examples/features/input/touch_gestures.py :language: python :linenos: ```