(nextProps: MapboxProps, triggerEvents: boolean)
| 444 | @returns {bool} true if anything is changed |
| 445 | */ |
| 446 | _updateViewState(nextProps: MapboxProps, triggerEvents: boolean): boolean { |
| 447 | const viewState: Partial<ViewState> = nextProps.viewState || nextProps; |
| 448 | const tr = this._proxyTransform; |
| 449 | const {zoom, pitch, bearing} = tr; |
| 450 | const changed = compareViewStateWithTransform(this._proxyTransform, viewState); |
| 451 | tr.$reactViewState = viewState; |
| 452 | |
| 453 | if (changed && triggerEvents) { |
| 454 | const deferredEvents = this._deferredEvents; |
| 455 | // Delay DOM control updates to the next render cycle |
| 456 | deferredEvents.move = true; |
| 457 | deferredEvents.zoom ||= zoom !== tr.zoom; |
| 458 | deferredEvents.rotate ||= bearing !== tr.bearing; |
| 459 | deferredEvents.pitch ||= pitch !== tr.pitch; |
| 460 | } |
| 461 | |
| 462 | return changed; |
| 463 | } |
| 464 | |
| 465 | /* Update camera constraints and projection settings to match props |
| 466 | @param {object} nextProps |
no test coverage detected