From 7ebb48e37e76ba593e3373635714f6d597689b65 Mon Sep 17 00:00:00 2001 From: Victor Powell Date: Thu, 17 Dec 2015 11:18:55 -0800 Subject: [PATCH] Expose the `preserveDrawingBuffer` configuration passed to the created mapbox as a MapGL prop. --- src/map.react.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/map.react.js b/src/map.react.js index e9bed01b..b837278d 100644 --- a/src/map.react.js +++ b/src/map.react.js @@ -153,7 +153,13 @@ var MapGL = React.createClass({ * The first argument of the callback will be the array of feature the * mouse is over. This is the same response returned from `featuresAt`. */ - onClickFeatures: React.PropTypes.func + onClickFeatures: React.PropTypes.func, + + /** + * Passed to Mapbox Map constructor which passes it to the canvas context. + * This is unseful when you want to export the canvas as a PNG. + */ + preserveDrawingBuffer: React.PropTypes.bool }, getDefaultProps: function getDefaultProps() { @@ -161,6 +167,7 @@ var MapGL = React.createClass({ mapStyle: 'mapbox://styles/mapbox/light-v8', onChangeViewport: null, mapboxApiAccessToken: config.DEFAULTS.MAPBOX_API_ACCESS_TOKEN, + preserveDrawingBuffer: false, attributionControl: true }; }, @@ -245,7 +252,8 @@ var MapGL = React.createClass({ center: [this.state.longitude, this.state.latitude], zoom: this.state.zoom, style: mapStyle, - interactive: false + interactive: false, + preserveDrawingBuffer: this.props.preserveDrawingBuffer // , // attributionControl: this.props.attributionControl });