Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
[Enhancement] Add KeplerGl.onDeckInitialized callback (#1193)
Shan He955c611f72d6
diff --git a/src/components/kepler-gl.js b/src/components/kepler-gl.jsindex 1e8471b82..3371b0810 100644--- a/src/components/kepler-gl.js+++ b/src/components/kepler-gl.js@@ -220,11 +220,13 @@ function KeplerGlFactory(appWebsite,onSaveMap,onViewStateChange,+ onDeckInitialized,width,height,mapboxApiAccessToken,mapboxApiUrl,getMapboxRef,+ deckGlProps,// redux statemapStyle,@@ -309,11 +311,13 @@ function KeplerGlFactory(clicked,mousePos,readOnly: uiState.readOnly,+ onDeckInitialized,onViewStateChange,uiStateActions,visStateActions,mapStateActions,- animationConfig+ animationConfig,+ deckGlProps};const isSplit = splitMaps && splitMaps.length > 1;diff --git a/src/components/map-container.js b/src/components/map-container.jsindex 6cc116fc1..6cf2f8d08 100644--- a/src/components/map-container.js+++ b/src/components/map-container.js@@ -227,6 +227,12 @@ export default function MapContainerFactory(MapPopover, MapControl, Editor) {}};+ _onDeckInitialized(gl) {+ if (this.props.onDeckInitialized) {+ this.props.onDeckInitialized(this._deck, gl);+ }+ }+_onBeforeRender = ({gl}) => {setLayerBlending(gl, this.props.layerBlending);};@@ -413,6 +419,7 @@ export default function MapContainerFactory(MapPopover, MapControl, Editor) {this._deck = comp.deck;}}}+ onWebGLInitialized={gl => this._onDeckInitialized(gl)}/>);}