}
const drawArtistOnCtx = (ctx, artistName, x, y) => {
- ctx.font = "1em sans serif";
+ ctx.font = "20px sans serif";
ctx.strokeText(artistName, x, y);
}
drawWinner(canvas);
const [mid_x, mid_y] = getCenter(canvas);
context.font = '28px sans serif'
- context.strokeText(genre.toUpperCase(), mid_x - (28 * (genre.length / 3)), 40);
+ context.textAlign = "center";
+ context.strokeText(genre.toUpperCase(), mid_x, 40);
+ context.textAlign = "start";
const [rect_width, rect_height] = getRectangleDimensions(canvas);
const groups = 4;
const rounds = Math.floor(Math.log2(artists.length / groups));
for (let group = 1; group <= groups; group++) {
drawMatchup(
canvas,
- mid_x + (Math.pow(-1, group) * (rect_width / 4)),
- mid_y + (Math.pow(-1, Math.floor(group / 2)) * (rect_height * 2)),
+ mid_x + (Math.pow(-1, group) * (rect_width / 6)),
+ mid_y + (Math.pow(-1, Math.floor(group / 2)) * (rect_height * 2.5)),
0,
rounds,
Math.pow(-1, group),
const canvas = document.getElementById("bracket");
const formSubmitAction = () => {
- fetch(encodeURI(`http://localhost:8080/artist/genre?genre_name=${genreInput.value}`))
+ fetch(encodeURI(`http://api.brackets.jacobcasper.com/artist/genre?genre_name=${genreInput.value}`))
.then((response) => response.json())
.then((data) => drawBracket(canvas, data.slice(0, 33), genreInput.value));
}
}
let genres = JSON.parse(lStorage.getItem("genres"))
if (genres === null) {
- fetch("http://localhost:8080/genre")
+ fetch("http://api.brackets.jacobcasper.com/genre")
.then((response) => response.text())
.then((text) => {
window.localStorage.setItem("genres", text);