fix(ui): fix clickmap event listener

This commit is contained in:
nick-delirium 2023-01-24 11:44:39 +01:00
parent 3cd50d9bd3
commit 36eed6220f
2 changed files with 9 additions and 3 deletions

View file

@ -217,6 +217,7 @@ export default class Screen {
scaleFullPage() {
if (!this.parentElement || !this.document) return;
const { width: boxWidth } = this.parentElement.getBoundingClientRect();
const { height, width } = this.document.body.getBoundingClientRect();
this.overlay.remove()

View file

@ -76,8 +76,9 @@ export default class WebPlayer extends Player {
}
scaleFullPage = () => {
window.removeEventListener('resize', this.scale)
window.addEventListener('resize', this.screen.scaleFullPage)
window.removeEventListener('resize', this.scaleFullPage)
window.addEventListener('resize', this.scaleFullPage)
const portHeight = this.screen.scaleFullPage()
return this.wpState.update({ portHeight })
}
@ -115,7 +116,11 @@ export default class WebPlayer extends Player {
showClickmap = (...args: Parameters<TargetMarker['injectTargets']>) => {
this.freeze()
this.targetMarker.injectTargets(...args)
if (this.wpState.get().portHeight !== 0) {
this.targetMarker.injectTargets(...args)
} else {
setTimeout(() => this.showClickmap(...args), 500)
}
}
setMarkerClick = (...args: Parameters<TargetMarker['setOnMarkerClick']>) => {