Fixed taphandler problems.

This commit is contained in:
2019-10-02 10:33:57 +02:00
parent e7c05a8387
commit cd140a73f6
5 changed files with 458 additions and 232 deletions
+8 -4
View File
@@ -2,6 +2,7 @@
/* global PDFJS Power1 */
import { getId } from './utils.js'
import { DOMScatter } from './scatter.js'
import CardWrapper from './card/wrapper.js'
export class CardLoader {
constructor(
@@ -403,20 +404,23 @@ export class DOMFlippable {
this.backBtn = element.querySelector('.backBtn')
this.closeBtn = element.querySelector('.closeBtn')
/* Buttons are not guaranteed to exist. */
if (scatter.tapDelegate == null) {
let tapDelegate = new CardWrapper(element)
scatter.tapDelegate = tapDelegate
}
if (this.infoBtn) {
scatter.addTapListener(this.infoBtn, event => {
scatter.tapDelegate.onTap(this.infoBtn, event => {
this.flip.start()
})
this.enable(this.infoBtn)
}
if (this.backBtn) {
scatter.addTapListener(this.backBtn, event => {
scatter.tapDelegate.onTap(this.backBtn, event => {
this.start()
})
}
if (this.closeBtn) {
scatter.addTapListener(this.closeBtn, event => {
scatter.tapDelegate.onTap(this.closeBtn, event => {
this.close()
})
this.enable(this.closeBtn)