Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Dec 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 42 additions & 41 deletions src/components/panels/Status/ExcludeObjectDialogMap.vue
Original file line number Diff line number Diff line change
@@ -1,32 +1,3 @@
<style scoped>
svg {
border: 2px solid #888;
}

#tooltipObjectMap {
display: none;
position: absolute;
background: black;
border-radius: 3px;
color: white;
padding: 3px 7px;
z-index: 100;

&:before {
display: block;
content: ' ';
width: 0;
height: 0;
position: absolute;
bottom: -10px;
left: 10px;
border-top: 10px solid black;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
}
}
</style>

<template>
<div style="position: relative">
<div id="tooltipObjectMap" ref="tooltipObjectMap"></div>
Expand Down Expand Up @@ -220,27 +191,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) {
Expand All @@ -249,3 +221,32 @@ export default class StatusPanelObjectsDialogMap extends Mixins(BaseMixin) {
}
}
</script>

<style scoped>
svg {
border: 2px solid #888;
}

#tooltipObjectMap {
display: none;
position: absolute;
background: black;
border-radius: 3px;
color: white;
padding: 3px 7px;
z-index: 100;

&:before {
display: block;
content: ' ';
width: 0;
height: 0;
position: absolute;
bottom: -10px;
left: 10px;
border-top: 10px solid black;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
}
}
</style>
Loading