fix(exclude objects): fix tooltip position in object map (#1719)

* fix(exclude objects): fix tooltip position in object map

Signed-off-by: Stefan Dej <meteyou@gmail.com>

* refactor: move style tag at the bottom

Signed-off-by: Stefan Dej <meteyou@gmail.com>

---------

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej
2023-12-30 17:16:08 +01:00
committed by GitHub
parent 6beca12e11
commit ff926bff64

View File

@@ -214,27 +214,28 @@ export default class StatusPanelObjectsDialogMap extends Mixins(BaseMixin) {
}
showObjectTooltip(text: string) {
if (this.$refs.tooltipObjectMap) {
this.$refs.tooltipObjectMap.innerHTML = text
this.$refs.tooltipObjectMap.style.display = 'block'
}
if (!this.$refs.tooltipObjectMap) return
this.$refs.tooltipObjectMap.innerHTML = text
this.$refs.tooltipObjectMap.style.display = 'block'
window.addEventListener('mousemove', this.moveTooltip)
}
hideObjectTooltip() {
if (this.$refs.tooltipObjectMap) {
this.$refs.tooltipObjectMap.style.display = 'none'
}
if (!this.$refs.tooltipObjectMap) return
this.$refs.tooltipObjectMap.style.display = 'none'
window.removeEventListener('mousemove', this.moveTooltip)
}
moveTooltip(event: any) {
if (this.$refs.tooltipObjectMap) {
this.$refs.tooltipObjectMap.style.left = event.layerX - 20 + 'px'
this.$refs.tooltipObjectMap.style.top = event.layerY - 45 + 'px'
}
moveTooltip(event: MouseEvent) {
if (!this.$refs.tooltipObjectMap) return
const top = event.offsetY - this.$refs.tooltipObjectMap.clientHeight - 15
this.$refs.tooltipObjectMap.style.left = `${event.offsetX - 20}px`
this.$refs.tooltipObjectMap.style.top = `${top}px`
}
openExcludeObjectDialog(name: string) {