-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[google-maps-input] Prevent pan/zoom resetting when props update
- Loading branch information
Showing
7 changed files
with
29 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import {LatLng} from '../types' | ||
|
||
export function latLngAreEqual( | ||
latLng1: LatLng | google.maps.LatLng, | ||
latLng2: LatLng | google.maps.LatLng | ||
) { | ||
const lat1 = typeof latLng1.lat === 'function' ? latLng1.lat() : latLng1.lat | ||
const lng1 = typeof latLng1.lng === 'function' ? latLng1.lng() : latLng1.lng | ||
|
||
const lat2 = typeof latLng2.lat === 'function' ? latLng2.lat() : latLng2.lat | ||
const lng2 = typeof latLng2.lng === 'function' ? latLng2.lng() : latLng2.lng | ||
|
||
return lat1 === lat2 && lng1 === lng2 | ||
} |