Skip to content

Commit

Permalink
reset image index to zero when milestone is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
lkeegan committed Oct 17, 2024
1 parent 294bc62 commit 5cc3927
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion frontend/src/lib/components/Milestone.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
const imageInterval = 5000;
setInterval(() => {
if (currentMilestone && currentMilestone.images) {
if (currentMilestone && currentMilestone.images && currentMilestone.images.length > 0) {
currentImageIndex = (currentImageIndex + 1) % currentMilestone.images.length;
}
}, imageInterval);
Expand All @@ -62,6 +62,7 @@
return;
}
currentMilestoneIndex -= 1;
currentImageIndex = 0;
currentMilestone = milestoneGroup.milestones[currentMilestoneIndex];
}
Expand Down Expand Up @@ -92,6 +93,7 @@
return;
}
currentMilestoneIndex += 1;
currentImageIndex = 0;
currentMilestone = milestoneGroup.milestones[currentMilestoneIndex];
}
Expand Down

0 comments on commit 5cc3927

Please sign in to comment.