lib/diagram/force-simulation/operator.js
/**
   * Set event handler for to svg diagram elements.
   * @private
   */
Set event handler for to svg diagram elements.
@private
Set event handler for to svg diagram elements . @private
_setDiagramElementsHandler() {
    const dragStart = (event, d) => {
      this.markNodeWith(d, ['fixed', true])
      d.fx = d.x
      d.fy = d.y
      this.restartSimulation()
    }
    const dragged = (event, d) => {
      d.fx = event.x
      d.fy = event.y
    }
    const dragFinished = (event) => {
      if (!event.active) {
        this.simulation.alphaTarget(0)
      }
    }
    const targets = ['node', 'node-circle', 'tp', 'tp-label', 'node-label']
    for (const target of targets) {
      this.rootSVGGroupSelection
        .selectAll(`.${target}`)
        .on('click', (event, d) => this._clickHandler(d))
        .on('dblclick', (event, d) => this._doubleClickHandler(d))
        .on('mouseover', (event, d) => this._mouseOverHandler(event, d))
        .on('mouseout', (event, d) => this._mouseOutHandler(d))
        .call(
          drag()
            .on('start', dragStart)
            .on('drag', dragged)
            .on('end', dragFinished)
        )
    }
  }
_setDiagramElementsHandler ( ) { const dragStart = ( event , d ) => { this . markNodeWith ( d , [ 'fixed' , true ] ) d . fx = d . x d . fy = d . y this . restartSimulation ( ) } const dragged = ( event , d ) => { d . fx = event . x d . fy = event . y } const dragFinished = ( event ) => { if ( ! event . active ) { this . simulation . alphaTarget ( 0 ) } } const targets = [ 'node' , 'node-circle' , 'tp' , 'tp-label' , 'node-label' ] for ( const target of targets ) { this . rootSVGGroupSelection . selectAll ( ` ${ target } ` ) . on ( 'click' , ( event , d ) => this . _clickHandler ( d ) ) . on ( 'dblclick' , ( event , d ) => this . _doubleClickHandler ( d ) ) . on ( 'mouseover' , ( event , d ) => this . _mouseOverHandler ( event , d ) ) . on ( 'mouseout' , ( event , d ) => this . _mouseOutHandler ( d ) ) . call ( drag ( ) . on ( 'start' , dragStart ) . on ( 'drag' , dragged ) . on ( 'end' , dragFinished ) ) } }
Set event handler for to svg diagram elements.
Set event handler for to svg diagram elements .