Skip to content

Commit b84c171

Browse files
ckedarkedar.netelixir
andauthored
fix: If stack changes while isPlaying, stopClip and then playClip after first image load (#72)
Co-authored-by: kedar.netelixir <[email protected]>
1 parent cba8955 commit b84c171

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/CornerstoneViewport/CornerstoneViewport.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ class CornerstoneViewport extends Component {
229229
try {
230230
// load + display image
231231
const imageId = stack[imageIndex];
232+
cornerstoneTools.stopClip(this.element);
232233
const image = await cornerstone.loadAndCacheImage(imageId);
233234

234235
cornerstone.displayImage(this.element, image);
@@ -270,7 +271,9 @@ class CornerstoneViewport extends Component {
270271
isOverlayVisible: prevIsOverlayVisible,
271272
} = prevProps;
272273
const validFrameRate = Math.max(frameRate, 1);
273-
const shouldStart = isPlaying !== prevIsPlaying && isPlaying;
274+
const shouldStart =
275+
(isPlaying !== prevIsPlaying && isPlaying) ||
276+
(isPlaying && hasStackChanged);
274277
const shouldPause = isPlaying !== prevIsPlaying && !isPlaying;
275278
const hasFrameRateChanged = isPlaying && frameRate !== prevFrameRate;
276279

0 commit comments

Comments
 (0)