Skip to content

Commit

Permalink
Merge pull request #1205 from skrashevich/fix-keep-netmap-selections
Browse files Browse the repository at this point in the history
fix(network): preserve selected nodes and edges on data reload
  • Loading branch information
AlexxIT authored Feb 24, 2025
2 parents 2d1e08b + 4b4a164 commit 1ab05e5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions www/network.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
const positions = network.getPositions();
const viewPosition = network.getViewPosition();
const scale = network.getScale();
const selectedNodes = network.getSelectedNodes();

network.setData(data);

Expand All @@ -65,6 +66,8 @@
}

network.moveTo({position: viewPosition, scale: scale});

network.selectNodes(selectedNodes);
}
} catch (error) {
console.error('Error fetching or updating network data:', error);
Expand Down

0 comments on commit 1ab05e5

Please sign in to comment.