Skip to content

Commit

Permalink
Merge pull request #35 from gabeklavans/bugfix/disable-double-tap
Browse files Browse the repository at this point in the history
double-tap-disable fix
  • Loading branch information
gabeklavans authored Jun 21, 2024
2 parents e9df97e + e87f94d commit 77c97bf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
5 changes: 0 additions & 5 deletions public/results.css
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,3 @@ span > p {
padding: 0;
font-size: medium;
}

.disable-dbl-tap-zoom {
touch-action: manipulation;
}

4 changes: 2 additions & 2 deletions public/results.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ <h3 id="otherPlayerScore"></h3>
</section>

<footer>
<button class="disable-dbl-tap-zoom" id="left-button">⬅️</button>
<button class="disable-dbl-tap-zoom" id="right-button">➡️</button>
<button class="disable-double-tap-zoom" id="left-button">⬅️</button>
<button class="disable-double-tap-zoom" id="right-button">➡️</button>
</footer>
</body>
</html>
14 changes: 10 additions & 4 deletions src/results.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ let showAllWords: boolean;

setInterval(checkForUpdatedSession, CHECK_UPDATE_INTERVAL_MS);

document.querySelectorAll(".disable-double-tap-zoom").forEach((e) => {
e.addEventListener("touchstart", (event) => {
event.preventDefault();
});
});

document.getElementById("left-button")?.addEventListener("pointerdown", () => {
if (otherPlayerIdx <= 0) {
console.warn("Somehow tried to reduce below first player");
Expand Down Expand Up @@ -97,12 +103,12 @@ async function init() {

// descending score order, else ascending alphabetical order
sortedBoardWords = session.board.words.sort((a, b) =>
a.length !== b.length ? b.length - a.length : a.localeCompare(b)
a.length !== b.length ? b.length - a.length : a.localeCompare(b),
);
wordsFoundByPlayers = new Set(
Object.values(session.scoredUsers)
.map((scoredUser) => scoredUser.words)
.flat()
.flat(),
);
console.log(`sorted words: ${sortedBoardWords}
found words:`);
Expand All @@ -121,7 +127,7 @@ async function init() {
if (mainPlayer.done && mainPlayer.score) {
scoreText = mainPlayer.score.toString();
} else if (!mainPlayer.done && mainPlayer.score) {
scoreText = `${mainPlayer.score.toString()}...`
scoreText = `${mainPlayer.score.toString()}...`;
} else if (mainPlayer.done && !mainPlayer.score) {
console.warn(`Player ${mainPlayer.name} was marked as done but score was null`);
}
Expand Down Expand Up @@ -167,7 +173,7 @@ function updateOtherPlayerColumn() {
if (otherPlayer.done && otherPlayer.score) {
scoreText = otherPlayer.score.toString();
} else if (!otherPlayer.done && otherPlayer.score) {
scoreText = `${otherPlayer.score.toString()}...`
scoreText = `${otherPlayer.score.toString()}...`;
} else if (otherPlayer.done && !otherPlayer.score) {
console.warn(`Player ${otherPlayer.name} was marked as done but score was null`);
}
Expand Down

0 comments on commit 77c97bf

Please sign in to comment.