OHIF-129: Enabling CinePlay button only when active viewport has more than 1 image in its stack; Fixed some errors when CinePlay Dialog is open and stopped and layout changes.

This commit is contained in:
Eloízio Salgado committed 2016-11-07 12:01:03 -02:00
1 parent 12862aec51
commit a7ba6b49fe
11 files changed
+65 -13

No files matched your search

+39 -2
View File
@@ -159,9 +159,46 @@ isPlaying = () => {
// Get the clip state
const clipState = toolState.data[0];
if(clipState) {
// Return true if the clip is playing
return !_.isUndefined(clipState.intervalId);
}
// Return true if the clip is playing
return !_.isUndefined(clipState.intervalId);
return false;
};
// Check if a study has multiple frames
hasMultipleFrames = () => {
// Its called everytime active viewport and/or layout change
Session.get('activeViewport');
Session.get('LayoutManagerUpdated');
const activeViewport = getActiveViewportElement();
// No active viewport yet: disable button
if(!activeViewport) {
return true;
}
// Get images in the stack
const stackToolData = cornerstoneTools.getToolState(activeViewport, 'stack');
// No images in the stack, so disable button
if (!stackToolData || !stackToolData.data || !stackToolData.data.length) {
return true;
}
// Get number of images in the stack
const stackData = stackToolData.data[0];
const nImages = stackData.imageIds && stackData.imageIds.length ? stackData.imageIds.length : 1;
// Stack has just one image, so disable button
if(nImages === 1) {
return true;
}
return false;
};
// Create an event listener to update playing state when a clip stops playing