Compare commits

..

No commits in common. "cd484263e0f850cb276fa9db83c54a236005e8af" and "9f8669c94ce6a526bcf3c246b73183721704a183" have entirely different histories.

1 changed files with 3 additions and 15 deletions

View File

@ -500,27 +500,15 @@ const hoveringTooltip = new (function() {
this.canvasPixelScale = 1; this.canvasPixelScale = 1;
function handler(e) { function handler(e) {
if (!settings.hoveringTooltip || !getVar("gameState") || recentlyShown) return; if (!settings.hoveringTooltip || !getVar("gameState") || recentlyShown) return;
let x, y;
// https://stackoverflow.com/a/61732450
if (e.type.includes(`touch`)) {
const { touches, changedTouches } = e.originalEvent ?? e;
const touch = touches[0] ?? changedTouches[0];
x = touch.pageX;
y = touch.pageY;
} else if (e.type.includes(`mouse`)) {
x = e.clientX;
y = e.clientY;
}
recentlyShown = true; recentlyShown = true;
try { try {
this.display(this.canvasPixelScale * x, this.canvasPixelScale * y); this.display(this.canvasPixelScale * e.clientX, this.canvasPixelScale * e.clientY);
} catch (e) { console.error(e) } } catch (e) { console.error(e) }
// for better performance, reduce the tooltip display frequency to no more than once every 100 ms // for better performance, reduce the tooltip display frequency to no more than once every 100 ms
setTimeout(() => recentlyShown = false, 100); setTimeout(() => recentlyShown = false, 100);
} }
document.getElementById("canvasA").addEventListener("mousemove", handler.bind(this)); document.getElementById("canvasA").addEventListener("mousemove", handler);
document.getElementById("canvasA").addEventListener("touchstart", handler.bind(this)); document.getElementById("canvasA").addEventListener("touchmove", handler);
}); });
var donationsTracker = new (function(){ var donationsTracker = new (function(){