commit 81aea93c48c24e8ea0f57dc690030835380a1b61
parent 001dda13c2e309ca3270e5edb71f4e02b9b6054d
Author: Sergey Orlov <wladimirych@gmail.com>
Date: Sun, 3 May 2020 10:53:56 +0200
panoramas: for mapy.cz use placeId instead of coords to track panorama change #379
Diffstat:
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/lib/leaflet.control.panoramas/lib/mapycz/index.js b/src/lib/leaflet.control.panoramas/lib/mapycz/index.js
@@ -105,19 +105,19 @@ const Viewer = L.Evented.extend({
if (!place) {
return;
}
- const coords = place.getCoords().toWGS84();
- const oldPosition = this._position;
+ const oldPlaceId = this._placeId;
const oldHeading = this._heading;
- this._position = L.latLng(coords[1], coords[0]);
+ this._placeId = place.getId();
this._heading = this.panorama.getCamera().yaw;
- const positionChanged = !oldPosition || !this._position.equals(oldPosition);
+ const placeIdChanged = this._placeId !== oldPlaceId;
const headingChanged = this._heading !== oldHeading;
- if (positionChanged) {
+ if (placeIdChanged) {
this.updateDateLabel();
}
- if (positionChanged || headingChanged) {
+ if (placeIdChanged || headingChanged) {
+ const coords = place.getCoords().toWGS84();
this.fire('change', {
- latlng: this._position,
+ latlng: L.latLng(coords[1], coords[0]),
heading: (this._heading * 180) / Math.PI,
});
}