Przeglądaj źródła

Fix the building tooltip flying off the screen

tags/v0.0.2
Fen Dweller 5 lat temu
rodzic
commit
f98e9af1ac
1 zmienionych plików z 9 dodań i 1 usunięć
  1. +9
    -1
      gorge.js

+ 9
- 1
gorge.js Wyświetl plik

@@ -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)")
}


Ładowanie…
Anuluj
Zapisz