Skip to content

Commit

Permalink
feat(createViewer): Add setSlicingPlanesEnabled
Browse files Browse the repository at this point in the history
  • Loading branch information
thewtex committed Jul 24, 2018
1 parent 0e013f7 commit 14e8a9e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/createViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,15 @@ const createViewer = (
}
}

let slicingPlanesEnabled = false;
publicAPI.setSlicingPlanesEnabled = (slicingPlanes) => {
const toggleSlicingPlanesButton = document.getElementById(`${viewerDOMId}-toggleSlicingPlanesButton`);
if (slicingPlanes && !slicingPlanesEnabled || !slicingPlanes && slicingPlanesEnabled) {
slicingPlanesEnabled = !slicingPlanesEnabled;
toggleSlicingPlanesButton.click();
}
}

publicAPI.captureImage = () => {
return view.captureImage();
}
Expand Down
4 changes: 2 additions & 2 deletions src/userInterface/createImageUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ function createViewPlanesToggle(
}

const viewPlanesButton = document.createElement('div');
viewPlanesButton.innerHTML = `<input id="${viewerDOMId}-viewPlanes" type="checkbox" class="${
viewPlanesButton.innerHTML = `<input id="${viewerDOMId}-toggleSlicingPlanesButton" type="checkbox" class="${
style.toggleInput
}"><label class="${style.viewPlanesButton} ${
style.toggleButton
}" for="${viewerDOMId}-viewPlanes">${viewPlansIcon}</label>`;
}" for="${viewerDOMId}-toggleSlicingPlanesButton">${viewPlansIcon}</label>`;
viewPlanesButton.addEventListener('change', (event) => {
setViewPlanes();
});
Expand Down
2 changes: 1 addition & 1 deletion src/userInterface/createMainUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ function createMainUI(
document.getElementById(`${viewerDOMId}-volumeRenderingButton`).checked = true;
const volumeRenderingRow = uiContainer.querySelector(`.${viewerDOMId}-volumeRendering`);
volumeRenderingRow.style.display = 'flex';
const viewPlanes = document.getElementById(`${viewerDOMId}-viewPlanes`).checked;
const viewPlanes = document.getElementById(`${viewerDOMId}-toggleSlicingPlanesButton`).checked;
const xPlaneRow = uiContainer.querySelector(`.${viewerDOMId}-x-plane-row`);
const yPlaneRow = uiContainer.querySelector(`.${viewerDOMId}-y-plane-row`);
const zPlaneRow = uiContainer.querySelector(`.${viewerDOMId}-z-plane-row`);
Expand Down

0 comments on commit 14e8a9e

Please sign in to comment.