More reliable check of the link scroll activation

This commit is contained in:
Bruno Alves de Faria 2018-01-05 08:10:23 -02:00
parent 1983ee18a1
commit 646b4df8c9

View File

@ -340,6 +340,24 @@ const isStackScrollLinkingDisabled = () => {
return linkableViewportsCount <= 1;
};
const isStackScrollLinkingActive = () => {
let isActive = true;
// Its called everytime active viewport layout changes
Session.get('LayoutManagerUpdated');
const synchronizer = OHIF.viewer.stackImagePositionOffsetSynchronizer;
const syncedElements = _.pluck(synchronizer.syncedViewports, 'element');
const $renderedViewports = $('.imageViewerViewport');
$renderedViewports.each((index, element) => {
if (!_.contains(syncedElements, element)) {
isActive = false;
}
});
return isActive;
};
// Create an event listener to update playing state when a clip stops playing
$(window).on('CornerstoneToolsClipStopped', () => Session.set('UpdateCINE', Math.random()));
@ -370,7 +388,8 @@ const viewportUtils = {
isDownloadEnabled,
hasMultipleFrames,
stopAllClips,
isStackScrollLinkingDisabled
isStackScrollLinkingDisabled,
isStackScrollLinkingActive
};
export { viewportUtils };