1
0
mirror of https://github.com/lana-k/sqliteviz.git synced 2025-12-06 18:18:53 +08:00
Files
sqliteviz/src/tooltipMixin.js
lana-k 5017b55944 Pivot implementation and redesign (#69)
- Pivot support implementation 
- Rename queries into inquiries
- Rename editor into workspace
- Change result set format
- New JSON format for inquiries
- Redesign panels
2021-08-04 22:20:51 +02:00

38 lines
878 B
JavaScript

export default {
data () {
return {
tooltipStyle: {
visibility: 'hidden'
}
}
},
computed: {
tooltipElement () {
return this.$refs.tooltip
}
},
methods: {
showTooltip (e, tooltipPosition) {
const position = tooltipPosition ? tooltipPosition.split('-') : ['top', 'right']
const offset = 12
if (position[0] === 'top') {
this.tooltipStyle.top = e.clientY - offset + 'px'
} else {
this.tooltipStyle.top = e.clientY + offset + 'px'
}
if (position[1] === 'right') {
this.tooltipStyle.left = e.clientX + offset + 'px'
} else {
this.tooltipStyle.left = e.clientX - offset - this.tooltipElement.offsetWidth + 'px'
}
this.tooltipStyle.visibility = 'visible'
},
hideTooltip () {
this.tooltipStyle.visibility = 'hidden'
}
}
}