pixel-editor/js/FeatureToggles.js
2021-12-06 11:26:42 +01:00

34 lines
1022 B
JavaScript

const featureToggles = (function featureTogglesModule() {
const ellipseToolLocalStorageKey = 'feature_ellipseTool';
return {
onLoad: () => {
updateEllipseToolVisibility()
},
enableEllipseTool,
disableEllipseTool
}
////////
function updateEllipseToolVisibility() {
// TODO: [ELLIPSE] Once ellipse is ready for release make it enabled by default
const isEllipseToolEnabled = (window.localStorage.getItem(ellipseToolLocalStorageKey) === "yes") || false;
const ellipseToolElement = document.getElementById("tools-menu--ellipse");
ellipseToolElement.style.display = isEllipseToolEnabled ? 'block' : 'none';
}
function enableEllipseTool() {
window.localStorage.setItem(ellipseToolLocalStorageKey, "yes");
updateEllipseToolVisibility();
}
function disableEllipseTool() {
window.localStorage.setItem(ellipseToolLocalStorageKey, "no");
updateEllipseToolVisibility();
}
})();