Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/api-reference/layers/scatterplot-layer.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,13 @@ The maximum line width in pixels. This prop can be used to prevent the path from

If `true`, rendered circles always face the camera. If `false` circles face up (i.e. are parallel with the ground plane).

##### `smoothEdges` (Boolean, optional)

- Default: `true`

If `true`, circles are rendered with smoothed edges.


### Data Accessors

##### `getPosition` ([Function](/docs/developer-guide/using-layers.md#accessors), optional) ![transition-enabled](https://img.shields.io/badge/transition-enabled-green.svg?style=flat-square")
Expand Down
1 change: 1 addition & 0 deletions modules/layers/src/geojson-layer/sub-layer-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const POINT_LAYER = {
props: {
filled: 'filled',
stroked: 'stroked',
smoothEdges: 'smoothEdges',

lineWidthMaxPixels: 'lineWidthMaxPixels',
lineWidthMinPixels: 'lineWidthMinPixels',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ precision highp float;

uniform bool filled;
uniform float stroked;
uniform bool smoothEdges;

varying vec4 vFillColor;
varying vec4 vLineColor;
Expand All @@ -36,7 +37,9 @@ void main(void) {
geometry.uv = unitPosition;

float distToCenter = length(unitPosition) * outerRadiusPixels;
float inCircle = smoothedge(distToCenter, outerRadiusPixels);
float inCircle = smoothEdges ?
smoothedge(distToCenter, outerRadiusPixels) :
distToCenter < outerRadiusPixels ? 1.0 : 0.0;

if (inCircle == 0.0) {
discard;
Expand Down
3 changes: 3 additions & 0 deletions modules/layers/src/scatterplot-layer/scatterplot-layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const defaultProps = {
stroked: false,
filled: true,
billboard: false,
smoothEdges: true,

getPosition: {type: 'accessor', value: x => x.position},
getRadius: {type: 'accessor', value: 1},
Expand Down Expand Up @@ -119,6 +120,7 @@ export default class ScatterplotLayer extends Layer {
stroked,
filled,
billboard,
smoothEdges,
lineWidthUnits,
lineWidthScale,
lineWidthMinPixels,
Expand All @@ -134,6 +136,7 @@ export default class ScatterplotLayer extends Layer {
stroked: stroked ? 1 : 0,
filled,
billboard,
smoothEdges,
radiusScale: radiusScale * pointRadiusMultiplier,
radiusMinPixels,
radiusMaxPixels,
Expand Down
Binary file modified test/render/golden-images/scatterplot-lnglat-billboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions test/render/test-cases/core-layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export default [
getFillColor: d => [255, 128, 0],
getRadius: d => d.SPACES,
billboard: true,
smoothEdges: false,
radiusScale: 30,
radiusMinPixels: 1,
radiusMaxPixels: 30
Expand Down