mouseMove()

in src/components/draggable.js [72:87]


  mouseMove(e) {
    const {position, source, target} = this
    position.x += e.movementX
    position.y += e.movementY
    const topLeft = globalToLocal(position, source)

    // add the relative offset of the source to its <svg> element
    // ...why? ¯\_(ツ)_/¯ I have no idea!
    const offset = getRelativeOffset(source)
    topLeft.x += offset.x
    topLeft.y += offset.y

    source.setAttribute('transform', `translate(${[topLeft.x, topLeft.y]})`)
    target.style.setProperty('left', px(position.x))
    target.style.setProperty('top', px(position.y))
  }