Revert "OHIF-27: PlayClipController"

This reverts commit 72c08147d4.
This commit is contained in:
Leonardo Campos committed 2017-05-22 18:48:45 -03:00
1 parent f84aeac3c3
commit c5c5ddf282
7 files changed
+32 -339

No files matched your search

@@ -6,7 +6,6 @@ import { _ } from 'meteor/underscore';
import { OHIF } from 'meteor/ohif:core';
import { updateOrientationMarkers } from './updateOrientationMarkers';
import { getInstanceClassDefaultViewport } from './instanceClassSpecificViewport';
import { PlayClipManager } from './classes/PlayClipManager';
/**
* Get a cornerstone enabledElement for a DOM Element
@@ -196,12 +195,16 @@ const toggleDialog = element => {
const toggleCinePlay = () => {
// Get the active viewport element
const element = getActiveViewportElement();
const playClipManager = PlayClipManager.getInstance();
const playClipController = playClipManager.get(element);
if (playClipController) {
playClipController.togglePlay();
// Check if it's playing the clip to toggle it
if (isPlaying()) {
cornerstoneTools.stopClip(element);
} else {
cornerstoneTools.playClip(element);
}
// Update the UpdateCINE session property
Session.set('UpdateCINE', Random.id());
};
// Show/hide the CINE dialog
@@ -216,11 +219,29 @@ const isPlaying = () => {
Session.get('UpdateCINE');
Session.get('LayoutManagerUpdated');
// Get the viewport element and its current playClip tool state
const element = getActiveViewportElement();
const playClipManager = PlayClipManager.getInstance();
const playClipController = playClipManager.get(element);
// Empty Elements throws cornerstore exception
if (!element || !$(element).find('canvas').length) {
return;
}
return playClipController && playClipController.isPlaying();
const toolState = cornerstoneTools.getToolState(element, 'playClip');
// Stop here if the tool state is not defined yet
if (!toolState) {
return false;
}
// Get the clip state
const clipState = toolState.data[0];
if(clipState) {
// Return true if the clip is playing
return !_.isUndefined(clipState.intervalId);
}
return false;
};
// Check if a study has multiple frames