Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add click_and_drag option #14

Merged
merged 2 commits into from
Jun 4, 2024
Merged

Conversation

ian-fox
Copy link

@ian-fox ian-fox commented Jun 4, 2024

Adding the request from #9 while I'm at it.

Doesn't send the onmousedown event right away (or any onmousemove events) because that would cause streamlit to refresh and potentially cause jitter and such.

Because of this you won't be able to e.g. draw a box around what the user is selecting until they've actually moused up, but it's a start at least. Could in theory implement an option to display a box over what the user is dragging with javascript, but that was more than I had time to implement at the moment.

Should again be backwards compatible as the original onclick function behaves the same, to get the new behaviour you have to opt in with click_and_drag=True.

Copy link
Owner

@blackary blackary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic! Works great for me! I added a demo page to show this off.

@blackary blackary merged commit bb7dc6e into blackary:main Jun 4, 2024
1 check passed
@blackary blackary mentioned this pull request Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants