function addMarker (dir, type, id) {
      // TODO: Make marker (or use?) per arrow type, since refX can be different
      id = id || arrowprefix + dir;

      const data = pathdata[dir];

      if (type === 'mid') {
        data.refx = 5;
      }

      let marker = svgCanvas.getElem(id);
      if (!marker) {
        marker = addElem({
          element: 'marker',
          attr: {
            viewBox: '0 0 10 10',
            id,
            refY: 5,
            markerUnits: 'strokeWidth',
            markerWidth: 5,
            markerHeight: 5,
            orient: 'auto',
            style: 'pointer-events:none' // Currently needed for Opera
          }
        });
        const arrow = addElem({
          element: 'path',
          attr: {
            d: data.d,
            fill: '#000000'
          }
        });
        marker.append(arrow);
        svgCanvas.findDefs().append(marker);
      }

      marker.setAttribute('refX', data.refx);

      return marker;
    }
@param {"bk"|"fw"} dir
@param {"both"|"mid"|"end"|"start"} type
@param {string} id
@returns {Element}