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.1.2.tar.gz
(56.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file reflex_swipe-1.1.2.tar.gz.
File metadata
- Download URL: reflex_swipe-1.1.2.tar.gz
- Upload date:
- Size: 56.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
802f140b7000bb98428684a2b7fb6afe623e12cef50a5f24adba83601cec84a9
|
|
| MD5 |
525825922a456cdd59eacbdacc488ebb
|
|
| BLAKE2b-256 |
556ecba8b29e45dd53b62571be6bee3b4266dbb4953d08422a13d785096ffc2c
|
File details
Details for the file reflex_swipe-1.1.2-py3-none-any.whl.
File metadata
- Download URL: reflex_swipe-1.1.2-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cdec1eba4c0fb5956ccada1b022b23156809af82979cb42bd5155b535ece3364
|
|
| MD5 |
95dc9219183054051f6437dc89435bf7
|
|
| BLAKE2b-256 |
e386b8335f5e85daa1e0b3a99faec21ba338621c13ddcb3b50e4f3e731a2acd3
|