Skip to content

dynamically add event #3450

Answered by ekwoka
Timonney asked this question in 1. Help
Mar 7, 2023 · 1 comments · 5 replies
Discussion options

You must be logged in to vote

You should be able to just do this._pointerMoveEvent.bind(this) so that the function can access the component state with this

but yeah, there isn't a way to conditionally bind events. You might also want to consider having the pointerup event have { once: true } on it just so you don't have to actively remove it either. Just let it remove itself.

Also, be aware that if you're using pointerdown over mousedown to allow touch events, you will need to call element.releasePointerCapture() otherwise, the browser will take the touches for scrolling/panning/zooming (maybe after a delay like most things do to show the person "grabbed" the thing they are touching.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@Timonney
Comment options

@ekwoka
Comment options

@ekwoka
Comment options

@Timonney
Comment options

@ekwoka
Comment options

Answer selected by Timonney
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants