MCPcopy Create free account
hub / github.com/visgl/react-map-gl / _updateStyleComponents

Method _updateStyleComponents

modules/react-mapbox/src/mapbox/mapbox.ts:515–539  ·  view source on GitHub ↗
(nextProps: MapboxProps, currProps: MapboxProps)

Source from the content-addressed store, hash-verified

513 @returns {bool} true if anything is changed
514 */
515 _updateStyleComponents(nextProps: MapboxProps, currProps: MapboxProps): boolean {
516 const map = this._map;
517 let changed = false;
518 if (map.isStyleLoaded()) {
519 if ('light' in nextProps && map.setLight && !deepEqual(nextProps.light, currProps.light)) {
520 changed = true;
521 map.setLight(nextProps.light);
522 }
523 if ('fog' in nextProps && map.setFog && !deepEqual(nextProps.fog, currProps.fog)) {
524 changed = true;
525 map.setFog(nextProps.fog);
526 }
527 if (
528 'terrain' in nextProps &&
529 map.setTerrain &&
530 !deepEqual(nextProps.terrain, currProps.terrain)
531 ) {
532 if (!nextProps.terrain || map.getSource(nextProps.terrain.source)) {
533 changed = true;
534 map.setTerrain(nextProps.terrain);
535 }
536 }
537 }
538 return changed;
539 }
540
541 /* Update interaction handlers to match props
542 @param {object} nextProps

Callers 2

setPropsMethod · 0.95
_initializeMethod · 0.95

Calls 1

deepEqualFunction · 0.90

Tested by

no test coverage detected