Skip to main content

Reflex custom component mouse-track

Project description

mouse-track

A Reflex custom component mouse-track.

Installation

pip install reflex-mouse-track

Example:

@dataclasses.dataclass
class Point:
    """Point dataclass."""

    x: int
    y: int

class MouseTrackState(rx.State):
    def handle_click(self, mouse: Point):
        """Handle click event."""
        yield rx.toast(f"Click event: {mouse}")

def tracking_area():
    return mouse_track(
        background_color="gray",
        on_click=MouseTrackState.handle_click,
        width="100vw",
        height="100vh",
    )

API

  • Event Triggers:
    • on_click: Triggered when the user clicks on the tracking area.
    • on_mouse_down: Triggered when the user press a mouse button on the tracking area.
    • on_mouse_up: Triggered when the user releases the mouse on the tracking area.

Known errors:

  • When trying to access MousePosition, if you get an error saying 'mouse' is undefined, you might need to decorate the global function where you do the mouse tracking with @rx.memo.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reflex_mouse_track-0.0.1.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

reflex_mouse_track-0.0.1-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file reflex_mouse_track-0.0.1.tar.gz.

File metadata

  • Download URL: reflex_mouse_track-0.0.1.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for reflex_mouse_track-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a133bca0d9fe735cc8e8dd54eef79d1ff5cb3a77ef1bc39276cccc6c0b897e58
MD5 7cda1c7b42229e4790851ac47e0d0afb
BLAKE2b-256 9ea3d665ba2dafc27a00d8ea4a1ff149e3d094f09f7ab28bf6f38d30e0f18e45

See more details on using hashes here.

File details

Details for the file reflex_mouse_track-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for reflex_mouse_track-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 737710f44a7ac3440ed623fa8c1903452f8b9a4fbf8ad7a9c2a00740851daa75
MD5 9514b377ccd810c231a0de19fcb53f15
BLAKE2b-256 ee7b6b462cf9d519f8e72fe4a69519e243a5e7e3e7daeb6fd923c14e04ecc02b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page