Skip to content

Commit

Permalink
fix(vehicle-rental-overlay): fix laggy zooming with vehicle overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-heppner-ibigroup committed Feb 20, 2024
1 parent df27ebd commit fa7de82
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/vehicle-rental-overlay/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ const VehicleRentalOverlay = ({
setClickedVehicle(event.features?.[0].properties);
});
});
map.on("zoom", () => {
map.on("zoom", e => {
// Avoid too many re-renders by only updating state if we are a whole number value different
const newZoom = map.getZoom();
const newZoom = e.map.getZoom();
if (Math.floor(zoom) !== Math.floor(newZoom)) {
setZoom(newZoom);
}
Expand Down

0 comments on commit fa7de82

Please sign in to comment.