UNPKG

893 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.show = exports.hide = exports.setStyle = exports.getStyle = void 0;
4const defaultStyle = {
5 visibility: 'visible',
6 opacity: 1,
7 fillOpacity: 1,
8 strokeOpacity: 1,
9};
10function getStyle(element, key) {
11 var _a;
12 return (_a = element.style[key]) !== null && _a !== void 0 ? _a : defaultStyle[key];
13}
14exports.getStyle = getStyle;
15function setStyle(element, key, value, recursive) {
16 element.style[key] = value;
17 if (recursive) {
18 element.children.forEach((child) => setStyle(child, key, value, recursive));
19 }
20}
21exports.setStyle = setStyle;
22function hide(element) {
23 setStyle(element, 'visibility', 'hidden', true);
24}
25exports.hide = hide;
26function show(element) {
27 setStyle(element, 'visibility', 'visible', true);
28}
29exports.show = show;
30//# sourceMappingURL=style.js.map
\No newline at end of file