Skip to content

Commit

Permalink
DriveMap: fixed high CPU usage during idling (#515)
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalkrishnads authored Jun 21, 2024
1 parent 6837df7 commit 112d624
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/DriveMap/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class DriveMap extends Component {
this.shouldFlyTo = false;
this.isInteracting = false;
this.isInteractingTimeout = null;
this.lastMapPos = [0, 0];
}

componentDidMount() {
Expand Down Expand Up @@ -99,7 +100,8 @@ class DriveMap extends Component {
if (markerSource) {
if (this.props.currentRoute && this.props.currentRoute.driveCoords) {
const pos = this.posAtOffset(currentOffset());
if (pos) {
if (pos && pos.some((coordinate, index) => coordinate != this.lastMapPos[index])) {
this.lastMapPos = pos;
markerSource.setData({
type: 'Point',
coordinates: pos,
Expand Down

0 comments on commit 112d624

Please sign in to comment.