Skip to content

Release v2.4

Choose a tag to compare

@Stukova Stukova released this 26 Aug 02:01
· 20 commits to main since this release

πŸŽ‰ What's New

Multiple Point Shapes Support with new API method setPointShapes

You can now assign Circle, Square, Triangle, Diamond, Pentagon, Hexagon, Star and Cross shapes to individual points in your graph. All points default to Circle shape.

graph.setPointShapes(new Float32Array([
  PointShape.Circle, 
  PointShape.Square, 
  PointShape.Triangle, 
  // ...
]));

Custom Image Rendering Support

Added support for image rendering on points. Custom images are drawn on top of shapes. New API methods added:

  • setImageData(imageDataArray) - Set the images to use for points
  • setPointImageIndices(imageIndices) - Specify which image each point should use
  • setPointImageSizes(imageSizes) - Set custom sizes for each point's image
const imageData = new ImageData(/* your image data */);
graph.setImageData([imageData]);
graph.setPointImageIndices(new Float32Array([0, 0, 0])); // Use image 0 for all points

Enhanced View Fitting with new configuration property fitViewByPointIndices

Configure automatic view fitting to specific point indices during graph initialization.

πŸ”§ Improvements

Rendering and Performance Enhancements

  • Enhanced Arrow Scaling: Improved arrow scaling logic for better visual representation across different zoom levels
  • Selected Points Priority: Selected points now render in front of unselected points, improving visibility and user interaction feedback
  • Tracked positions optimization: Getting tracked point positions (getTrackedPointPositionsMap() method) is now significantly faster when simulation isn't running, preventing lag in static visualizations

Code Quality

  • ESLint improvements: Added @typescript-eslint/naming-convention rules for consistent code style

⚠️ Breaking Changes

API Return Type Changes

  • getTrackedPointPositionsMap() method now returns a ReadonlyMap instead of a Map

Migration Guide: If you were modifying the returned map from getTrackedPointPositionsMap(), you'll need to create a new Map from the ReadonlyMap result.

// Before (breaking)
const positions = graph.getTrackedPointPositionsMap();
positions.set(key, value); // ❌ This will now fail

// After (fixed)
const positions = new Map(graph.getTrackedPointPositionsMap());
positions.set(key, value); // βœ… This works