Merge pull request #34061 from fnberta/react-map-gl-4.1

[react-map-gl] add geolocate control
This commit is contained in:
Sheetal Nandi
2019-03-21 09:28:45 -07:00
committed by GitHub
2 changed files with 14 additions and 0 deletions
+12
View File
@@ -317,6 +317,18 @@ export interface FullscreenControlProps extends BaseControlProps {
export class FullscreenControl extends BaseControl<FullscreenControlProps> {}
export interface GeolocateControlProps extends BaseControlProps {
className?: string;
positionOptions?: MapboxGL.PositionOptions;
fitBoundsOptions?: MapboxGL.FitBoundsOptions;
trackUserLocation?: boolean;
showUserLocation?: boolean;
onViewStateChange?: (info: ViewStateChangeInfo) => void;
onViewportChange?: (viewState: ViewState) => void;
}
export class GeolocateControl extends BaseControl<GeolocateControlProps> {}
export interface DraggableControlProps extends BaseControlProps {
draggable?: boolean;
onDrag?: (event: DragEvent) => void;
@@ -6,6 +6,7 @@ import {
SVGOverlay,
HTMLOverlay,
FullscreenControl,
GeolocateControl,
CanvasRedrawOptions,
HTMLRedrawOptions,
SVGRedrawOptions,
@@ -39,6 +40,7 @@ class MyMap extends React.Component<{}, State> {
ref={this.setRefInteractive}
>
<FullscreenControl className="test-class" container={document.querySelector('body')} />
<GeolocateControl className="test-class" />
<CanvasOverlay
redraw={opts => {
const {