drawLine(line, dashed = false, gradient = null, linecap = 'round') {
    let opts = this.opts,
        stylesArr = [['stroke-width', this.opts.bondThickness], ['stroke-linecap', linecap], ['stroke-dasharray', dashed ? '5, 5' : 'none']],
        l = line.getLeftVector(),
        r = line.getRightVector(),
        fromX = l.x,
        fromY = l.y,
        toX = r.x,
        toY = r.y;
    let styles = stylesArr.map(sub => sub.join(':')).join(';'),
        lineElem = document.createElementNS('http://www.w3.org/2000/svg', 'line');
    lineElem.setAttributeNS(null, 'x1', fromX);
    lineElem.setAttributeNS(null, 'y1', fromY);
    lineElem.setAttributeNS(null, 'x2', toX);
    lineElem.setAttributeNS(null, 'y2', toY);
    lineElem.setAttributeNS(null, 'style', styles);
    this.paths.push(lineElem);

    if (gradient == null) {
      gradient = this.createGradient(line, fromX, fromY, toX, toY);
    }

    lineElem.setAttributeNS(null, 'stroke', `url('#${gradient}')`);
  }
Draws a line.

@param {Line} line A line.
@param {Boolean} dashed defaults to false.
@param {String} gradient gradient url. Defaults to null.