ohif-viewer/Packages/ohif-viewerbase/client/lib/switchToImageByIndex.js
Evren Ozkan 0a5feb9a0d Integrate Cornerstone Tools v3 (#235) - WIP
- fix(stack-scroll): Activate mouse wheel and scrollbar stack scroll
- fix(touch): Activate pinch zoom, two-finger pan and three (or more) finger stack scroll
2018-10-29 10:58:53 -04:00

19 lines
689 B
JavaScript

import { viewportUtils } from './viewportUtils';
import { cornerstoneTools } from 'meteor/ohif:cornerstone';
const scrollToIndex = cornerstoneTools.import('util/scrollToIndex');
/**
* This function switches to an image given an element and the index of the image in the current stack
* Note: Negative indexing is supported:
*
* e.g. switchToImageByIndex(element, -1) to switch to the last image of the stack
*
* @param element
* @param {number} [newImageIdIndex] The image index in the stack to switch to.
*/
export function switchToImageByIndex(newImageIdIndex) {
var element = viewportUtils.getActiveViewportElement();
scrollToIndex(element, newImageIdIndex);
}