nakarte

Source code of https://map.sikmir.ru (fork)
git clone git://git.sikmir.ru/nakarte
Log | Files | Refs | LICENSE

commit 9ef440f3438dee1fc95aa690846188256bd310c5
parent 93047cc4cff9d67dd49d33956b6f92d00d191bcd
Author: Sergey Orlov <wladimirych@gmail.com>
Date:   Sat,  2 Jan 2021 11:30:50 +0100

panoramas: update for new mapillari API

Diffstat:
Msrc/lib/leaflet.control.panoramas/lib/mapillary/index.js | 16++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/lib/leaflet.control.panoramas/lib/mapillary/index.js b/src/lib/leaflet.control.panoramas/lib/mapillary/index.js @@ -35,7 +35,11 @@ const Viewer = L.Evented.extend({ const id = `container-${L.stamp(container)}`; container.id = id; const viewer = this.viewer = new mapillary.Viewer( - id, config.mapillary, null, {component: {cover: false, bearing: false}}); + { + container: id, + apiClient: config.mapillary, + component: {cover: false, bearing: false} + }); window.addEventListener('resize', function() { viewer.resize(); } @@ -146,9 +150,13 @@ const Viewer = L.Evented.extend({ const center1 = parseFloat(state[3]); const zoom = parseFloat(state[4]); if (!isNaN(lat) && !isNaN(lng) && !isNaN(center0) && !isNaN(center1) && !isNaN(zoom)) { - this.viewer.moveCloseTo(lat, lng).then(() => { - this.viewer.setCenter([center0, center1]); - this.viewer.setZoom(zoom); + getPanoramaAtPos(L.latLng(lat, lng), 0.01).then((res) => { + if (res.found) { + this.viewer.moveToKey(res.data); + this.viewer.setCenter([center0, center1]); + this.viewer.setZoom(zoom); + } + }); return true; }