Skip to content

Release v1.3

Compare
Choose a tag to compare
@Stukova Stukova released this 23 Mar 04:45
· 52 commits to main since this release

Release 1.3 of Cosmos implements a bunch of new features making your work with graphs way more comfortable. Our personal highlight is the trackNodePositionsBy methods allowing you to continuously get coordinates for chosen nodes and render labels for them.

We deliberately decided not to add labels rendering functionality to Cosmos itself to keep the library tiny. Instead we've created a separate package @interacta/css-labels that you can use along with Cosmos to add labels to your graph. Check out this CodeSanbox example for copy-pastable sample code.

What's new:

  • πŸ€– New API methods getNodeRadiusByIndex, getNodeRadiusById, spaceToScreenPosition, spaceToScreenRadius, trackNodePositionsByIds, trackNodePositionsByIndices and getTrackedNodePositionsMap;
  • 🌱 Random seed. You can now provide randomSeed in the config. It allows you to control the randomness of the layout across different simulation runs. This feature was implemented thanks to @jorrit-hdrn's feedback in issue #19;
  • πŸ–±οΈ Mouse events. You can now add callbacks to onMouseMove, onNodeMouseOver and onNodeMouseOut events in the config;
  • βšͺ Highlight nodes with a ring when hovered or clicked. Config properties renderHighlightedNodeRing allow you to turn on/off highlighting and highlightedNodeRingColor allow you to set the color of the ring #24;
  • πŸ” Define scale when zooming to a node programmatically. New arguments scale and canZoomOut are available in the zoomToNodeById and zoomToNodeByIndex methods;
  • πŸ‘¨β€πŸ’» Renamed Types: InputNode to CosmosInputNode and InputLink to CosmosInputLink (old naming will also be available till version 2.0 to preserve compatibility).