all files / diagram-js/lib/util/ GraphicsUtil.js

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