\n {this._renderTip(positionType)}\n {this._renderContent()}\n
\n );\n }\n}\n","// @flow\n\n// Copyright (c) 2015 Uber Technologies, Inc.\n\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nimport {document} from '../utils/globals';\nimport PropTypes from 'prop-types';\nimport BaseControl from './base-control';\nimport * as React from 'react';\nimport mapboxgl from '../utils/mapboxgl';\n\nimport type {BaseControlProps} from './base-control';\n\nconst propTypes = Object.assign({}, BaseControl.propTypes, {\n // Custom className\n className: PropTypes.string,\n /* eslint-disable max-len */\n // `container` is the [compatible DOM element](https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullScreen#Compatible_elements)\n // which should be made full screen. By default, the map container element will be made full screen.\n /* eslint-enable max-len */\n container: PropTypes.object,\n label: PropTypes.string\n});\n\nconst defaultProps = Object.assign({}, BaseControl.defaultProps, {\n className: '',\n container: null,\n label: 'Toggle fullscreen'\n});\n\nexport type FullscreenControlProps = BaseControlProps & {\n className: string,\n container: ?HTMLElement,\n label: string\n};\n\ntype State = {\n isFullscreen: boolean,\n showButton: boolean\n};\n\nexport default class FullscreenControl extends BaseControl<\n FullscreenControlProps,\n State,\n HTMLDivElement\n> {\n static propTypes = propTypes;\n static defaultProps = defaultProps;\n\n state = {\n isFullscreen: false,\n showButton: false\n };\n\n _mapboxFullscreenControl: any = null;\n\n componentDidMount() {\n const container = this.props.container || this._context.mapContainer;\n\n this._mapboxFullscreenControl = new mapboxgl.FullscreenControl({\n container\n });\n\n // eslint-disable-next-line\n this.setState({\n showButton: this._mapboxFullscreenControl._checkFullscreenSupport()\n });\n\n document.addEventListener(\n this._mapboxFullscreenControl._fullscreenchange,\n this._onFullscreenChange\n );\n }\n\n componentWillUnmount() {\n document.removeEventListener(\n this._mapboxFullscreenControl._fullscreenchange,\n this._onFullscreenChange\n );\n }\n\n _onFullscreenChange = () => {\n const nextState = !this._mapboxFullscreenControl._fullscreen;\n // this is a hack\n // Mapbox use `_fullscreen` flag to toggle fullscreen mode\n this._mapboxFullscreenControl._fullscreen = nextState;\n this.setState({isFullscreen: nextState});\n };\n\n _onClickFullscreen = () => {\n this._mapboxFullscreenControl._onClickFullscreen();\n };\n\n _renderButton(type: string, label: string, callback: Function) {\n return (\n \n {this._renderMarker()}\n
\n {this._renderButton('geolocate', label, this._triggerGeolocate)}\n
\n
\n );\n }\n}\n","// @flow\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport BaseControl from './base-control';\n\nimport MapState from '../utils/map-state';\nimport {LINEAR_TRANSITION_PROPS} from '../utils/map-controller';\n\nimport deprecateWarn from '../utils/deprecate-warn';\nimport {compareVersions} from '../utils/version';\n\nimport type {BaseControlProps} from './base-control';\n\nconst noop = () => {};\n\nconst propTypes = Object.assign({}, BaseControl.propTypes, {\n // Custom className\n className: PropTypes.string,\n // Callbacks fired when the user interacted with the map. The object passed to the callbacks\n // contains viewport properties such as `longitude`, `latitude`, `zoom` etc.\n onViewStateChange: PropTypes.func,\n onViewportChange: PropTypes.func,\n // Show/hide compass button\n showCompass: PropTypes.bool,\n // Show/hide zoom buttons\n showZoom: PropTypes.bool,\n // Custom labels assigned to the controls\n zoomInLabel: PropTypes.string,\n zoomOutLabel: PropTypes.string,\n compassLabel: PropTypes.string\n});\n\nconst defaultProps = Object.assign({}, BaseControl.defaultProps, {\n className: '',\n showCompass: true,\n showZoom: true,\n zoomInLabel: 'Zoom In',\n zoomOutLabel: 'Zoom Out',\n compassLabel: 'Reset North'\n});\n\nexport type NavigationControlProps = BaseControlProps & {\n className: string,\n onViewStateChange?: Function,\n onViewportChange?: Function,\n showCompass: boolean,\n showZoom: boolean,\n zoomInLabel: string,\n zoomOutLabel: string,\n compassLabel: string\n};\n\ntype ViewportProps = {\n longitude: number,\n latitude: number,\n zoom: number,\n pitch: number,\n bearing: number\n};\n\n// Mapbox version flags. CSS classes were changed in certain versions.\nconst VERSION_LEGACY = 1;\nconst VERSION_1_6 = 2;\n\nfunction getUIVersion(mapboxVersion: string): number {\n return compareVersions(mapboxVersion, '1.6.0') >= 0 ? VERSION_1_6 : VERSION_LEGACY;\n}\n\n/*\n * PureComponent doesn't update when context changes, so\n * implementing our own shouldComponentUpdate here.\n */\nexport default class NavigationControl extends BaseControl<\n NavigationControlProps,\n *,\n HTMLDivElement\n> {\n static propTypes = propTypes;\n static defaultProps = defaultProps;\n\n constructor(props: NavigationControlProps) {\n super(props);\n // Check for deprecated props\n deprecateWarn(props);\n }\n\n _uiVersion: number;\n\n _updateViewport(opts: $Shape