# all files / diagram-js/lib/util/ RenderUtil.js

100% Statements 12/12
100% Branches 2/2
100% Functions 4/4
100% Lines 12/12

    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
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38

    3369×

    6557×

    6557×
    15658×

    6557×

    5482×
    5482×

    5482×
    1447×

    5482×

    1075×

    1075×

     import {
      attr as svgAttr,
      create as svgCreate
    } from 'tiny-svg';

    export function componentsToPath(elements) {
      return elements.join(',').replace(/,?([A-z]),?/g, '$1');
    }

    export function toSVGPoints(points) {
      var result = '';

      for (var i = 0, p; (p = points[i]); i++) {
        result += p.x + ',' + p.y + ' ';
      }

      return result;
    }

    export function createLine(points, attrs) {

      var line = svgCreate('polyline');
      svgAttr(line, { points: toSVGPoints(points) });

      if (attrs) {
        svgAttr(line, attrs);
      }

      return line;
    }

    export function updateLine(gfx, points) {
      svgAttr(gfx, { points: toSVGPoints(points) });

      return gfx;
    }