code: function(evt, x, y) {
  
          if ( // target is a valid magnet start linking
              evt.target.getAttribute('magnet') &&
              this.paper.options.validateMagnet.call(this.paper, this, evt.target)
          ) {
                  this.model.trigger('batch:start');
  
                  var link = this.paper.getDefaultLink(this, evt.target);
                  link.set({
                      source: {
                          id: this.model.id,
                          selector: this.getSelector(evt.target),
                          port: $(evt.target).attr('port')
                      },
                      target: { x: x, y: y }
                  });
  
                  this.paper.model.addCell(link);
  
  	        this._linkView = this.paper.findViewByModel(link);
                  this._linkView.startArrowheadMove('target');
  
          } else {
  
              this._dx = x;
              this._dy = y;
  
              joint.dia.CellView.prototype.pointerdown.apply(this, arguments);
          }
      }
docs: Interaction. The controller part. ---------------------------------