UNPKG

@antv/g2

Version:

the Grammar of Graphics in Javascript

23 lines 668 B
const defaultStyle = { visibility: 'visible', opacity: 1, fillOpacity: 1, strokeOpacity: 1, }; export function getStyle(element, key) { var _a; return (_a = element.style[key]) !== null && _a !== void 0 ? _a : defaultStyle[key]; } export function setStyle(element, key, value, recursive) { element.style[key] = value; if (recursive) { element.children.forEach((child) => setStyle(child, key, value, recursive)); } } export function hide(element) { setStyle(element, 'visibility', 'hidden', true); } export function show(element) { setStyle(element, 'visibility', 'visible', true); } //# sourceMappingURL=style.js.map