Skip to content

Commit

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

let shadowEnabled = true;
publicAPI.setShadowEnabled = (shadow) => {
const toggleShadowButton = document.getElementById(`${viewerDOMId}-toggleShadowButton`);
if (shadow && !shadowEnabled || !shadow && shadowEnabled) {
shadowEnabled = !shadowEnabled;
toggleShadowButton.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 @@ -63,11 +63,11 @@ function createUseShadowToggle(
);

const useShadowButton = document.createElement('div');
useShadowButton.innerHTML = `<input id="${viewerDOMId}-useShadow" type="checkbox" class="${
useShadowButton.innerHTML = `<input id="${viewerDOMId}-toggleShadowButton" type="checkbox" class="${
style.toggleInput
}" checked><label class="${contrastSensitiveStyle.shadowButton} ${
style.toggleButton
}" for="${viewerDOMId}-useShadow">${shadowIcon}</label>`;
}" for="${viewerDOMId}-toggleShadowButton">${shadowIcon}</label>`;
let useShadow = true;
useShadowButton.addEventListener('change', (event) => {
useShadow = !useShadow;
Expand Down

0 comments on commit 0e013f7

Please sign in to comment.