replacePathSegMethod = function (type, index, pts, elem) {
  const path = svgCanvas.getPathObj()
  const pth = elem || path.elem
  const pathFuncs = svgCanvas.getPathFuncs()
  const func = 'createSVGPathSeg' + pathFuncs[type]
  const seg = pth[func](...pts)

  pth.pathSegList.replaceItem(seg, index)
}
This replaces the segment at the given index. Type is given as number.
@function module:path.replacePathSeg
@param {Integer} type Possible values set during {@link module:path.init}
@param {Integer} index
@param {ArgumentsArray} pts
@param {SVGPathElement} elem
@returns {void}