Skip to content

Commit 65e5513

Browse files
biharckdannyrb
authored andcommitted
fix: moving stopClip to be called before cornerstone.disable (#32)
1 parent 41f69cb commit 65e5513

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/CornerstoneViewport/CornerstoneViewport.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -550,22 +550,17 @@ class CornerstoneViewport extends Component {
550550
// TODO[cornerstoneTools]: Make this happen internally
551551
cornerstoneTools.clearToolState(element, 'stackPrefetch');
552552

553-
// Disable the viewport element with Cornerstone
554-
// This also triggers the removal of the element from all available
555-
// synchronizers, such as the one used for reference lines.
556-
cornerstone.disable(element);
557-
558553
// Try to stop any currently playing clips
559554
// Otherwise the interval will continuously throw errors
560555
// TODO[cornerstoneTools]: Make this happen internally
561-
try {
562-
const enabledElement = cornerstone.getEnabledElement(element);
563-
if (enabledElement) {
564-
cornerstoneTools.stopClip(element);
565-
}
566-
} catch (error) {
567-
//console.warn(error);
556+
const enabledElement = cornerstone.getEnabledElement(element);
557+
if (enabledElement) {
558+
cornerstoneTools.stopClip(element);
568559
}
560+
// Disable the viewport element with Cornerstone
561+
// This also triggers the removal of the element from all available
562+
// synchronizers, such as the one used for reference lines.
563+
cornerstone.disable(element);
569564

570565
if (this.props.clearViewportSpecificData) {
571566
this.props.clearViewportSpecificData();

0 commit comments

Comments
 (0)