-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1cceba4
commit f7b62d5
Showing
7 changed files
with
2,434 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,4 @@ jobs: | |
- run: yarn install --immutable | ||
- run: yarn build | ||
- run: yarn lint | ||
- run: yarn test |
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,11 @@ | ||
import { type LngLatLike, LngLat } from "maplibre-gl"; | ||
|
||
export function isLngLatEqual(one: LngLatLike, two: LngLatLike): Boolean { | ||
const firstPosition = LngLat.convert(one); | ||
const secondPosition = LngLat.convert(two); | ||
|
||
return ( | ||
firstPosition.lng === secondPosition.lng && | ||
firstPosition.lat === secondPosition.lat | ||
); | ||
} |
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,26 @@ | ||
import { | ||
type LngLatLike, | ||
LngLat, | ||
} from "maplibre-gl"; | ||
import { isLngLatEqual } from '../lib/lib/lng_lat'; | ||
|
||
const tests: [LngLatLike, LngLatLike, Boolean][] = [ | ||
[[-122, 37], [-122, 37], true], | ||
[[-122, 37], new LngLat(-122, 37), true], | ||
[[1, 37], [-122, 37], false], | ||
[[-122, 1], [-122, 37], false], | ||
[new LngLat(-122, 37), new LngLat(-122, 37), true], | ||
[new LngLat(1, 37), new LngLat(-122, 37), false], | ||
[new LngLat(-122, 1), new LngLat(-122, 37), false], | ||
[{lon: -122, lat: 37}, {lon: -122, lat: 37}, true], | ||
[{lon: 1, lat: 37}, {lon: -122, lat: 37}, false], | ||
[{lng: -122, lat: 37}, {lng: -122, lat: 37}, true], | ||
[{lng: 1, lat: 37}, {lng: -122, lat: 37}, false] | ||
]; | ||
|
||
tests.forEach(([one, two, expected]) => { | ||
test(`isLngLatEqual: ${one}/${two}`, () => { | ||
const result = isLngLatEqual(one, two); | ||
expect(result).toBe(expected); | ||
}); | ||
}) |
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 |
---|---|---|
|
@@ -28,7 +28,8 @@ | |
"node", | ||
"vue", | ||
"geojson", | ||
"maplibre-gl" | ||
"maplibre-gl", | ||
"jest" | ||
] | ||
}, | ||
"include" : [ | ||
|
Oops, something went wrong.