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

Method setProps

modules/react-mapbox/src/mapbox/mapbox.ts:224–241  ·  view source on GitHub ↗
(props: MapboxProps)

Source from the content-addressed store, hash-verified

222 }
223
224 setProps(props: MapboxProps) {
225 const oldProps = this.props;
226 this.props = props;
227
228 const settingsChanged = this._updateSettings(props, oldProps);
229 const sizeChanged = this._updateSize(props);
230 const viewStateChanged = this._updateViewState(props, true);
231 this._updateStyle(props, oldProps);
232 this._updateStyleComponents(props, oldProps);
233 this._updateHandlers(props, oldProps);
234
235 // If 1) view state has changed to match props and
236 // 2) the props change is not triggered by map events,
237 // it's driven by an external state change. Redraw immediately
238 if (settingsChanged || sizeChanged || (viewStateChanged && !this._map.isMoving())) {
239 this.redraw();
240 }
241 }
242
243 static reuse(props: MapboxProps, container: HTMLDivElement): Mapbox {
244 const that = Mapbox.savedMaps.pop();

Callers 4

reuseMethod · 0.45
_MapFunction · 0.45
DeckGLOverlayFunction · 0.45
DeckGLOverlayFunction · 0.45

Calls 7

_updateSettingsMethod · 0.95
_updateSizeMethod · 0.95
_updateViewStateMethod · 0.95
_updateStyleMethod · 0.95
_updateHandlersMethod · 0.95
redrawMethod · 0.95

Tested by

no test coverage detected