make the return value of the calcImageIndex function more robust

This commit is contained in:
Spedon
2023-03-14 11:16:11 +08:00
parent 8aa97b2c06
commit 72760e6388

View File

@@ -93,6 +93,6 @@ export function calcImageIndex(index: number, imgCounts: number): number {
if (index >= 0) { if (index >= 0) {
return index % imgCounts return index % imgCounts
} else { } else {
return imgCounts + (index % imgCounts) return (imgCounts + (index % imgCounts)) % imgCounts
} }
} }