ForegroundPainter constructor

ForegroundPainter({
  1. required List<AnimatedPointConnection> connections,
  2. required double radius,
  3. required double rotationZ,
  4. required double rotationY,
  5. required double rotationX,
  6. required double zoomFactor,
  7. required List<Point> points,
  8. Offset? hoverPoint,
  9. Offset? clickPoint,
  10. VoidCallback? onPointClicked,
  11. required dynamic hoverOverPoint(
    1. String pointId,
    2. Offset? hoverPoint,
    3. bool isHovering,
    4. bool isVisible,
    ),
  12. required dynamic hoverOverConnection(
    1. String connectionId,
    2. Offset? hoverPoint,
    3. bool isHovering,
    4. bool isVisible,
    ),
})

This painter is responsible for rendering the points, connections, and labels on the globe. It takes various parameters such as the list of connections, radius, rotation angles, zoom factor, points, hover point, click point, and callback functions for point interactions.

The hoverOverPoint function is called when a point is being hovered over, providing the point ID, the 2D cartesian coordinates, and the hover state.

The onPointClicked function is called when a point is clicked.

The connections list contains the animated connections between points.

The hoverPoint and clickPoint represent the current hover and click positions on the canvas.

The radius determines the size of the globe.

The rotationZ, rotationY, and rotationX angles control the rotation of the globe.

The zoomFactor determines the zoom level of the globe. The points list contains the points to be rendered on the globe.

Example usage:

ForegroundPainter(
 connections: connections,
radius: 200,
rotationZ: 0,
rotationY: 0,
rotationX: 0,
zoomFactor: 1,
points: points,
hoverPoint: hoverPoint,
clickPoint: clickPoint,
onPointClicked: () {
 print('Point clicked');
},
hoverOverPoint: (pointId, cartesian2D, isHovering, isVisible) {
print('Hovering over point with ID: $pointId');
},
)

Implementation

/// The [points] list contains the points to be rendered on the globe.
///
/// Example usage:
/// ```dart
/// ForegroundPainter(
///  connections: connections,
/// radius: 200,
/// rotationZ: 0,
/// rotationY: 0,
/// rotationX: 0,
/// zoomFactor: 1,
/// points: points,
/// hoverPoint: hoverPoint,
/// clickPoint: clickPoint,
/// onPointClicked: () {
///  print('Point clicked');
/// },
/// hoverOverPoint: (pointId, cartesian2D, isHovering, isVisible) {
/// print('Hovering over point with ID: $pointId');
/// },
/// )
/// ```
ForegroundPainter({
  required this.connections,
  required this.radius,
  required this.rotationZ,
  required this.rotationY,
  required this.rotationX,
  required this.zoomFactor,
  required this.points,
  this.hoverPoint,
  this.clickPoint,
  this.onPointClicked,
  required this.hoverOverPoint,
  required this.hoverOverConnection,
});