mirror of
https://github.com/Sped0n/bridget.git
synced 2026-04-21 05:29:31 -07:00
now img index calculation is a standalone function in utils.ts
This commit is contained in:
@@ -88,3 +88,11 @@ export function createImgElement(input: ImageData): HTMLImageElement {
|
||||
img.setAttribute('width', input.imgW)
|
||||
return img
|
||||
}
|
||||
|
||||
export function calcImageIndex(index: number, imgCounts: number): number {
|
||||
if (index >= 0) {
|
||||
return index % imgCounts
|
||||
} else {
|
||||
return imgCounts + (index % imgCounts)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user