drawLine(line, dashed = false, alpha = 1.0) {
    let ctx = this.ctx;
    let offsetX = this.offsetX;
    let offsetY = this.offsetY; // Add a shadow behind the line

    let shortLine = line.clone().shorten(4.0);
    let l = shortLine.getLeftVector().clone();
    let r = shortLine.getRightVector().clone();
    l.x += offsetX;
    l.y += offsetY;
    r.x += offsetX;
    r.y += offsetY; // Draw the "shadow"

    if (!dashed) {
      ctx.save();
      ctx.globalCompositeOperation = 'destination-out';
      ctx.beginPath();
      ctx.moveTo(l.x, l.y);
      ctx.lineTo(r.x, r.y);
      ctx.lineCap = 'round';
      ctx.lineWidth = this.opts.bondThickness + 1.2;
      ctx.strokeStyle = this.themeManager.getColor('BACKGROUND');
      ctx.stroke();
      ctx.globalCompositeOperation = 'source-over';
      ctx.restore();
    }

    l = line.getLeftVector().clone();
    r = line.getRightVector().clone();
    l.x += offsetX;
    l.y += offsetY;
    r.x += offsetX;
    r.y += offsetY;
    ctx.save();
    ctx.beginPath();
    ctx.moveTo(l.x, l.y);
    ctx.lineTo(r.x, r.y);
    ctx.lineCap = 'round';
    ctx.lineWidth = this.opts.bondThickness;
    let gradient = this.ctx.createLinearGradient(l.x, l.y, r.x, r.y);
    gradient.addColorStop(0.4, this.themeManager.getColor(line.getLeftElement()) || this.themeManager.getColor('C'));
    gradient.addColorStop(0.6, this.themeManager.getColor(line.getRightElement()) || this.themeManager.getColor('C'));

    if (dashed) {
      ctx.setLineDash([1, 1.5]);
      ctx.lineWidth = this.opts.bondThickness / 1.5;
    }

    if (alpha < 1.0) {
      ctx.globalAlpha = alpha;
    }

    ctx.strokeStyle = gradient;
    ctx.stroke();
    ctx.restore();
  }
Draw a line to a canvas.

@param {Line} line A line.
@param {Boolean} [dashed=false] Whether or not the line is dashed.
@param {Number} [alpha=1.0] The alpha value of the color.