Fix bug where issues would not be properly centered if the map was not already at z19 (close #6384)

This commit is contained in:
Quincy Morgan
2019-05-24 10:28:59 -04:00
parent 2a08868c14
commit c95cead06d
+10 -4
View File
@@ -739,14 +739,20 @@ export function rendererMap(context) {
};
map.unobscuredCenterZoomEase = function(loc, zoom) {
var offset = map.unobscuredOffset();
var locPx = projection(loc);
var offset = map.unobscuredOffsetPx();
var proj = geoRawMercator().transform(projection.transform()); // copy projection
// use the target zoom to calculate the offset center
proj.scale(geoZoomToScale(zoom, TILESIZE));
var locPx = proj(loc);
var offsetLocPx = [locPx[0] + offset[0], locPx[1] + offset[1]];
var offsetLoc = projection.invert(offsetLocPx);
var offsetLoc = proj.invert(offsetLocPx);
map.centerZoomEase(offsetLoc, zoom);
};
map.unobscuredOffset = function() {
map.unobscuredOffsetPx = function() {
var openPane = d3_select('.map-panes .map-pane.shown');
if (!openPane.empty()) {
return [openPane.node().offsetWidth/2, 0];