Skip to content

Commit

Permalink
Disable flight mode on map interactivity controls - dragRotate and to…
Browse files Browse the repository at this point in the history
…uchRotate
  • Loading branch information
SARodrigues committed Apr 3, 2024
1 parent bec547c commit 6380579
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions frontend/components/map/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ export const Map: FC<MapProps> = ({
onMapLoad,
onMapViewportChange,
dragPan,
dragRotate,
dragRotate = false,
scrollZoom,
touchZoom,
touchRotate,
touchRotate = false,
doubleClickZoom,
width = '100%',
height = '100%',
Expand All @@ -40,7 +40,6 @@ export const Map: FC<MapProps> = ({
* STATE
*/
const [mapViewport, setViewport] = useState(viewport);
const [flying, setFlight] = useState(false);
const [ready, setReady] = useState(false);
const [loaded, setLoaded] = useState(false);

Expand Down Expand Up @@ -106,17 +105,11 @@ export const Map: FC<MapProps> = ({
transitionInterruption: TRANSITION_EVENTS.UPDATE,
...viewportOptions,
};

setFlight(true);
setViewport((prevViewport) => ({
...prevViewport,
...newViewport,
}));
debouncedOnMapViewportChange(newViewport);

return setTimeout(() => {
setFlight(false);
}, +transitionDuration);
}, [ready, bounds, debouncedOnMapViewportChange]);

const handleGetCursor = useCallback(({ isHovering, isDragging }) => {
Expand Down Expand Up @@ -169,12 +162,12 @@ export const Map: FC<MapProps> = ({
width={width}
height={height}
// INTERACTIVITY
dragPan={!flying && dragPan}
dragRotate={!flying && dragRotate}
scrollZoom={!flying && scrollZoom}
touchZoom={!flying && touchZoom}
touchRotate={!flying && touchRotate}
doubleClickZoom={!flying && doubleClickZoom}
dragPan={dragPan}
dragRotate={dragRotate}
scrollZoom={scrollZoom}
touchZoom={touchZoom}
touchRotate={touchRotate}
doubleClickZoom={doubleClickZoom}
// DEFAULT FUNC IMPLEMENTATIONS
onViewportChange={handleViewportChange}
onResize={handleResize}
Expand Down

0 comments on commit 6380579

Please sign in to comment.