mirror of
https://github.com/placeAtlas/atlas.git
synced 2024-06-18 11:18:43 +02:00
Try to fix tooltip positioning
This commit is contained in:
parent
adcdc56a81
commit
67998c479e
|
@ -231,7 +231,11 @@ function updateTooltip(newPeriod, newVariation) {
|
|||
const configObject = variationsConfig[newVariation].versions[newPeriod]
|
||||
if (typeof configObject.timestamp === "number") tooltip.querySelector('p').textContent = new Date(configObject.timestamp * 1000).toUTCString()
|
||||
else tooltip.querySelector('p').textContent = configObject.timestamp
|
||||
tooltip.style.left = Math.max(((timelineSlider.offsetWidth) * (timelineSlider.value >= 1 ? timelineSlider.value - 1 : 0) / (timelineSlider.max - 1)) - tooltip.offsetWidth / 2, 0) + "px"
|
||||
if (timelineSlider.max === 1) {
|
||||
tooltip.style.left = (0 - tooltip.offsetWidth/2) + "px"
|
||||
} else {
|
||||
tooltip.style.left = (((timelineSlider.offsetWidth)*(timelineSlider.value)/(timelineSlider.max)) - tooltip.offsetWidth/2) + "px"
|
||||
}
|
||||
}
|
||||
|
||||
tooltip.parentElement.addEventListener('mouseenter', () => updateTooltip(parseInt(timelineSlider.value), currentVariation))
|
||||
|
|
Loading…
Reference in a new issue