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

[Feature request] Twisty Player onclick event #344

Open
Dave2ooo opened this issue Dec 8, 2024 · 1 comment
Open

[Feature request] Twisty Player onclick event #344

Dave2ooo opened this issue Dec 8, 2024 · 1 comment
Labels
📦 cubing/twisty enhancement New feature or request 🙋 help wanted Extra attention is needed

Comments

@Dave2ooo
Copy link

Dave2ooo commented Dec 8, 2024

Goal

In Twisty Player, I want to be able to detect when the user clicks on the element where the puzzle is shown, i.e. div.visualisation-wrapper is clicked.
Dragging the puzzle could also be detected separately.

Unbenannt

In my F2L Trainer, I would like to get to the next training case by clicking on the cube in Twisty Player.
Adding a click event listener to the whole Twisty Player would make the controls of Twisty Player unusable.

I imagine using this feature like that:

document.querySelector('twisty-player').addEventListener('"puzzle-click", callbackClick);
document.querySelector('twisty-player').addEventListener('"puzzle-drag", callbackDrag);

Possible solution

Add a click event listener to visualizationWrapperElem that triggers a new event puzzle-click.

I don't know if it would be that simple.

Alternatives

Add the posibility to make the #shadow-root of Twisty Player open.

@Dave2ooo Dave2ooo added the enhancement New feature or request label Dec 8, 2024
@lgarron
Copy link
Member

lgarron commented Dec 8, 2024

This sounds pretty reasonable. I don't know when I could get around to implementing it, but I'd be happy to review a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 cubing/twisty enhancement New feature or request 🙋 help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants