ForegroundPainter constructor
- required List<
AnimatedPointConnection> connections, - required double radius,
- required double rotationZ,
- required double rotationY,
- required double rotationX,
- required double zoomFactor,
- required List<
Point> points, - Offset? hoverPoint,
- Offset? clickPoint,
- VoidCallback? onPointClicked,
- required dynamic hoverOverPoint(),
- required dynamic hoverOverConnection(),
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,
});