Added event listeners to TwistyPlayer #345
Open
+84
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added event listeners that trigger when the user interacts with visualizationWrapperElem of TwistyPlayer.
I implemented the click event for Feature Request #344.
Unfortunately, attaching a click event listener to visualizationWrapperElem would also trigger the event when the mouse is released at a different point than where it was pressed. Therefore, I added all these event listeners to check if the click and release point is the same to trigger the custom click event.
This is my
stub.ts
for testing:During testing, I encountered an issue with the Inspection tool in Google Chrome. While simulating a handheld device, clicking with the mouse (same press and release point) triggers touch and mouse events. This results in triggering the
canvas-click
event twice. This might be an issue for developers implementing TwistyPlayer. Should this be tackled?In Firefox, simulation a handheld device only triggers mouse events.
Are the names of the events okay like that or is there a better idea?
Please tell me if the code is unclear or can be written in a better way.