Skip to content

Commit

Permalink
don't update if position is not changed [#51]
Browse files Browse the repository at this point in the history
  • Loading branch information
igorskh committed Jun 17, 2020
1 parent 3f8f80e commit 1e165f1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/AbstractComponent.js
Expand Up @@ -21,7 +21,11 @@ export default class AbstractComponent extends Path {
if (fromProps.radius !== radius) {
this.leafletElement.setRadius(radius);
}
if (fromProps.position !== position) {
if (
!fromProps.position.every(
(v, i) => Math.abs(v - position[i]) < Number.EPSILON
)
) {
this.leafletElement.setLatLng(position);
}
}
Expand Down

0 comments on commit 1e165f1

Please sign in to comment.