This commit is contained in:
Guillem George 2026-05-16 18:51:01 +02:00
parent 1e4cd71e06
commit e84731e8de
4 changed files with 35 additions and 15 deletions

View file

@ -7,7 +7,6 @@
import $ from "jquery";
import { getPixelInfo } from "./index";
import { room } from "../../pages/index";
const canvasContainer = $("#canvas-container")?.[0];
const canvas = $("#canvas")?.[0];
@ -60,12 +59,21 @@ export const toggleTooltip = async (state = false) => {
tooltip.style.display = state ? "flex" : "none";
if (state) {
// FIXME: You should implement or call a function to get the pixel's information
// and display it. Make use of target.x and target.y to get the pixel's position.
// Get pixel
const room = window.location.pathname.split("/")[1] || "epi-place";
const response = await getPixelInfo(room, target.x, target.y);
if (!response) {
return;
}
// Display
const date = new Date(response.timestamp * 1000);
document.getElementById("tooltip-date").innerText =
date.toLocaleDateString();
document.getElementById("tooltip-time").innerText =
date.toLocaleTimeString();
}
};