mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-12 16:52:50 +00:00
fix zoom resetting wrongly when switching background mid-transition
see https://github.com/openstreetmap/iD/issues/10700#issuecomment-2832010049
This commit is contained in:
@@ -109,7 +109,7 @@ export function behaviorHash(context) {
|
||||
|
||||
// Update the URL hash without affecting the browser navigation stack,
|
||||
// though unavoidably creating a browser history entry
|
||||
window.history.replaceState(null, computedTitle(false /* includeChangeCount */), latestHash);
|
||||
window.history.replaceState(null, '', latestHash);
|
||||
|
||||
// set the title we want displayed for the browser tab/window
|
||||
updateTitle(true /* includeChangeCount */);
|
||||
|
||||
@@ -225,9 +225,7 @@ export function rendererBackground(context) {
|
||||
delete hash.offset;
|
||||
}
|
||||
|
||||
if (!window.mocha) {
|
||||
window.location.replace('#' + utilQsString(hash, true));
|
||||
}
|
||||
window.history.replaceState(null, '', '#' + utilQsString(hash, true));
|
||||
|
||||
let imageryUsed = [];
|
||||
let photoOverlaysUsed = [];
|
||||
|
||||
@@ -54,17 +54,15 @@ export function rendererFeatures(context) {
|
||||
|
||||
|
||||
function update() {
|
||||
if (!window.mocha) {
|
||||
var hash = utilStringQs(window.location.hash);
|
||||
var disabled = features.disabled();
|
||||
if (disabled.length) {
|
||||
hash.disable_features = disabled.join(',');
|
||||
} else {
|
||||
delete hash.disable_features;
|
||||
}
|
||||
window.location.replace('#' + utilQsString(hash, true));
|
||||
prefs('disabled-features', disabled.join(','));
|
||||
const hash = utilStringQs(window.location.hash);
|
||||
const disabled = features.disabled();
|
||||
if (disabled.length) {
|
||||
hash.disable_features = disabled.join(',');
|
||||
} else {
|
||||
delete hash.disable_features;
|
||||
}
|
||||
window.history.replaceState(null, '', '#' + utilQsString(hash, true));
|
||||
prefs('disabled-features', disabled.join(','));
|
||||
_hidden = features.hidden();
|
||||
dispatch.call('change');
|
||||
dispatch.call('redraw');
|
||||
|
||||
@@ -18,8 +18,6 @@ export function rendererPhotos(context) {
|
||||
function photos() {}
|
||||
|
||||
function updateStorage() {
|
||||
if (window.mocha) return;
|
||||
|
||||
var hash = utilStringQs(window.location.hash);
|
||||
var enabled = context.layers().all().filter(function(d) {
|
||||
return _layerIDs.indexOf(d.id) !== -1 && d.layer && d.layer.supported() && d.layer.enabled();
|
||||
@@ -31,7 +29,7 @@ export function rendererPhotos(context) {
|
||||
} else {
|
||||
delete hash.photo_overlay;
|
||||
}
|
||||
window.location.replace('#' + utilQsString(hash, true));
|
||||
window.history.replaceState(null, '', '#' + utilQsString(hash, true));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,17 +148,15 @@ export function rendererPhotos(context) {
|
||||
* @param {string} property Name of the value
|
||||
*/
|
||||
function setUrlFilterValue(property, val) {
|
||||
if (!window.mocha) {
|
||||
var hash = utilStringQs(window.location.hash);
|
||||
if (val) {
|
||||
if (hash[property] === val) return;
|
||||
hash[property] = val;
|
||||
} else {
|
||||
if (!(property in hash)) return;
|
||||
delete hash[property];
|
||||
}
|
||||
window.location.replace('#' + utilQsString(hash, true));
|
||||
const hash = utilStringQs(window.location.hash);
|
||||
if (val) {
|
||||
if (hash[property] === val) return;
|
||||
hash[property] = val;
|
||||
} else {
|
||||
if (!(property in hash)) return;
|
||||
delete hash[property];
|
||||
}
|
||||
window.history.replaceState(null, '', '#' + utilQsString(hash, true));
|
||||
}
|
||||
|
||||
function showsLayer(id) {
|
||||
|
||||
@@ -554,15 +554,13 @@ export default {
|
||||
|
||||
|
||||
updateUrlImage: function(imageKey) {
|
||||
if (!window.mocha) {
|
||||
var hash = utilStringQs(window.location.hash);
|
||||
if (imageKey) {
|
||||
hash.photo = 'kartaview/' + imageKey;
|
||||
} else {
|
||||
delete hash.photo;
|
||||
}
|
||||
window.location.replace('#' + utilQsString(hash, true));
|
||||
const hash = utilStringQs(window.location.hash);
|
||||
if (imageKey) {
|
||||
hash.photo = 'kartaview/' + imageKey;
|
||||
} else {
|
||||
delete hash.photo;
|
||||
}
|
||||
window.history.replaceState(null, '', '#' + utilQsString(hash, true));
|
||||
},
|
||||
|
||||
|
||||
|
||||
@@ -308,15 +308,13 @@ export default {
|
||||
},
|
||||
|
||||
updateUrlImage: function(imageKey) {
|
||||
if (!window.mocha) {
|
||||
var hash = utilStringQs(window.location.hash);
|
||||
if (imageKey) {
|
||||
hash.photo = 'mapilio/' + imageKey;
|
||||
} else {
|
||||
delete hash.photo;
|
||||
}
|
||||
window.location.replace('#' + utilQsString(hash, true));
|
||||
const hash = utilStringQs(window.location.hash);
|
||||
if (imageKey) {
|
||||
hash.photo = 'mapilio/' + imageKey;
|
||||
} else {
|
||||
delete hash.photo;
|
||||
}
|
||||
window.history.replaceState(null, '', '#' + utilQsString(hash, true));
|
||||
},
|
||||
|
||||
initViewer: function () {
|
||||
|
||||
@@ -524,15 +524,13 @@ export default {
|
||||
|
||||
// Update the URL with current image id
|
||||
updateUrlImage: function(imageId) {
|
||||
if (!window.mocha) {
|
||||
const hash = utilStringQs(window.location.hash);
|
||||
if (imageId) {
|
||||
hash.photo = 'mapillary/' + imageId;
|
||||
} else {
|
||||
delete hash.photo;
|
||||
}
|
||||
window.location.replace('#' + utilQsString(hash, true));
|
||||
const hash = utilStringQs(window.location.hash);
|
||||
if (imageId) {
|
||||
hash.photo = 'mapillary/' + imageId;
|
||||
} else {
|
||||
delete hash.photo;
|
||||
}
|
||||
window.history.replaceState(null, '', '#' + utilQsString(hash, true));
|
||||
},
|
||||
|
||||
|
||||
|
||||
@@ -419,15 +419,13 @@ export default {
|
||||
* @param {*} imageKey
|
||||
*/
|
||||
updateUrlImage: function(imageKey) {
|
||||
if (!window.mocha) {
|
||||
var hash = utilStringQs(window.location.hash);
|
||||
if (imageKey) {
|
||||
hash.photo = 'panoramax/' + imageKey;
|
||||
} else {
|
||||
delete hash.photo;
|
||||
}
|
||||
window.location.replace('#' + utilQsString(hash, true));
|
||||
const hash = utilStringQs(window.location.hash);
|
||||
if (imageKey) {
|
||||
hash.photo = 'panoramax/' + imageKey;
|
||||
} else {
|
||||
delete hash.photo;
|
||||
}
|
||||
window.history.replaceState(null, '', '#' + utilQsString(hash, true));
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -905,15 +905,13 @@ export default {
|
||||
|
||||
|
||||
updateUrlImage: function(imageKey) {
|
||||
if (!window.mocha) {
|
||||
var hash = utilStringQs(window.location.hash);
|
||||
if (imageKey) {
|
||||
hash.photo = 'streetside/' + imageKey;
|
||||
} else {
|
||||
delete hash.photo;
|
||||
}
|
||||
window.location.replace('#' + utilQsString(hash, true));
|
||||
const hash = utilStringQs(window.location.hash);
|
||||
if (imageKey) {
|
||||
hash.photo = 'streetside/' + imageKey;
|
||||
} else {
|
||||
delete hash.photo;
|
||||
}
|
||||
window.history.replaceState(null, '', '#' + utilQsString(hash, true));
|
||||
},
|
||||
|
||||
|
||||
|
||||
@@ -584,15 +584,13 @@ export default {
|
||||
},
|
||||
|
||||
updateUrlImage: function (key) {
|
||||
if (!window.mocha) {
|
||||
const hash = utilStringQs(window.location.hash);
|
||||
if (key) {
|
||||
hash.photo = 'vegbilder/' + key;
|
||||
} else {
|
||||
delete hash.photo;
|
||||
}
|
||||
window.location.replace('#' + utilQsString(hash, true));
|
||||
const hash = utilStringQs(window.location.hash);
|
||||
if (key) {
|
||||
hash.photo = 'vegbilder/' + key;
|
||||
} else {
|
||||
delete hash.photo;
|
||||
}
|
||||
window.history.replaceState(null, '', '#' + utilQsString(hash, true));
|
||||
},
|
||||
|
||||
validHere: function(extent) {
|
||||
|
||||
@@ -163,7 +163,7 @@ export function uiIntro(context) {
|
||||
overlays.forEach(d => context.background().toggleOverlayLayer(d));
|
||||
if (history) { context.history().fromJSON(history, false); }
|
||||
context.map().centerZoom(center, zoom);
|
||||
window.location.replace(hash);
|
||||
window.history.replaceState(null, '', hash);
|
||||
context.inIntro(false);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user