MCPcopy Create free account
hub / github.com/WardAnalytics/WardGraph / addNewAddressToCenter

Function addNewAddressToCenter

src/components/graph/Graph.tsx:788–808  ·  view source on GitHub ↗
(address: string)

Source from the content-addressed store, hash-verified

786 // Adding New Address -------------------------------------------------------
787
788 function addNewAddressToCenter(address: string) {
789 // Calculate flow position of the center of the screen
790 const centerX = window.innerWidth / 2;
791 const centerY = window.innerHeight / 2;
792 const graphCenterPosition = screenToFlowPosition({
793 x: centerX,
794 y: centerY,
795 });
796
797 // Add new node while accounting for the node width and height so that it's truly at the center
798 const newNode = createAddressNode(
799 address,
800 AddressNodeState.MINIMIZED,
801 true,
802 graphCenterPosition.x - 100,
803 graphCenterPosition.y - 50,
804 true,
805 );
806 const newNodes = [...nodes, newNode];
807 setNodes(newNodes);
808 }
809
810 // Edge Hovering ------------------------------------------------------------
811

Callers 1

handleSearchAddressFunction · 0.85

Calls 1

createAddressNodeFunction · 0.90

Tested by

no test coverage detected