@antv/g2
Version:
the Grammar of Graphics in Javascript
30 lines • 893 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.show = exports.hide = exports.setStyle = exports.getStyle = void 0;
const defaultStyle = {
visibility: 'visible',
opacity: 1,
fillOpacity: 1,
strokeOpacity: 1,
};
function getStyle(element, key) {
var _a;
return (_a = element.style[key]) !== null && _a !== void 0 ? _a : defaultStyle[key];
}
exports.getStyle = getStyle;
function setStyle(element, key, value, recursive) {
element.style[key] = value;
if (recursive) {
element.children.forEach((child) => setStyle(child, key, value, recursive));
}
}
exports.setStyle = setStyle;
function hide(element) {
setStyle(element, 'visibility', 'hidden', true);
}
exports.hide = hide;
function show(element) {
setStyle(element, 'visibility', 'visible', true);
}
exports.show = show;
//# sourceMappingURL=style.js.map
;