Release v2.4
π 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 pointssetPointImageIndices(imageIndices)
- Specify which image each point should usesetPointImageSizes(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 aReadonlyMap
instead of aMap
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