style.js 893 B

123456789101112131415161718192021222324252627282930
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.show = exports.hide = exports.setStyle = exports.getStyle = void 0;
  4. const defaultStyle = {
  5. visibility: 'visible',
  6. opacity: 1,
  7. fillOpacity: 1,
  8. strokeOpacity: 1,
  9. };
  10. function getStyle(element, key) {
  11. var _a;
  12. return (_a = element.style[key]) !== null && _a !== void 0 ? _a : defaultStyle[key];
  13. }
  14. exports.getStyle = getStyle;
  15. function 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. }
  21. exports.setStyle = setStyle;
  22. function hide(element) {
  23. setStyle(element, 'visibility', 'hidden', true);
  24. }
  25. exports.hide = hide;
  26. function show(element) {
  27. setStyle(element, 'visibility', 'visible', true);
  28. }
  29. exports.show = show;
  30. //# sourceMappingURL=style.js.map