src/app/script.js
/**
 * Dragging drawing the new position and line.
 * @param {DragEvent} event object of event.
 */
Dragging drawing the new position and line.
@param {DragEvent} event object of event.
Dragging drawing the new position and line . @param { DragEvent } event object of event .
function onDragMove() {
  if (this.dragging) {
    const newPosition = this.data.getLocalPosition(this.parent);
    this.x = newPosition.x;
    this.y = newPosition.y;
    const edges = Object.keys(this.edges);
    for (let i = 0; i < edges.length; i += 1) {
      drawLine(this.edges[edges[i]].line, this.x, this.y, this.edges[edges[i]].edge.x, this.edges[edges[i]].edge.y, this.edges[edges[i]].line.colour);
      this.edges[edges[i]].num.x = (this.x + this.edges[edges[i]].edge.x) / 2;
      this.edges[edges[i]].num.y = (this.y + this.edges[edges[i]].edge.y) / 2;
      this.edges[edges[i]].num.y += 10;
    }
  }
}
function onDragMove ( ) { if ( this . dragging ) { const newPosition = this . data . getLocalPosition ( this . parent ) ; this . x = newPosition . x ; this . y = newPosition . y ; const edges = Object . keys ( this . edges ) ; for ( let i = 0 ; i < edges . length ; i += 1 ) { drawLine ( this . edges [ edges [ i ] ] . line , this . x , this . y , this . edges [ edges [ i ] ] . edge . x , this . edges [ edges [ i ] ] . edge . y , this . edges [ edges [ i ] ] . line . colour ) ; this . edges [ edges [ i ] ] . num . x = ( this . x + this . edges [ edges [ i ] ] . edge . x ) / 2 ; this . edges [ edges [ i ] ] . num . y = ( this . y + this . edges [ edges [ i ] ] . edge . y ) / 2 ; this . edges [ edges [ i ] ] . num . y += 10 ; } } }
Dragging drawing the new position and line.
Dragging drawing the new position and line .