renderBitmap method
renders the bitmap portion of this marker. This method is called by render() which also call the render method for the caption
Implementation
@override
void renderBitmap(MapCanvas mapCanvas, MarkerContext markerContext) {
mapPath ??= GraphicFactory().createPath();
if (_zoom == markerContext.zoomLevel) {
(mapCanvas as FlutterCanvas).uiCanvas.save();
(mapCanvas as FlutterCanvas).uiCanvas.translate(
_leftUpperX - markerContext.mapCenter.x,
_leftUpperY - markerContext.mapCenter.y);
if (fill != null) mapCanvas.drawPath(mapPath!, fill!);
if (stroke != null) mapCanvas.drawPath(mapPath!, stroke!);
mapCanvas.uiCanvas.restore();
return;
// _points.forEach((mappoint) {
// double y = mappoint.y - markerCallback.mapViewPosition.leftUpper!.y;
// double x = mappoint.x - markerCallback.mapViewPosition.leftUpper!.x;
// if (mapPath!.isEmpty())
// mapPath!.moveTo(x, y);
// else
// mapPath!.lineTo(x, y);
// });
} else {
mapPath!.clear();
_points.clear();
_zoom = markerContext.zoomLevel;
path.forEach((latLong) {
Mappoint mappoint = markerContext.projection.latLonToPixel(latLong);
double y = mappoint.y - markerContext.mapCenter.y;
double x = mappoint.x - markerContext.mapCenter.x;
_points.add(mappoint);
if (mapPath!.isEmpty())
mapPath!.moveTo(x, y);
else
mapPath!.lineTo(x, y);
});
mapPath!.close();
_leftUpperX = markerContext.mapCenter.x;
_leftUpperY = markerContext.mapCenter.y;
}
if (fill != null) mapCanvas.drawPath(mapPath!, fill!);
if (stroke != null) mapCanvas.drawPath(mapPath!, stroke!);
}