-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
This issue is for a: (mark with an x
)
- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)
Minimal steps to reproduce
Zooming-out completely on the main map and zooming-in on the overview map. The main map zoom changes radically to the zoom offset repositioning vastly the map center.
Similarly, zooming-in on the overview map to maximum and zooming-out on the main map changes the zoom offset to match the zoom offset what makes the overview map jump to different zoom level..
Any log messages given by the failure
N/A
Expected/desired behavior
The map should zoom in in the same way as it was zoomed out on the main map in the maximum zoom-out range.
In the maximum zoom-in range I suggest disallowing zooming-in further.
OS and Version?
Windows 10 or 11
Versions
I suppose it's 0.0.3
Mention any other details that might be useful
I tried to amend it and it seems to work correctly but I'm not a professional in coding and this may need to be corrected.
Here is the code:
OverviewMap.prototype._syncMaps = function (baseMap) {
if (baseMap) {
var self_1 = this;
var opt = self_1._options;
var parentMap = self_1._parentMap;
var overviewMap = self_1._overviewMap;
self_1._detachEvents();
var cam = baseMap.getCamera();
var newCam = {
center: cam.center,
type: 'jump'
};
if (opt.syncBearingPitch) {
newCam.bearing = cam.bearing;
newCam.pitch = cam.pitch;
}
// Added
var newOverviewCam = {
center: cam.center,
type: 'jump'
};
// Amended
if (baseMap !== parentMap) {
if (opt.syncZoom) {
let overviewMapZoomSpeed = 8;
let parCam = parentMap.getCamera();
let parZoom = parCam.zoom;
let minZoom = overviewMap.getCamera().minZoom;
let maxZoom = overviewMap.getCamera().maxZoom;
let overviewZoom = cam.zoom;
if (parCam.zoom <= minZoom - opt.zoomOffset) {
if (overviewZoom != minZoom) {
newCam.zoom = parZoom + ((overviewZoom - minZoom)*overviewMapZoomSpeed);
newOverviewCam.zoom = 1
parentMap.setCamera(newCam);
overviewMap.setCamera(newOverviewCam);
} else {
parentMap.setCamera(newCam);
}
} else if (parCam.zoom >= maxZoom + opt.zoomOffset) {
newCam.zoom = Math.min(cam.zoom - opt.zoomOffset, maxZoom - opt.zoomOffset);
if (cam.zoom > maxZoom + opt.zoomOffset) {
newOverviewCam.zoom = maxZoom + opt.zoomOffset;
overviewMap.setCamera(newOverviewCam);
}
parentMap.setCamera(newCam);
} else {
newCam.zoom = cam.zoom - opt.zoomOffset;
parentMap.setCamera(newCam);
}
} else {
newCam.zoom = opt.zoom;
parentMap.setCamera(newCam);
}
}
if (baseMap !== overviewMap) {
newCam.zoom = opt.syncZoom ? Math.min(Math.max(cam.zoom + opt.zoomOffset, 0), 24) : opt.zoom;
if (!opt.syncBearingPitch) {
newCam.bearing = 0;
newCam.pitch = 0;
}
overviewMap.setCamera(newCam);
}
self_1._updateOverlay();
self_1._attachEvents();
}
};
Metadata
Metadata
Assignees
Labels
No labels