mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-14 21:28:11 +02:00
Fix bug where issues would not be properly centered if the map was not already at z19 (close #6384)
This commit is contained in:
+10
-4
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user