Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

playClip works better when timer fires slowly #1519

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/stackTools/playClip.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
playClipData = {
intervalId: undefined,
framesPerSecond: 30,
lastFrameTimeStamp: undefined,
lastFrameTimeStamp: new Date().getTime(),
frameRate: 0,
frameTimeVector: undefined,
ignoreFrameTimeVector: false,
Expand Down Expand Up @@ -182,15 +182,19 @@
startLoadingHandler,
endLoadingHandler,
errorLoadingHandler,
newlastFrameTimeStamp = new Date().getTime(),
deltatime = newlastFrameTimeStamp - playClipData.lastFrameTimeStamp,
frames = Math.round((playClipData.framesPerSecond / 1000) * deltatime),

Check warning on line 187 in src/stackTools/playClip.js

View check run for this annotation

Codecov / codecov/patch

src/stackTools/playClip.js#L185-L187

Added lines #L185 - L187 were not covered by tests
newImageIdIndex = stackData.currentImageIdIndex;

const imageCount = stackData.imageIds.length;

if (playClipData.reverse) {
newImageIdIndex--;
newImageIdIndex -= frames;

Check warning on line 193 in src/stackTools/playClip.js

View check run for this annotation

Codecov / codecov/patch

src/stackTools/playClip.js#L193

Added line #L193 was not covered by tests
} else {
newImageIdIndex++;
newImageIdIndex += frames;

Check warning on line 195 in src/stackTools/playClip.js

View check run for this annotation

Codecov / codecov/patch

src/stackTools/playClip.js#L195

Added line #L195 was not covered by tests
}
playClipData.lastFrameTimeStamp = newlastFrameTimeStamp;

Check warning on line 197 in src/stackTools/playClip.js

View check run for this annotation

Codecov / codecov/patch

src/stackTools/playClip.js#L197

Added line #L197 was not covered by tests

if (
!playClipData.loop &&
Expand Down