Preventing re-rendering if viewport is on the same series

This commit is contained in:
Bruno Alves de Faria committed 2017-11-21 15:10:12 -02:00
1 parent 0eea7f9373
commit 7d2577b06f
3 files changed
+39 -15

No files matched your search

@@ -37,7 +37,7 @@ const getActiveViewportElement = () => {
/**
* Get a cornerstone enabledElement for the Active Viewport Element
* @return {Object} Cornerstone's enabledElement object for the active
* viewport element or undefined if the element
* viewport element or undefined if the element
* is not enabled
*/
const getEnabledElementForActiveElement = () => {
@@ -133,8 +133,7 @@ const flipH = () => {
updateOrientationMarkers(element, viewport);
};
const resetViewport = () => {
const element = getActiveViewportElement();
const resetViewportWithElement = element => {
const enabledElement = cornerstone.getEnabledElement(element);
if (enabledElement.fitToWindow === false) {
const imageId = enabledElement.image.imageId;
@@ -149,6 +148,18 @@ const resetViewport = () => {
}
};
const resetViewport = (viewportIndex=null) => {
if (viewportIndex === null) {
resetViewportWithElement(getActiveViewportElement());
} else if (viewportIndex === 'all') {
$('.imageViewerViewport').each((index, element) => {
resetViewportWithElement(element);
});
} else {
resetViewportWithElement($('.imageViewerViewport').get(viewportIndex));
}
};
const clearTools = () => {
const element = getActiveViewportElement();
const toolStateManager = cornerstoneTools.globalImageIdSpecificToolStateManager;
@@ -250,7 +261,7 @@ const isPlaying = () => {
// Get the clip state
const clipState = toolState.data[0];
if(clipState) {
// Return true if the clip is playing
return !_.isUndefined(clipState.intervalId);