Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// ไธบ canvasStack ๆพๅฐ imageIds
let allImageIds = [];
this.exampleStudyImageIds.forEach(function(imageId) {
let imageUrl = "wadouri:" + _self.baseUrl + imageId;
allImageIds.push(imageUrl);
});
// Create canvasStack
let canvasStack = {
currentImageIdIndex: 0,
imageIds: allImageIds
};
// Enable Inputs
cornerstoneTools.mouseInput.enable(canvas);
cornerstoneTools.mouseWheelInput.enable(canvas);
cornerstoneTools.touchInput.enable(canvas);
// Set the stack as tool state
cornerstoneTools.addStackStateManager(canvas, ["stack"]);
cornerstoneTools.addToolState(canvas, "stack", canvasStack);
cornerstoneTools.stackScrollWheel.activate(canvas); // Mouse wheel
cornerstoneTools.scrollIndicator.enable(canvas); // Position indicator
// Mouse
cornerstoneTools.wwwc.activate(canvas, 1); // left click
cornerstoneTools.pan.activate(canvas, 2); // middle click
cornerstoneTools.zoom.activate(canvas, 4); // right click
// Touch / Gesture
cornerstoneTools.wwwcTouchDrag.activate(canvas); // - Drag
moveImg = /* istanbul ignore next */ () => {
const { touchMode } = this.state;
const cornerstoneElement = this.getImgBlock();
if (touchMode) {
this.setState({ touchMode: false });
this.swiper.allowTouchMove = false;
cornerstoneTools.mouseInput.enable(cornerstoneElement);
cornerstoneTools.pan.activate(cornerstoneElement, 1);
cornerstoneTools.wwwc.disable(cornerstoneElement)
} else {
this.setState({ touchMode: true });
this.swiper.allowTouchMove = true;
this.disableCornerstoneTools(cornerstoneElement)
}
};
_setup_tools: function () {
ctools.mouseInput.enable(this.viewer);
ctools.mouseWheelInput.enable(this.viewer);
ctools.wwwc.activate(this.viewer, 1); // Left Click
ctools.pan.activate(this.viewer, 2); // Middle Click
ctools.zoom.activate(this.viewer, 4); // Right Click
ctools.zoomWheel.activate(this.viewer); // Mouse Wheel
},
_disable_all_tools: function (element) {
disableCornerstoneTools = (cornerstoneElement) => {
cornerstoneTools.mouseInput.disable(cornerstoneElement);
cornerstoneTools.pan.disable(cornerstoneElement);
cornerstoneTools.wwwc.disable(cornerstoneElement);
};