Skip to content

Commit

Permalink
Add some missed props for our composite layers after the prop transfe…
Browse files Browse the repository at this point in the history
…r change (visgl#442)

* Add some missed props after the prop transfer change
* Forward additional base layer props
  • Loading branch information
Shaojing Li authored Mar 21, 2017
1 parent 1e6a434 commit 8b01554
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/layer-browser/src/examples/core-layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const PathLayerExample = {
getPath: f => get(f, 'path'),
getColor: f => [128, 0, 0],
getWidth: f => 10,
strokeMinWidth: 1,
widthMinPixels: 1,
pickable: true
}
};
Expand Down
26 changes: 26 additions & 0 deletions src/layers/core/geojson-layer/geojson-layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,18 @@ export default class GeoJsonLayer extends CompositeLayer {
renderLayers() {
const {features} = this.state;
const {pointFeatures, lineFeatures, polygonFeatures, polygonOutlineFeatures} = features;

const {getLineColor, getFillColor, getRadius,
getLineWidth, getElevation, updateTriggers} = this.props;

const {id, stroked, filled, extruded, wireframe} = this.props;

const {lineWidthScale, lineWidthMinPixels, lineWidthMaxPixels,
lineJointRounded, lineMiterLimit, fp64} = this.props;

// base layer props
const {opacity, pickable, visible, projectionMode} = this.props;

const drawPoints = pointFeatures && pointFeatures.length > 0;
const drawLines = lineFeatures && lineFeatures.length > 0;
const hasPolygonLines = polygonOutlineFeatures && polygonOutlineFeatures.length > 0;
Expand All @@ -107,6 +113,10 @@ export default class GeoJsonLayer extends CompositeLayer {
extruded,
wireframe: false,
fp64,
opacity,
pickable,
visible,
projectionMode,
getPolygon: getCoordinates,
getElevation,
getColor: getFillColor,
Expand All @@ -127,6 +137,10 @@ export default class GeoJsonLayer extends CompositeLayer {
extruded,
wireframe: true,
fp64,
opacity,
pickable,
visible,
projectionMode,
getPolygon: getCoordinates,
getElevation,
getColor: getLineColor,
Expand All @@ -150,6 +164,10 @@ export default class GeoJsonLayer extends CompositeLayer {
rounded: lineJointRounded,
miterLimit: lineMiterLimit,
fp64,
opacity,
pickable,
visible,
projectionMode,
getPath: getCoordinates,
getColor: getLineColor,
getWidth: getLineWidth,
Expand All @@ -170,6 +188,10 @@ export default class GeoJsonLayer extends CompositeLayer {
rounded: lineJointRounded,
miterLimit: lineMiterLimit,
fp64,
opacity,
pickable,
visible,
projectionMode,
getPath: getCoordinates,
getColor: getLineColor,
getWidth: getLineWidth,
Expand All @@ -185,6 +207,10 @@ export default class GeoJsonLayer extends CompositeLayer {
id: `${id}-points`,
data: pointFeatures,
fp64,
opacity,
pickable,
visible,
projectionMode,
getPosition: getCoordinates,
getColor: getFillColor,
getRadius,
Expand Down
10 changes: 9 additions & 1 deletion src/layers/core/grid-layer/grid-layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,23 @@ export default class GridLayer extends Layer {
}

renderLayers() {
const {id, fp64, extruded} = this.props;
const {id, elevationScale, fp64, extruded} = this.props;

// base layer props
const {opacity, pickable, visible, projectionMode} = this.props;

return new GridCellLayer({
id: `${id}-grid-cell`,
data: this.state.layerData,
latOffset: this.state.gridOffset.yOffset,
lonOffset: this.state.gridOffset.xOffset,
elevationScale,
extruded,
fp64,
opacity,
pickable,
visible,
projectionMode,
getColor: this._onGetSublayerColor.bind(this),
getElevation: this._onGetSublayerElevation.bind(this),
getPosition: d => d.position,
Expand Down
10 changes: 9 additions & 1 deletion src/layers/core/hexagon-layer/hexagon-layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,23 @@ export default class HexagonLayer extends Layer {
}

renderLayers() {
const {id, radius, extruded, fp64} = this.props;
const {id, radius, elevationScale, extruded, fp64} = this.props;

// base layer props
const {opacity, pickable, visible, projectionMode} = this.props;

return new HexagonCellLayer({
id: `${id}-hexagon-cell`,
data: this.state.hexagons,
radius,
elevationScale,
angle: Math.PI,
extruded,
fp64,
opacity,
pickable,
visible,
projectionMode,
getColor: this._onGetSublayerColor.bind(this),
getElevation: this._onGetSublayerElevation.bind(this),
// Override user's onHover and onClick props
Expand Down
15 changes: 14 additions & 1 deletion src/layers/core/polygon-layer/polygon-layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ export default class PolygonLayer extends CompositeLayer {
const {data, id, stroked, filled, extruded, wireframe} = this.props;
const {lineWidthScale, lineWidthMinPixels, lineWidthMaxPixels,
lineJointRounded, lineMiterLimit, fp64} = this.props;

// base layer props
const {opacity, pickable, visible, projectionMode} = this.props;
const {paths, onHover, onClick} = this.state;

const hasData = data && data.length > 0;
Expand All @@ -101,6 +102,10 @@ export default class PolygonLayer extends CompositeLayer {
extruded,
wireframe: false,
fp64,
opacity,
pickable,
visible,
projectionMode,
getPolygon,
getElevation,
getColor: getFillColor,
Expand All @@ -121,6 +126,10 @@ export default class PolygonLayer extends CompositeLayer {
extruded: true,
wireframe: true,
fp64,
opacity,
pickable,
visible,
projectionMode,
getPolygon,
getElevation,
getColor: getLineColor,
Expand All @@ -145,6 +154,10 @@ export default class PolygonLayer extends CompositeLayer {
rounded: lineJointRounded,
miterLimit: lineMiterLimit,
fp64,
opacity,
pickable,
visible,
projectionMode,
getPath: x => x.path,
getColor: getLineColor,
getWidth: getLineWidth,
Expand Down

0 comments on commit 8b01554

Please sign in to comment.