Fix unprojection when using terrain (#1620)

This commit is contained in:
Xiaoji Chen 2021-12-06 19:49:00 -08:00 committed by GitHub
parent 31a0e8eaf6
commit e4b44c3fed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -147,9 +147,10 @@ function normalizeEvent(event) {
event.point = pos;
const {viewport} = this;
const location = viewport.unproject(pos, {targetZ: viewport.meterOffset[2]});
event.lngLat = [location[0], location[1]];
if (this.map) {
const location = this.map.unproject(pos);
event.lngLat = [location.lng, location.lat];
}
return event;
}

View File

@ -3303,9 +3303,9 @@ camelcase@^5.0.0:
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==
caniuse-lite@^1.0.30001219:
version "1.0.30001228"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001228.tgz#bfdc5942cd3326fa51ee0b42fbef4da9d492a7fa"
integrity sha512-QQmLOGJ3DEgokHbMSA8cj2a+geXqmnpyOFT0lhQV6P3/YOJvGDEwoedcwxEQ30gJIwIIunHIicunJ2rzK5gB2A==
version "1.0.30001285"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001285.tgz"
integrity sha512-KAOkuUtcQ901MtmvxfKD+ODHH9YVDYnBt+TGYSz2KIfnq22CiArbUxXPN9067gNbgMlnNYRSwho8OPXZPALB9Q==
caseless@~0.12.0:
version "0.12.0"