in modules/layers/src/polygon-layer/polygon-layer.js [127:257]
renderLayers() {
// Layer composition props
const {
data,
_dataDiff,
stroked,
filled,
extruded,
wireframe,
_normalize,
elevationScale,
transitions,
positionFormat
} = this.props;
// Rendering props underlying layer
const {
lineWidthUnits,
lineWidthScale,
lineWidthMinPixels,
lineWidthMaxPixels,
lineJointRounded,
lineMiterLimit,
lineDashJustified
} = this.props;
// Accessor props for underlying layers
const {
getFillColor,
getLineColor,
getLineWidth,
getLineDashArray,
getElevation,
getPolygon,
updateTriggers,
material
} = this.props;
const {paths, pathsDiff} = this.state;
const FillLayer = this.getSubLayerClass('fill', SolidPolygonLayer);
const StrokeLayer = this.getSubLayerClass('stroke', PathLayer);
// Filled Polygon Layer
const polygonLayer =
this.shouldRenderSubLayer('fill', paths) &&
new FillLayer(
{
_dataDiff,
extruded,
elevationScale,
filled,
wireframe,
_normalize,
getElevation,
getFillColor,
getLineColor,
material,
transitions
},
this.getSubLayerProps({
id: 'fill',
updateTriggers: {
getPolygon: updateTriggers.getPolygon,
getElevation: updateTriggers.getElevation,
getFillColor: updateTriggers.getFillColor,
getLineColor: updateTriggers.getLineColor
}
}),
{
data,
positionFormat,
getPolygon
}
);
// Polygon line layer
const polygonLineLayer =
!extruded &&
stroked &&
this.shouldRenderSubLayer('stroke', paths) &&
new StrokeLayer(
{
_dataDiff: pathsDiff && (() => pathsDiff),
widthUnits: lineWidthUnits,
widthScale: lineWidthScale,
widthMinPixels: lineWidthMinPixels,
widthMaxPixels: lineWidthMaxPixels,
rounded: lineJointRounded,
miterLimit: lineMiterLimit,
dashJustified: lineDashJustified,
// Already normalized
_pathType: 'loop',
transitions: transitions && {
getWidth: transitions.getLineWidth,
getColor: transitions.getLineColor,
getPath: transitions.getPolygon
},
getColor: this.getSubLayerAccessor(getLineColor),
getWidth: this.getSubLayerAccessor(getLineWidth),
getDashArray: this.getSubLayerAccessor(getLineDashArray)
},
this.getSubLayerProps({
id: 'stroke',
updateTriggers: {
getWidth: updateTriggers.getLineWidth,
getColor: updateTriggers.getLineColor,
getDashArray: updateTriggers.getLineDashArray
}
}),
{
data: paths,
positionFormat,
getPath: x => x.path
}
);
return [
// If not extruded: flat fill layer is drawn below outlines
!extruded && polygonLayer,
polygonLineLayer,
// If extruded: draw fill layer last for correct blending behavior
extruded && polygonLayer
];
}