# mouse-track
A Reflex custom component mouse-track.
## Installation
```bash
pip install reflex-mouse-track
```
Example:
```python
@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`.
Raw data
{
"_id": null,
"home_page": null,
"name": "reflex-mouse-track",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "reflex, reflex-custom-components",
"author": null,
"author_email": "Your Name <thomas.brandeho@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/9e/a3/d665ba2dafc27a00d8ea4a1ff149e3d094f09f7ab28bf6f38d30e0f18e45/reflex_mouse_track-0.0.1.tar.gz",
"platform": null,
"description": "# mouse-track\n\nA Reflex custom component mouse-track.\n\n## Installation\n\n```bash\npip install reflex-mouse-track\n```\n\nExample:\n```python\n@dataclasses.dataclass\nclass Point:\n \"\"\"Point dataclass.\"\"\"\n\n x: int\n y: int\n\nclass MouseTrackState(rx.State):\n def handle_click(self, mouse: Point):\n \"\"\"Handle click event.\"\"\"\n yield rx.toast(f\"Click event: {mouse}\")\n\ndef tracking_area():\n return mouse_track(\n background_color=\"gray\",\n on_click=MouseTrackState.handle_click,\n width=\"100vw\",\n height=\"100vh\",\n )\n```\n\n## API\n- Event Triggers:\n - `on_click`: Triggered when the user clicks on the tracking area.\n - `on_mouse_down`: Triggered when the user press a mouse button on the tracking area.\n - `on_mouse_up`: Triggered when the user releases the mouse on the tracking area.\n\nKnown errors:\n - 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`. \n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Reflex custom component mouse-track",
"version": "0.0.1",
"project_urls": {
"Homepage": "https://github.com/Lendemor/reflex-mouse-track/"
},
"split_keywords": [
"reflex",
" reflex-custom-components"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ee7b6b462cf9d519f8e72fe4a69519e243a5e7e3e7daeb6fd923c14e04ecc02b",
"md5": "9514b377ccd810c231a0de19fcb53f15",
"sha256": "737710f44a7ac3440ed623fa8c1903452f8b9a4fbf8ad7a9c2a00740851daa75"
},
"downloads": -1,
"filename": "reflex_mouse_track-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9514b377ccd810c231a0de19fcb53f15",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 2973,
"upload_time": "2024-12-17T18:20:07",
"upload_time_iso_8601": "2024-12-17T18:20:07.590099Z",
"url": "https://files.pythonhosted.org/packages/ee/7b/6b462cf9d519f8e72fe4a69519e243a5e7e3e7daeb6fd923c14e04ecc02b/reflex_mouse_track-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9ea3d665ba2dafc27a00d8ea4a1ff149e3d094f09f7ab28bf6f38d30e0f18e45",
"md5": "7cda1c7b42229e4790851ac47e0d0afb",
"sha256": "a133bca0d9fe735cc8e8dd54eef79d1ff5cb3a77ef1bc39276cccc6c0b897e58"
},
"downloads": -1,
"filename": "reflex_mouse_track-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "7cda1c7b42229e4790851ac47e0d0afb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 2744,
"upload_time": "2024-12-17T18:20:11",
"upload_time_iso_8601": "2024-12-17T18:20:11.036550Z",
"url": "https://files.pythonhosted.org/packages/9e/a3/d665ba2dafc27a00d8ea4a1ff149e3d094f09f7ab28bf6f38d30e0f18e45/reflex_mouse_track-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-17 18:20:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Lendemor",
"github_project": "reflex-mouse-track",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "reflex-mouse-track"
}