File tree Expand file tree Collapse file tree 1 file changed +2
-19
lines changed
Expand file tree Collapse file tree 1 file changed +2
-19
lines changed Original file line number Diff line number Diff line change @@ -8,8 +8,6 @@ import { MapState } from "../types";
88import { MAP_SOURCES } from "../constants/mapSources" ;
99import { useApp } from "../contexts/AppContext" ;
1010import { SourceSpecification } from "maplibre-gl" ;
11- import { useCallback } from "react" ;
12- import throttle from "lodash.throttle" ;
1311
1412interface MapProps {
1513 mapState : MapState ;
@@ -29,21 +27,6 @@ export function Map({
2927 const { state } = useApp ( ) ;
3028 const source = MAP_SOURCES [ sourceId ] || state . customSources [ sourceId ] ;
3129
32- // Create throttled callbacks
33- const throttledOnMapChange = useCallback (
34- throttle ( ( newState : Partial < MapState > ) => {
35- onMapChange ( newState ) ;
36- } , 500 ) ,
37- [ onMapChange ]
38- ) ;
39-
40- const throttledOnViewStateChange = useCallback (
41- throttle ( ( newState : Partial < MapState > ) => {
42- onViewStateChange ( newState ) ;
43- } , 500 ) ,
44- [ onViewStateChange ]
45- ) ;
46-
4730 function handleMove ( evt : ViewStateChangeEvent ) {
4831 const newState : Partial < MapState > = {
4932 center : [ evt . viewState . longitude , evt . viewState . latitude ] as [
@@ -56,9 +39,9 @@ export function Map({
5639 } ;
5740
5841 if ( synchronized ) {
59- throttledOnMapChange ( newState ) ;
42+ onMapChange ( newState ) ;
6043 } else {
61- throttledOnViewStateChange ( newState ) ;
44+ onViewStateChange ( newState ) ;
6245 }
6346 }
6447
You can’t perform that action at this time.
0 commit comments