Skip to content

Commit

Permalink
Fix loadProgress
Browse files Browse the repository at this point in the history
  • Loading branch information
reindernijhoff committed May 15, 2024
1 parent f17c069 commit 994db81
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib/FastImageSequence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,10 @@ export class FastImageSequence {
public get loadProgress(): number {
const {used, numLoaded, numLoading, maxLoaded} = this.getLoadStatus();
const {used: usedTar, numLoading: numLoadingTar, numLoaded: numLoadedTar, maxLoaded: maxLoadedTar, tarLoadProgress} = this.getTarStatus();
return ((used ? Math.max(numLoaded - numLoading, 0) : 0) + (usedTar ? (Math.max(numLoadedTar - numLoadingTar, 0) / 2 + tarLoadProgress) : 0)) / ((used ? maxLoaded : 0) + (usedTar ? (maxLoadedTar / 2 + 1) : 0));
const imagesProgress = used ? Math.max(numLoaded - numLoading, 0) / maxLoaded : 0;
const tarProgress = usedTar ? Math.max(numLoadedTar - numLoadingTar, 0) / maxLoadedTar / 2 + tarLoadProgress / 2 : 0;

return (imagesProgress + tarProgress) / ((used ? 1 : 0) + (usedTar ? 1 : 0));
}

/**
Expand Down

0 comments on commit 994db81

Please sign in to comment.