move static method
DiagramVectorPath
move(
- DiagramVectorPath path,
- String nodeId,
- DiagramPathControl control,
- DiagramPoint position,
Implementation
static DiagramVectorPath move(
DiagramVectorPath path,
String nodeId,
DiagramPathControl control,
DiagramPoint position,
) {
final index = _index(path, nodeId);
var node = path.nodes[index];
if (control == DiagramPathControl.anchor) {
node = node.copyWith(position: position);
} else {
final incoming = control == DiagramPathControl.incoming;
final delta = position - node.position;
final opposite = incoming ? node.outgoing : node.incoming;
final paired = node.mode == DiagramPathHandleMode.corner
? opposite
: delta *
-(node.mode == DiagramPathHandleMode.symmetric
? 1.0
: (delta.magnitude == 0
? 0.0
: opposite.magnitude / delta.magnitude));
node = node.copyWith(
incoming: incoming ? delta : paired,
outgoing: incoming ? paired : delta,
);
}
return _replace(path, index, node);
}