Raxol.Animation.Gestures (Raxol v2.0.1)
View SourceRefactored gesture-driven interactions with GenServer-based state management.
This module provides the same gesture detection and animation functionality as the original but uses supervised state management instead of Process dictionary.
Migration Notes
Gesture state tracking has been moved to Animation.Gestures.Server, eliminating Process dictionary usage while maintaining full functionality.
Summary
Functions
Checks if any gestures are currently active.
Gets information about active animations.
Clears all gesture handlers.
Gets the current velocity of active gesture.
Calculates the direction from one position to another.
Calculates the distance between two positions.
Gets all animation objects for rendering.
Gets the current gesture state.
Initializes the gesture system.
Registers a handler for a specific gesture type.
Registers multiple handlers at once.
Simulates a long press gesture for testing.
Simulates a gesture sequence for testing.
Simulates a tap gesture for testing.
Handles a touch/mouse down event.
Handles a touch/mouse move event.
Handles a touch/mouse up event.
Updates all active animations.
Calculates velocity between two positions over time.
Types
Functions
Checks if any gestures are currently active.
Gets information about active animations.
Clears all gesture handlers.
Gets the current velocity of active gesture.
Calculates the direction from one position to another.
Calculates the distance between two positions.
Gets all animation objects for rendering.
Gets the current gesture state.
Initializes the gesture system.
Registers a handler for a specific gesture type.
Examples
iex> register_handler(:swipe, fn %{direction: :left} -> handle_left_swipe() end)
:ok
Registers multiple handlers at once.
Examples
iex> register_handlers(%{
...> swipe: fn data -> handle_swipe(data) end,
...> tap: fn data -> handle_tap(data) end
...> })
:ok
Simulates a long press gesture for testing.
Simulates a gesture sequence for testing.
Examples
iex> simulate_swipe({10, 10}, {50, 10}, 200)
:ok
Simulates a tap gesture for testing.
Handles a touch/mouse down event.
Handles a touch/mouse move event.
Handles a touch/mouse up event.
Updates all active animations.
Calculates velocity between two positions over time.