Skip to content

Commit

Permalink
[fix] Fix onViewStateChange callback (#2154)
Browse files Browse the repository at this point in the history
Signed-off-by: Ihor Dykhta <dikhta.igor@gmail.com>
Co-authored-by: Ilija Puaca <ipuaca@gmail.com>
  • Loading branch information
igorDykhta and ilijapuaca committed Mar 8, 2023
1 parent 2e57238 commit 7d996a6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/components/src/kepler-gl.tsx
Expand Up @@ -27,7 +27,7 @@ import {connect as keplerGlConnect} from './connect/keplergl-connect';
import {IntlProvider} from 'react-intl';
import {messages} from '@kepler.gl/localization';
import {RootContext, FeatureFlagsContextProvider, FeatureFlags} from './context';
import {OnErrorCallBack, OnSuccessCallBack} from '@kepler.gl/types';
import {OnErrorCallBack, OnSuccessCallBack, Viewport} from '@kepler.gl/types';

import {
MapStateActions,
Expand Down Expand Up @@ -281,7 +281,7 @@ type KeplerGLBasicProps = {

appWebsite?: any;
onSaveMap?: () => void;
onViewStateChange?: () => void;
onViewStateChange?: (viewState: Viewport) => void;
onDeckInitialized?: () => void;
onKeplerGlInitialized?: () => void;
getMapboxRef?: () => React.RefObject<any>;
Expand Down
4 changes: 2 additions & 2 deletions src/utils/src/map-utils.ts
Expand Up @@ -4,12 +4,12 @@ import {TRANSITION_DURATION} from '@kepler.gl/constants';
import {SplitMapLayers, SplitMap, Viewport, MapState} from '@kepler.gl/types';

export const onViewPortChange = (
viewState: any,
viewState: Viewport,
onUpdateMap: (next: any) => any,
onViewStateChange?: (next: any) => void | null,
primary: boolean = false
): void => {
const {width, height, ...restViewState} = viewState;
const {width = 0, height = 0, ...restViewState} = viewState;
// react-map-gl sends 0,0 dimensions during initialization
// after we have received proper dimensions from observeDimensions
const next = {
Expand Down

0 comments on commit 7d996a6

Please sign in to comment.