mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-21 07:46:58 +02:00
Merge pull request #9076 from renancleyson-dev/fix-imagery-unselected
Fix iD using invalid user selected imagery
This commit is contained in:
@@ -56,6 +56,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
|
||||
* Fix localizable labels in multiCombo fields ("chips") being rendered multiple times ([#9169])
|
||||
* Fix missing styling when rendering of proposed footway/cycleway/path bridges ([#9172], thanks [@k-yle])
|
||||
* Fix some boundary lines (and preset) not hidden by the map features filter ([#9171], thanks [@k-yle])
|
||||
* Fix iD using invalid user selected imagery ([#8732], thanks [@renancleyson-dev])
|
||||
#### :rocket: Presets
|
||||
* Disable taginfo suggestions for the `via` field ([#9140], thanks [@k-yle])
|
||||
* Treat `surface=chipseal` as a paved surface ([#9139], thanks [@k-yle])
|
||||
@@ -68,6 +69,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
|
||||
|
||||
|
||||
[#8419]: https://github.com/openstreetmap/iD/issues/8419
|
||||
[#8732]: https://github.com/openstreetmap/iD/issues/8732
|
||||
[#8881]: https://github.com/openstreetmap/iD/issues/8881
|
||||
[#8975]: https://github.com/openstreetmap/iD/pull/8975
|
||||
[#9018]: https://github.com/openstreetmap/iD/issues/9018
|
||||
@@ -87,6 +89,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
|
||||
[@JackNUMBER]: https://github.com/JackNUMBER
|
||||
[@aaditya0000]: https://github.com/aaditya0000
|
||||
[@paulklie]: https://github.com/paulklie
|
||||
[@renancleyson-dev]: https://github.com/renancleyson-dev
|
||||
|
||||
|
||||
# 2.21.1
|
||||
|
||||
@@ -454,29 +454,32 @@ export function rendererBackground(context) {
|
||||
}
|
||||
|
||||
const hash = utilStringQs(window.location.hash);
|
||||
const requested = hash.background || hash.layer;
|
||||
const requestedBackground = hash.background || hash.layer;
|
||||
const lastUsedBackground = prefs('background-last-used');
|
||||
let extent = parseMapParams(hash.map);
|
||||
|
||||
return _loadPromise = ensureImageryIndex()
|
||||
.then(imageryIndex => {
|
||||
const first = imageryIndex.backgrounds.length && imageryIndex.backgrounds[0];
|
||||
const validBackgrounds = background.sources(extent).filter(d => d.id !== 'none' && d.id !== 'custom');
|
||||
const first = validBackgrounds.length && validBackgrounds[0];
|
||||
const isLastUsedValid = !!validBackgrounds.find(d => d.id && d.id === lastUsedBackground);
|
||||
|
||||
let best;
|
||||
if (!requested && extent) {
|
||||
best = background.sources(extent).find(s => s.best());
|
||||
if (!requestedBackground && extent) {
|
||||
best = validBackgrounds.find(s => s.best());
|
||||
}
|
||||
|
||||
// Decide which background layer to display
|
||||
if (requested && requested.indexOf('custom:') === 0) {
|
||||
const template = requested.replace(/^custom:/, '');
|
||||
if (requestedBackground && requestedBackground.indexOf('custom:') === 0) {
|
||||
const template = requestedBackground.replace(/^custom:/, '');
|
||||
const custom = background.findSource('custom');
|
||||
background.baseLayerSource(custom.template(template));
|
||||
prefs('background-custom-template', template);
|
||||
} else {
|
||||
background.baseLayerSource(
|
||||
background.findSource(requested) ||
|
||||
background.findSource(requestedBackground) ||
|
||||
best ||
|
||||
background.findSource(prefs('background-last-used')) ||
|
||||
isLastUsedValid && background.findSource(lastUsedBackground) ||
|
||||
background.findSource('Bing') ||
|
||||
first ||
|
||||
background.findSource('none')
|
||||
|
||||
Reference in New Issue
Block a user