Explorar el Código

Fix the building tooltip flying off the screen

tags/v0.0.2
Fen Dweller hace 5 años
padre
commit
f98e9af1ac
Se han modificado 1 ficheros con 9 adiciones y 1 borrados
  1. +9
    -1
      gorge.js

+ 9
- 1
gorge.js Ver fichero

@@ -651,7 +651,15 @@ function buildingTooltip(id, event) {
let yOffset = tooltip.parentElement.getBoundingClientRect().y;

let xPos = tooltip.parentElement.getBoundingClientRect().x - 450;
let yPos = event.clientY;
// wow browsers are bad

var body = document.body,
html = document.documentElement;

var height = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );

let yPos = Math.min(event.clientY, height - 200);

tooltip.style.setProperty("transform", "translate(" + xPos + "px, " + yPos + "px)")
}


Cargando…
Cancelar
Guardar