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

Method _updateSettings

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

Source from the content-addressed store, hash-verified

468 @returns {bool} true if anything is changed
469 */
470 _updateSettings(nextProps: MapboxProps, currProps: MapboxProps): boolean {
471 const map = this._map;
472 let changed = false;
473 for (const propName of settingNames) {
474 const propPresent = propName in nextProps || propName in currProps;
475
476 if (propPresent && !deepEqual(nextProps[propName], currProps[propName])) {
477 changed = true;
478 const nextValue = propName in nextProps ? nextProps[propName] : DEFAULT_SETTINGS[propName];
479 const setter = map[`set${propName[0].toUpperCase()}${propName.slice(1)}`];
480 setter?.call(map, nextValue);
481 }
482 }
483 return changed;
484 }
485
486 /* Update map style to match props
487 @param {object} nextProps

Callers 1

setPropsMethod · 0.95

Calls 1

deepEqualFunction · 0.90

Tested by

no test coverage detected