|
|
|
@ -39,15 +39,20 @@ function renderBracket(options) { |
|
|
|
if (doubleButterflyMode == true && roundCount > 1) { |
|
|
|
if (doubleButterflyMode == true && roundCount > 1) { |
|
|
|
roundTotalCount = roundCount - 1; |
|
|
|
roundTotalCount = roundCount - 1; |
|
|
|
} |
|
|
|
} |
|
|
|
const padding = 50 * roundTotalCount; // Account for some padding/margin
|
|
|
|
const padding = (15 - roundTotalCount / 1.5 + 20 + 20) * roundTotalCount; // Account for some padding/margin
|
|
|
|
const availableWidth = screenWidth - padding; |
|
|
|
const availableWidth = screenWidth - padding; |
|
|
|
responsiveMatchWidth = Math.floor(availableWidth / roundTotalCount); |
|
|
|
responsiveMatchWidth = Math.floor(availableWidth / roundTotalCount); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let topMargin = 0; |
|
|
|
if (isBroadcast) { |
|
|
|
if (isBroadcast) { |
|
|
|
responsiveMatchWidth = Math.min( |
|
|
|
responsiveMatchWidth = Math.min( |
|
|
|
365, |
|
|
|
500, |
|
|
|
Math.floor(availableWidth / roundTotalCount), |
|
|
|
Math.floor(availableWidth / roundTotalCount), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (roundTotalCount < 6) { |
|
|
|
|
|
|
|
topMargin = 60; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
rounds.forEach((roundMatches, roundIndex) => { |
|
|
|
rounds.forEach((roundMatches, roundIndex) => { |
|
|
|
@ -319,7 +324,7 @@ function renderBracket(options) { |
|
|
|
"--next-match-distance", |
|
|
|
"--next-match-distance", |
|
|
|
`${nextMatchDistance}px`, |
|
|
|
`${nextMatchDistance}px`, |
|
|
|
); |
|
|
|
); |
|
|
|
matchDiv.style.top = `${top}px`; |
|
|
|
matchDiv.style.top = `${top + topMargin}px`; |
|
|
|
matchPositions[roundIndex][matchRealIndex] = top; |
|
|
|
matchPositions[roundIndex][matchRealIndex] = top; |
|
|
|
|
|
|
|
|
|
|
|
if (matchIndex === 0) { |
|
|
|
if (matchIndex === 0) { |
|
|
|
@ -336,19 +341,19 @@ function renderBracket(options) { |
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// Position title above the first match
|
|
|
|
// Position title above the first match
|
|
|
|
titleDiv.style.top = `${-80}px`; // Adjust the 60px offset as needed
|
|
|
|
titleDiv.style.top = `${topMargin - 80}px`; // Adjust the 60px offset as needed
|
|
|
|
if ( |
|
|
|
if ( |
|
|
|
(roundIndex == finalRoundIndex && realRoundIndex == 0) || |
|
|
|
(roundIndex == finalRoundIndex && realRoundIndex == 0) || |
|
|
|
isBroadcast == true |
|
|
|
isBroadcast == true |
|
|
|
) { |
|
|
|
) { |
|
|
|
titleDiv.style.top = `${top - 80}px`; // Adjust the 60px offset as needed
|
|
|
|
titleDiv.style.top = `${top + topMargin - 80}px`; // Adjust the 60px offset as needed
|
|
|
|
} |
|
|
|
} |
|
|
|
titleDiv.style.position = "absolute"; |
|
|
|
titleDiv.style.position = "absolute"; |
|
|
|
if (roundCount >= 5 && doubleButterflyMode == true) { |
|
|
|
if (roundCount >= 5 && doubleButterflyMode == true) { |
|
|
|
if (roundIndex == finalRoundIndex - 1) { |
|
|
|
if (roundIndex == finalRoundIndex - 1) { |
|
|
|
titleDiv.style.marginLeft = "60px"; |
|
|
|
titleDiv.style.marginLeft = "50px"; |
|
|
|
} else if (roundIndex == finalRoundIndex + 1) { |
|
|
|
} else if (roundIndex == finalRoundIndex + 1) { |
|
|
|
titleDiv.style.marginLeft = "-60px"; |
|
|
|
titleDiv.style.marginLeft = "-50px"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
matchesContainer.appendChild(titleDiv); |
|
|
|
matchesContainer.appendChild(titleDiv); |
|
|
|
@ -372,11 +377,14 @@ function renderBracket(options) { |
|
|
|
titleDiv.className = "round-title"; |
|
|
|
titleDiv.className = "round-title"; |
|
|
|
titleDiv.appendChild(nameSpan); |
|
|
|
titleDiv.appendChild(nameSpan); |
|
|
|
titleDiv.appendChild(formatSpan); |
|
|
|
titleDiv.appendChild(formatSpan); |
|
|
|
titleDiv.style.top = `${top - 80}px`; // Adjust the 60px offset as needed
|
|
|
|
titleDiv.style.top = `${top + topMargin - 80}px`; // Adjust the 60px offset as needed
|
|
|
|
titleDiv.style.position = "absolute"; |
|
|
|
titleDiv.style.position = "absolute"; |
|
|
|
matchesContainer.appendChild(titleDiv); |
|
|
|
matchesContainer.appendChild(titleDiv); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (roundIndex == 0) { |
|
|
|
|
|
|
|
isIncomingLineIsDisabled = true; |
|
|
|
|
|
|
|
} |
|
|
|
matchDiv.innerHTML = ` |
|
|
|
matchDiv.innerHTML = ` |
|
|
|
<div class="incoming-line ${isIncomingLineIsDisabled ? "disabled" : ""}"></div> |
|
|
|
<div class="incoming-line ${isIncomingLineIsDisabled ? "disabled" : ""}"></div> |
|
|
|
<div class="match-content ${isDisabled ? "disabled" : ""}">${matchTemplate.innerHTML}</div> |
|
|
|
<div class="match-content ${isDisabled ? "disabled" : ""}">${matchTemplate.innerHTML}</div> |
|
|
|
|