Changed wrapper and events to allow other EventListeners.

This commit is contained in:
Severin Opel 2021-01-26 08:01:51 +01:00
parent fa0256d782
commit ca5a39d661
2 changed files with 21 additions and 13 deletions

View File

@ -146,15 +146,20 @@ export default class CardWrapper extends Object {
/* https://stackoverflow.com/questions/49564905/is-it-possible-to-use-click-function-on-svg-tags-i-tried-element-click-on-a
proposes the dispatchEvent solution. But this leads to problems in flippable.html hiding the back page.
Therefore we use the original click event (see constructor). */
if (this.isSVGNode(node)) {
if (this.triggerSVGClicks) {
// if (this.isSVGNode(node)) {
// if (this.triggerSVGClicks) {
// let click = new Event('click')
// node.dispatchEvent(click)
// }
// return
// }
// node.click()
let click = new Event('click')
click.clientX = event.clientX
click.clientY = event.clientY
node.dispatchEvent(click)
}
return
}
node.click()
}
nodeTapped(node, event) {
console.log('nodeTapped', node, this.isClickable(node))

View File

@ -1,7 +1,10 @@
export default class Events {
static stop(event) {
event.preventDefault()
event.stopPropagation()
// I removed this, as it destroys all the Hammer.js events.
// And also the click event.
// It seems to have no (apparent) negative impact. -SO
// event.stopPropagation()
}
static extractPoint(event) {