mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-09 03:30:09 +00:00
React Map GL: update props for LinearInterpolator (#43313)
This commit is contained in:
7
types/react-map-gl/index.d.ts
vendored
7
types/react-map-gl/index.d.ts
vendored
@@ -223,8 +223,13 @@ export enum TRANSITION_EVENTS {
|
||||
|
||||
export class TransitionInterpolator {}
|
||||
|
||||
export interface LinearInterpolatorProps {
|
||||
transitionProps?: string[];
|
||||
around?: number[];
|
||||
}
|
||||
|
||||
export class LinearInterpolator extends TransitionInterpolator {
|
||||
constructor(transitionProps?: string[]);
|
||||
constructor(transitionProps?: LinearInterpolatorProps | string[]);
|
||||
}
|
||||
|
||||
export interface FlyToInterpolatorProps {
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
ViewportProps,
|
||||
Source,
|
||||
Layer,
|
||||
LinearInterpolator,
|
||||
} from 'react-map-gl';
|
||||
import * as MapboxGL from 'mapbox-gl';
|
||||
import { FeatureCollection } from 'geojson';
|
||||
@@ -122,6 +123,25 @@ class MyMap extends React.Component<{}, State> {
|
||||
width={400}
|
||||
ref={this.setRefStatic}
|
||||
/>
|
||||
<button
|
||||
onClick={() => {
|
||||
const nullPoint = [0, 0];
|
||||
const li = new LinearInterpolator({
|
||||
around: nullPoint,
|
||||
});
|
||||
this.setState(prevState => ({
|
||||
viewport: {
|
||||
...prevState.viewport,
|
||||
latitude: nullPoint[1],
|
||||
longitude: nullPoint[0],
|
||||
transitionInterpolator: li,
|
||||
transitionDuration: 100,
|
||||
},
|
||||
}));
|
||||
}}
|
||||
>
|
||||
Jump to Null Point
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user