Skip to content

Commit

Permalink
feat: update graphin
Browse files Browse the repository at this point in the history
  • Loading branch information
pomelo-nwu committed Nov 21, 2023
1 parent b15405b commit d69bce7
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions packages/graphin/src/compatible/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,20 @@ export default (graph: IGraph) => {
},
paint: () => {},
getNodes: () => {
return graph.getAllNodesData();
return graph.getAllNodesData().map(item => {
return {
...item,
getModel: () => item,
};
});
},
getEdges: () => {
return graph.getAllEdgesData();
return graph.getAllEdgesData().map(item => {
return {
...item,
getModel: () => item,
};
});
},
clearItemStates: node => {
const isString = typeof node === 'string';
Expand All @@ -51,7 +61,14 @@ export default (graph: IGraph) => {
}
},
findById: id => {
return graph.getItemById(id);
const { graphCore } = graph.dataController;
return {
getNeighbors: () => {
return graphCore.getNeighbors(id);
},
getEdges: () => graphCore.bothEdgesMap.get(id),
...graph.getItemById(id),
};
},
});
return graph;
Expand Down

0 comments on commit d69bce7

Please sign in to comment.