bk
This commit is contained in:
parent
3d1a427dcf
commit
1e4cd71e06
5 changed files with 14 additions and 3 deletions
|
|
@ -101,3 +101,7 @@ const placeButtonElt = document.getElementById("color-place-button");
|
||||||
placeButtonElt.addEventListener("click", () => {
|
placeButtonElt.addEventListener("click", () => {
|
||||||
placePixelButton();
|
placePixelButton();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export {
|
||||||
|
room
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ async function getPixelInfo(room, posX, posY) {
|
||||||
const response = await authedAPIRequest(
|
const response = await authedAPIRequest(
|
||||||
"/rooms/" + room + "/canvas/pixels",
|
"/rooms/" + room + "/canvas/pixels",
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
// - toggleTooltip (toggle the tooltip and display the pixel's information)
|
// - toggleTooltip (toggle the tooltip and display the pixel's information)
|
||||||
|
|
||||||
import $ from "jquery";
|
import $ from "jquery";
|
||||||
|
import { getPixelInfo } from "./index";
|
||||||
|
import { room } from "../../pages/index";
|
||||||
|
|
||||||
const canvasContainer = $("#canvas-container")?.[0];
|
const canvasContainer = $("#canvas-container")?.[0];
|
||||||
const canvas = $("#canvas")?.[0];
|
const canvas = $("#canvas")?.[0];
|
||||||
|
|
@ -60,6 +62,10 @@ export const toggleTooltip = async (state = false) => {
|
||||||
if (state) {
|
if (state) {
|
||||||
// FIXME: You should implement or call a function to get the pixel's information
|
// 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.
|
// and display it. Make use of target.x and target.y to get the pixel's position.
|
||||||
|
const response = await getPixelInfo(room, target.x, target.y);
|
||||||
|
if (!response) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { authedAPIRequest } from "../utils/auth";
|
import { authedAPIRequest } from "../utils/auth";
|
||||||
import { subscribe } from "../utils/streams";
|
import { subscribe } from "../utils/streams";
|
||||||
import { resetValues } from "./canvas/utils";
|
import { resetValues } from "./canvas/utils";
|
||||||
|
import { room } from "../pages/index"
|
||||||
// FIXME: This file should handle the rooms API
|
// FIXME: This file should handle the rooms API
|
||||||
// Functions may include:
|
// Functions may include:
|
||||||
// - fetchRoomConfig (get the configuration of a room)
|
// - fetchRoomConfig (get the configuration of a room)
|
||||||
|
|
@ -19,7 +20,7 @@ function setCurrentRoomConfig(cfg) {
|
||||||
}
|
}
|
||||||
async function getCurrentRoomConfig() {
|
async function getCurrentRoomConfig() {
|
||||||
if (!roomConfig) {
|
if (!roomConfig) {
|
||||||
await fetchRoomConfig();
|
await fetchRoomConfig(room);
|
||||||
}
|
}
|
||||||
|
|
||||||
return roomConfig;
|
return roomConfig;
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ async function getStudent(login) {
|
||||||
|
|
||||||
if (!response || !response.ok) {
|
if (!response || !response.ok) {
|
||||||
console.error(
|
console.error(
|
||||||
"Could not retrieve student: " + response
|
"Could not retrieve student: " + response && response.statusText
|
||||||
? response.statusText
|
? response.statusText
|
||||||
: " no status text",
|
: " no status text",
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue