escher.js
/**
 * Move the node and its labels and beziers.
 */
Move the node and its labels and beziers.
Move the node and its labels and beziers .
function move_node_and_dependents (node, node_id, reactions, beziers, displacement) {
  var updated = move_node_and_labels(node, reactions, displacement)
  node.connected_segments.map(function(segment_obj) {
    var reaction = reactions[segment_obj.reaction_id]
    if (_.isUndefined(reaction)) return
    var segment_id = segment_obj.segment_id
    var segment = reaction.segments[segment_id]
    var cs = [ [ 'b1', 'from_node_id' ], [ 'b2', 'to_node_id' ] ]
    cs.forEach(function (c) {
      var bez = c[0]
      var node = c[1]
      if (segment[node] === node_id && segment[bez]) {
        segment[bez] = utils.c_plus_c(segment[bez], displacement)
        var tbez = beziers[bezier_id_for_segment_id(segment_id, bez)]
        tbez.x = segment[bez].x
        tbez.y = segment[bez].y
      }
    })
    if (updated.reaction_ids.indexOf(segment_obj.reaction_id) < 0) {
      updated.reaction_ids.push(segment_obj.reaction_id)
    }
  })
  return updated
}
function move_node_and_dependents ( node , node_id , reactions , beziers , displacement ) { var updated = move_node_and_labels ( node , reactions , displacement ) node . connected_segments . map ( function ( segment_obj ) { var reaction = reactions [ segment_obj . reaction_id ] if ( _ . isUndefined ( reaction ) ) return var segment_id = segment_obj . segment_id var segment = reaction . segments [ segment_id ] var cs = [ [ 'b1' , 'from_node_id' ] , [ 'b2' , 'to_node_id' ] ] cs . forEach ( function ( c ) { var bez = c [ 0 ] var node = c [ 1 ] if ( segment [ node ] === node_id && segment [ bez ] ) { segment [ bez ] = utils . c_plus_c ( segment [ bez ] , displacement ) var tbez = beziers [ bezier_id_for_segment_id ( segment_id , bez ) ] tbez . x = segment [ bez ] . x tbez . y = segment [ bez ] . y } } ) if ( updated . reaction_ids . indexOf ( segment_obj . reaction_id ) < 0 ) { updated . reaction_ids . push ( segment_obj . reaction_id ) } } ) return updated }
Move the node and its labels and beziers.
Move the node and its labels and beziers .
// move beziers // If the reaction was not passed in the reactions argument, then ignore // Update beziers // add to list of updated reaction ids if it isn't already there