Created
March 2, 2021 11:57
-
-
Save lydemann/2a5b63d8a68dfe3d4f1a9e68568c4a16 to your computer and use it in GitHub Desktop.
category-transaction-list.component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| For avoiding clicks on mouse up after HammerJS long press. | |
| This event is triggered right before (click) to ensure we will not trigger click on long press. | |
| */ | |
| preventClickAfterLongPress(event: MouseEvent) { | |
| const element = event.target as HTMLElement; | |
| // needs to add class directly so it is applied before click event | |
| element.classList.add('prevent-pointer-events'); | |
| setTimeout(() => { | |
| element.classList.remove('prevent-pointer-events'); | |
| // after 50ms we are sure the "click" event was fired and ignored, | |
| // so we can revert the class name back | |
| }, 50); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment