fix auto zoom to do it only on new map selections
All checks were successful
Build and deploy / Build and Push Docker Images (push) Successful in 3m9s
All checks were successful
Build and deploy / Build and Push Docker Images (push) Successful in 3m9s
This commit is contained in:
@@ -39,7 +39,7 @@ function MapController() {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function AutoZoom({ mapId, refreshTrigger }: { mapId: string; refreshTrigger: number }) {
|
function AutoZoom({ mapId }: { mapId: string }) {
|
||||||
const map = useMap();
|
const map = useMap();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -78,7 +78,7 @@ function AutoZoom({ mapId, refreshTrigger }: { mapId: string; refreshTrigger: nu
|
|||||||
};
|
};
|
||||||
|
|
||||||
zoomToDevices();
|
zoomToDevices();
|
||||||
}, [mapId, refreshTrigger, map]);
|
}, [mapId, map]);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -134,7 +134,7 @@ export function MapView({ mapId, activeLayer, mapLayers, showShareDialog = false
|
|||||||
style={{ background: '#f0f0f0' }}
|
style={{ background: '#f0f0f0' }}
|
||||||
>
|
>
|
||||||
<MapController />
|
<MapController />
|
||||||
<AutoZoom mapId={mapId} refreshTrigger={refreshTrigger} />
|
<AutoZoom mapId={mapId} />
|
||||||
<TileLayer
|
<TileLayer
|
||||||
key={activeLayer}
|
key={activeLayer}
|
||||||
url={layer.url}
|
url={layer.url}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ function MapController() {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function AutoZoom({ mapId, refreshTrigger }: { mapId: string; refreshTrigger: number }) {
|
function AutoZoom({ mapId }: { mapId: string }) {
|
||||||
const map = useMap();
|
const map = useMap();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -96,7 +96,7 @@ function AutoZoom({ mapId, refreshTrigger }: { mapId: string; refreshTrigger: nu
|
|||||||
};
|
};
|
||||||
|
|
||||||
zoomToDevices();
|
zoomToDevices();
|
||||||
}, [mapId, refreshTrigger, map]);
|
}, [mapId, map]);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -277,7 +277,7 @@ export function SharedMap() {
|
|||||||
style={{ background: '#f0f0f0' }}
|
style={{ background: '#f0f0f0' }}
|
||||||
>
|
>
|
||||||
<MapController />
|
<MapController />
|
||||||
<AutoZoom mapId={mapData.id} refreshTrigger={refreshTrigger} />
|
<AutoZoom mapId={mapData.id} />
|
||||||
<TileLayer
|
<TileLayer
|
||||||
key={activeLayer}
|
key={activeLayer}
|
||||||
url={MAP_LAYERS[activeLayer].url}
|
url={MAP_LAYERS[activeLayer].url}
|
||||||
|
|||||||
Reference in New Issue
Block a user