Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/queuepro/node_modules/jsvectormap/src/js/elements/ drwxrwxr-x | |
| Viewing file: Select action/file-type: import {
createElement,
findElement
} from "../util"
import EventHandler from "../eventHandler"
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
class Tooltip {
constructor(map) {
const tooltip = createElement('div', 'jvm-tooltip')
this._map = map
this._tooltip = document.body.appendChild(tooltip)
this._bindEventListeners()
return this
}
_bindEventListeners() {
EventHandler.on(this._map.container, 'mousemove', event => {
if (!this._tooltip.classList.contains('active')) {
return
}
const container = findElement(this._map.container, '#jvm-regions-group').getBoundingClientRect()
const space = 5 // Space between the cursor and tooltip element
// Tooltip
const { height, width } = this._tooltip.getBoundingClientRect()
const topIsPassed = event.clientY <= (container.top + height + space)
let top = event.pageY - height - space
let left = event.pageX - width - space
// Ensure the tooltip will never cross outside the canvas area(map)
if (topIsPassed) { // Top:
top += height + space
// The cursor is a bit larger from left side
left -= space * 2
}
if (event.clientX < (container.left + width + space)) { // Left:
left = event.pageX + space + 2
if (topIsPassed) {
left += space * 2
}
}
this.css({ top: `${top}px`, left: `${left}px` })
})
}
getElement() {
return this._tooltip
}
show() {
this._tooltip.classList.add('active')
}
hide() {
this._tooltip.classList.remove('active')
}
text(string) {
if (!string) {
return this._tooltip.textContent
}
this._tooltip.textContent = string
}
css(css) {
for (let style in css) {
this._tooltip.style[style] = css[style]
}
return this
}
}
export default Tooltip |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0058 ]-- |