mirror of
https://github.com/SoPat712/maisie-heardle.git
synced 2025-08-21 18:28:45 -04:00
Idk fix?
This commit is contained in:
@@ -209,13 +209,26 @@
|
|||||||
|
|
||||||
function startPolling() {
|
function startPolling() {
|
||||||
isPlaying = true;
|
isPlaying = true;
|
||||||
|
|
||||||
|
// clear any previous timers
|
||||||
clearInterval(progressInterval);
|
clearInterval(progressInterval);
|
||||||
|
clearTimeout(snippetTimeout);
|
||||||
|
|
||||||
|
// progress bar updater
|
||||||
progressInterval = setInterval(() => {
|
progressInterval = setInterval(() => {
|
||||||
widget.getPosition((pos: number) => {
|
widget.getPosition((pos: number) => {
|
||||||
const limit = gameOver ? fullDuration : segmentDurations[attemptCount];
|
const limit = gameOver ? fullDuration : segmentDurations[attemptCount];
|
||||||
currentPosition = Math.min(pos, limit);
|
currentPosition = Math.min(pos, limit);
|
||||||
});
|
});
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|
||||||
|
// clamp at the end of this segment
|
||||||
|
if (!gameOver) {
|
||||||
|
snippetTimeout = setTimeout(() => {
|
||||||
|
widget.pause();
|
||||||
|
currentPosition = segmentDurations[attemptCount];
|
||||||
|
}, segmentDurations[attemptCount]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function stopAllTimers() {
|
function stopAllTimers() {
|
||||||
@@ -260,17 +273,11 @@
|
|||||||
widget.seekTo(0);
|
widget.seekTo(0);
|
||||||
loading = false;
|
loading = false;
|
||||||
widgetReady = true;
|
widgetReady = true;
|
||||||
}, 2000);
|
}, 750);
|
||||||
});
|
});
|
||||||
|
|
||||||
widget.bind(SC.Widget.Events.PLAY, () => {
|
widget.bind(SC.Widget.Events.PLAY, () => {
|
||||||
startPolling();
|
startPolling();
|
||||||
if (!gameOver) {
|
|
||||||
snippetTimeout = setTimeout(() => {
|
|
||||||
widget.pause();
|
|
||||||
currentPosition = segmentDurations[attemptCount];
|
|
||||||
}, segmentDurations[attemptCount]);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
widget.bind(SC.Widget.Events.PAUSE, stopAllTimers);
|
widget.bind(SC.Widget.Events.PAUSE, stopAllTimers);
|
||||||
widget.bind(SC.Widget.Events.FINISH, () => {
|
widget.bind(SC.Widget.Events.FINISH, () => {
|
||||||
@@ -609,7 +616,10 @@
|
|||||||
{#if nextIncrementSec > 0}Skip (+{nextIncrementSec}s){:else}I don't know it{/if}
|
{#if nextIncrementSec > 0}Skip (+{nextIncrementSec}s){:else}I don't know it{/if}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
on:click={submitGuess}
|
on:click={() => {
|
||||||
|
submitGuess();
|
||||||
|
togglePlayPause();
|
||||||
|
}}
|
||||||
class="rounded px-4 py-2 font-semibold"
|
class="rounded px-4 py-2 font-semibold"
|
||||||
style="background:{COLORS.secondary};color:{COLORS.background}"
|
style="background:{COLORS.secondary};color:{COLORS.background}"
|
||||||
disabled={!userInput}
|
disabled={!userInput}
|
||||||
|
Reference in New Issue
Block a user