Skip to content

Commit d2665cb

Browse files
authored
Merge pull request #4960 from wri/FLAG-1297-fix-sluggish-map
FLAG-1297 - Fix unresponsive map when panning or zooming
2 parents ecd9367 + be89a6b commit d2665cb

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

components/map/selectors.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ export const getMapViewport = createSelector([getMapSettings], (settings) => {
4848
pitch,
4949
latitude: center?.lat,
5050
longitude: center?.lng,
51-
transitionDuration: 500,
51+
// The map transition needs to always be 0 otherwise the map becomes sluggish when panned or zoomed. Only set a
52+
// different value when flying between locations and only temporarily.
53+
transitionDuration: 0,
5254
};
5355
});
5456

components/ui/map/component.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,9 @@ class Map extends Component {
271271
onResize={this.onResize}
272272
onLoad={this.onLoad}
273273
getCursor={getCursor}
274+
// If the `transitionDuration` is not 0, then the map becomes sluggish when panned or zoomed. Nevertheless,
275+
// we still want a transition when flying between locations.
276+
transitionDuration={flying ? viewport.transitionDuration || 0 : 0}
274277
transitionInterpolator={new FlyToInterpolator()}
275278
transitionEasing={easeCubic}
276279
preventStyleDiffing

0 commit comments

Comments
 (0)