Fix merge conflicts

This commit is contained in:
Nikola Plesa
2020-10-15 18:15:57 +02:00
502 changed files with 8920 additions and 6324 deletions
+23 -13
View File
@@ -271,6 +271,7 @@ export function rendererBackground(context) {
context.history().photoOverlaysUsed(photoOverlaysUsed);
};
let _checkedBlocklists;
background.sources = (extent, zoom, includeCurrent) => {
if (!_imageryIndex) return []; // called before init()?
@@ -281,9 +282,22 @@ export function rendererBackground(context) {
const currSource = baseLayer.source();
const osm = context.connection();
const blocklists = osm && osm.imageryBlocklists();
if (blocklists && blocklists !== _checkedBlocklists) {
_imageryIndex.backgrounds.forEach(source => {
source.isBlocked = blocklists.some(function(blocklist) {
return blocklist.test(source.template());
});
});
_checkedBlocklists = blocklists;
}
return _imageryIndex.backgrounds.filter(source => {
if (includeCurrent && currSource === source) return true; // optionally always include the current imagery
if (source.isBlocked) return false; // even bundled sources may be blocked - #7905
if (!source.polygon) return true; // always include imagery with worldwide coverage
if (includeCurrent && currSource === source) return true; // optionally include the current imagery
if (zoom && zoom < 6) return false; // optionally exclude local imagery at low zooms
return visible[source.id]; // include imagery visible in given extent
});
@@ -300,30 +314,26 @@ export function rendererBackground(context) {
background.baseLayerSource = function(d) {
if (!arguments.length) return baseLayer.source();
// test source against OSM imagery blacklists..
// test source against OSM imagery blocklists..
const osm = context.connection();
if (!osm) return background;
const blacklists = osm.imageryBlacklists();
const blocklists = osm.imageryBlocklists();
const template = d.template();
let fail = false;
let tested = 0;
let regex;
for (let i = 0; i < blacklists.length; i++) {
try {
regex = new RegExp(blacklists[i]);
fail = regex.test(template);
tested++;
if (fail) break;
} catch (e) {
/* noop */
}
for (let i = 0; i < blocklists.length; i++) {
regex = blocklists[i];
fail = regex.test(template);
tested++;
if (fail) break;
}
// ensure at least one test was run.
if (!tested) {
regex = new RegExp('.*\.google(apis)?\..*/(vt|kh)[\?/].*([xyz]=.*){3}.*');
regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
fail = regex.test(template);
}
+17 -2
View File
@@ -72,9 +72,15 @@ export function rendererBackgroundSource(data) {
};
source.label = function() {
var id_safe = source.id.replace(/\./g, '<TX_DOT>');
return t.html('imagery.' + id_safe + '.name', { default: _name });
};
source.description = function() {
var id_safe = source.id.replace(/\./g, '<TX_DOT>');
return t('imagery.' + id_safe + '.description', { default: _description });
return t.html('imagery.' + id_safe + '.description', { default: _description });
};
@@ -91,7 +97,7 @@ export function rendererBackgroundSource(data) {
source.imageryUsed = function() {
return name || source.id;
return _name || source.id;
};
@@ -538,6 +544,11 @@ rendererBackgroundSource.None = function() {
};
source.label = function() {
return t.html('background.none');
};
source.imageryUsed = function() {
return null;
};
@@ -560,6 +571,10 @@ rendererBackgroundSource.Custom = function(template) {
return t('background.custom');
};
source.label = function() {
return t.html('background.custom');
};
source.imageryUsed = function() {
// sanitize personal connection tokens - #6801
+1 -1
View File
@@ -500,7 +500,7 @@ export function rendererMap(context) {
);
// On Firefox Windows and Linux we always get +/- the scroll line amount (default 3)
// There doesn't seem to be any scroll accelleration.
// There doesn't seem to be any scroll acceleration.
// This multiplier increases the speed a little bit - #5512
if (detected.os !== 'mac') {
dY *= 5;
+43 -2
View File
@@ -1,5 +1,6 @@
import { dispatch as d3_dispatch } from 'd3-dispatch';
import { services } from '../services';
import { utilRebind } from '../util/rebind';
import { utilQsString, utilStringQs } from '../util';
@@ -136,10 +137,12 @@ export function rendererPhotos(context) {
photos.init = function() {
var hash = utilStringQs(window.location.hash);
if (hash.photo_overlay) {
// support enabling photo layers by default via a URL parameter, e.g. `photo_overlay=openstreetcam;mapillary;streetside`
var hashOverlayIDs = hash.photo_overlay.replace(/;/g, ',').split(',');
hashOverlayIDs.forEach(function(id) {
var layer = context.layers().layer(id);
if (layer) layer.enabled(true);
var layer = _layerIDs.indexOf(id) !== -1 && context.layers().layer(id);
if (layer && !layer.enabled()) layer.enabled(true);
});
}
if (hash.fromDate) {
@@ -151,6 +154,44 @@ export function rendererPhotos(context) {
if (hash.username) {
this.setUsernameFilter(hash.username, false);
}
if (hash.photo) {
// support opening a photo via a URL parameter, e.g. `photo=mapillary-fztgSDtLpa08ohPZFZjeRQ`
var photoIds = hash.photo.replace(/;/g, ',').split(',');
var photoId = photoIds.length && photoIds[0].trim();
var results = /(.*)\/(.*)/g.exec(photoId);
if (results && results.length >= 3) {
var serviceId = results[1];
var photoKey = results[2];
var service = services[serviceId];
if (service && service.ensureViewerLoaded) {
// if we're showing a photo then make sure its layer is enabled too
var layer = _layerIDs.indexOf(serviceId) !== -1 && context.layers().layer(serviceId);
if (layer && !layer.enabled()) layer.enabled(true);
var baselineTime = Date.now();
service.on('loadedImages.rendererPhotos', function() {
// don't open the viewer if too much time has elapsed
if (Date.now() - baselineTime > 45000) {
service.on('loadedImages.rendererPhotos', null);
return;
}
if (!service.cachedImage(photoKey)) return;
service.on('loadedImages.rendererPhotos', null);
service.ensureViewerLoaded(context)
.then(function() {
service
.selectImage(context, photoKey)
.showViewer(context);
});
});
}
}
}
context.layers().on('change.rendererPhotos', updateStorage);
};
+2 -2
View File
@@ -238,7 +238,7 @@ export function rendererTileLayer(context) {
debug
.selectAll('.tile-label-debug-coord')
.text(function(d) { return d[2] + ' / ' + d[0] + ' / ' + d[1]; });
.html(function(d) { return d[2] + ' / ' + d[0] + ' / ' + d[1]; });
debug
.selectAll('.tile-label-debug-vintage')
@@ -246,7 +246,7 @@ export function rendererTileLayer(context) {
var span = d3_select(this);
var center = context.projection.invert(tileCenter(d));
_source.getMetadata(center, d, function(err, result) {
span.text((result && result.vintage && result.vintage.range) ||
span.html((result && result.vintage && result.vintage.range) ||
t('info_panels.background.vintage') + ': ' + t('info_panels.background.unknown')
);
});