export function makeSourceAndTarget(instance, el) {
  instance.makeSource(el, {
    filter: '.legend-ep',
    anchor: 'Continuous',
    connectorStyle: {
      stroke: '#5c96bc',
      strokeWidth: 2,
      outlineStroke: 'transparent',
      outlineWidth: 4
    },
    connectionType: 'basic',
    extract: {
      action: 'the-action'
    }
    // maxConnections: 2,
    // onMaxConnections: function (info, e) {
    //   alert('Maximum connections (' + info.maxConnections + ') reached');
    // }
  })

  instance.makeTarget(el, {
    dropOptions: { hoverClass: 'dragHover' },
    anchor: 'Continuous',
    allowLoopback: true
  })
}

export function initLegend(instance, el) {
  instance.draggable(el)

  makeSourceAndTarget(instance, el)
}
