setBlur = function (val, complete) {
  const {
    InsertElementCommand, ChangeElementCommand, BatchCommand
  } = svgCanvas.history

  const selectedElements = svgCanvas.getSelectedElements()
  if (svgCanvas.getCurCommand()) {
    finishChange()
    return
  }

  // Looks for associated blur, creates one if not found
  const elem = selectedElements[0]
  const elemId = elem.id
  svgCanvas.setFilter(svgCanvas.getElement(elemId + '_blur'))

  val -= 0

  const batchCmd = new BatchCommand()

  // Blur found!
  if (svgCanvas.getFilter()) {
    if (val === 0) {
      svgCanvas.setFilter(null)
    }
  } else {
    // Not found, so create
    const newblur = svgCanvas.addSVGElementsFromJson({
      element: 'feGaussianBlur',
      attr: {
        in: 'SourceGraphic',
        stdDeviation: val
      }
    })

    svgCanvas.setFilter(svgCanvas.addSVGElementsFromJson({
      element: 'filter',
      attr: {
        id: elemId + '_blur'
      }
    }))
    svgCanvas.getFilter().append(newblur)
    svgCanvas.findDefs().append(svgCanvas.getFilter())

    batchCmd.addSubCommand(new InsertElementCommand(svgCanvas.getFilter()))
  }

  const changes = { filter: elem.getAttribute('filter') }

  if (val === 0) {
    elem.removeAttribute('filter')
    batchCmd.addSubCommand(new ChangeElementCommand(elem, changes))
    return
  }

  svgCanvas.changeSelectedAttribute('filter', 'url(#' + elemId + '_blur)')
  batchCmd.addSubCommand(new ChangeElementCommand(elem, changes))
  svgCanvas.setBlurOffsets(svgCanvas.getFilter(), val)
  const filter = svgCanvas.getFilter()
  svgCanvas.setCurCommand(batchCmd)
  svgCanvas.undoMgr.beginUndoableChange('stdDeviation', [filter ? filter.firstChild : null])
  if (complete) {
    svgCanvas.setBlurNoUndo(val)
    finishChange()
  }
}
Adds/updates the blur filter to the selected element.
@function module:svgcanvas.SvgCanvas#setBlur
@param {Float} val - Float with the new `stdDeviation` blur value
@param {boolean} complete - Whether or not the action should be completed (to add to the undo manager)
@returns {void}