GraphicsUtil.js 555 B

123456789101112131415161718192021222324252627
  1. /**
  2. * SVGs for elements are generated by the {@link GraphicsFactory}.
  3. *
  4. * This utility gives quick access to the important semantic
  5. * parts of an element.
  6. */
  7. /**
  8. * Returns the visual part of a diagram element
  9. *
  10. * @param {Snap<SVGElement>} gfx
  11. *
  12. * @return {Snap<SVGElement>}
  13. */
  14. export function getVisual(gfx) {
  15. return gfx.childNodes[0];
  16. }
  17. /**
  18. * Returns the children for a given diagram element.
  19. *
  20. * @param {Snap<SVGElement>} gfx
  21. * @return {Snap<SVGElement>}
  22. */
  23. export function getChildren(gfx) {
  24. return gfx.parentNode.childNodes[1];
  25. }