Provides swipe gestures detections for reflex apps.
Project description
Reflex Swipe
Detects swipes on the page. Wraps react-swipeable
.
from reflex_swipe import swipeable
def index():
return swipeable(
"Swipe Here",
on_swiped_left=rx.console_log("Swiped Left"),
height="100px",
width="100px",
)
Supported Props
Prop Name | Prop Type | Description |
---|---|---|
delta | float | The min distance(px) before a swipe starts. |
prevent_scroll_on_swipe | bool | Prevents scroll during swipe. |
track_touch | bool | Track touch input. |
track_mouse | bool | Track mouse input. |
rotation_angle | float | Set a rotation angle. |
swipe_duration | float | Allowable duration of a swipe (ms). |
Supported Events
Event Name | Event Type |
---|---|
on_swiped | (SwipeEvent) -> Any |
on_swiped_left | (SwipeEvent) -> Any |
on_swiped_right | (SwipeEvent) -> Any |
on_swiped_up | (SwipeEvent) -> Any |
on_swiped_down | (SwipeEvent) -> Any |
on_swiped_start | (SwipeEvent) -> Any |
on_swiping | (SwipeEvent) -> Any |
on_tap | () -> Any |
on_touch_start_or_mouse_down | () -> Any |
on_touch_end_or_mouse_up | () -> Any |
SwipeEvent
is the following:
class SwipeEvent(TypedDict):
"""A swipe event."""
# direction of swipe
dir: Literal["Left", "Right", "Up", "Down"]
# initial swipe [x,y]
initial: Tuple[float, float]
# true for the first event of a tracked swipe
first: bool
# x offset (current.x - initial.x)
delta_x: float
# y offset (current.y - initial.y)
delta_y: float
# absolute delta_x
abs_x: float
# absolute delta_y
abs_y: float
# √(absX^2 + absY^2) / time - "absolute velocity" (speed)
velocity: float
# [ deltaX/time, deltaY/time] - velocity per axis
vxvy: Tuple[float, float]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
reflex_swipe-1.0.0.tar.gz
(3.5 kB
view details)
Built Distribution
File details
Details for the file reflex_swipe-1.0.0.tar.gz
.
File metadata
- Download URL: reflex_swipe-1.0.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.7+ Linux/6.11.6-amd64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6491588962d3b640b30b1eca147208d823b4c8175fd611d679f5b09494737bdd |
|
MD5 | e78936326756b67773b44ff153a459b9 |
|
BLAKE2b-256 | a6d69981da86af300ce33009a1aa77314a23daae84aa38ec94d0b12c85397f61 |
File details
Details for the file reflex_swipe-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: reflex_swipe-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.7+ Linux/6.11.6-amd64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59072376d22ca10437871732938eca19a94123bc990d6226180639cc7cbde840 |
|
MD5 | 245e98277e24df71089b4aaed4db8fc5 |
|
BLAKE2b-256 | 3031cc66c05a0bd1a837cb68b735ce65f8160642324a31ba6e9dcbd768afb57c |