Merge branch 'develop' into d3-6

This commit is contained in:
Quincy Morgan
2020-10-13 13:38:09 -04:00
19 changed files with 789 additions and 703 deletions
+34 -1
View File
@@ -120,16 +120,49 @@ export function actionSplit(nodeIds, newWayIds) {
nodesB = wayA.nodes.slice(idx);
}
var lengthA = totalLengthBetweenNodes(graph, nodesA);
var lengthB = totalLengthBetweenNodes(graph, nodesB);
if (_keepHistoryOn === 'longest' &&
totalLengthBetweenNodes(graph, nodesB) > totalLengthBetweenNodes(graph, nodesA)) {
lengthB > lengthA) {
// keep the history on the longer way, regardless of the node count
wayA = wayA.update({ nodes: nodesB });
wayB = wayB.update({ nodes: nodesA });
var temp = lengthA;
lengthA = lengthB;
lengthB = temp;
} else {
wayA = wayA.update({ nodes: nodesA });
wayB = wayB.update({ nodes: nodesB });
}
if (wayA.tags.step_count) {
// divide up the the step count proportionally between the two ways
var stepCount = parseFloat(wayA.tags.step_count);
if (stepCount &&
// ensure a number
isFinite(stepCount) &&
// ensure positive
stepCount > 0 &&
// ensure integer
Math.round(stepCount) === stepCount) {
var tagsA = Object.assign({}, wayA.tags);
var tagsB = Object.assign({}, wayB.tags);
var ratioA = lengthA / (lengthA + lengthB);
var countA = Math.round(stepCount * ratioA);
tagsA.step_count = countA.toString();
tagsB.step_count = (stepCount - countA).toString();
wayA = wayA.update({ tags: tagsA });
wayB = wayB.update({ tags: tagsB });
}
}
graph = graph.replace(wayA);
graph = graph.replace(wayB);
+1
View File
@@ -7,6 +7,7 @@ export function actionUpgradeTags(entityId, oldTags, replaceTags) {
var semiIndex;
for (var oldTagKey in oldTags) {
if (!(oldTagKey in tags)) continue;
// wildcard match
if (oldTags[oldTagKey] === '*') {
// note the value since we might need to transfer it
+1
View File
@@ -34,6 +34,7 @@ export function presetField(fieldID, field) {
_this.terms = () => _this.t('terms', { 'default': _this.originalTerms })
.toLowerCase().trim().split(/\s*,+\s*/);
_this.increment = _this.type === 'number' ? (_this.increment || 1) : undefined;
return _this;
}
+4 -2
View File
@@ -75,13 +75,15 @@ export function uiFieldText(field, context) {
input.attr('type', 'text');
var inc = field.increment;
var buttons = wrap.selectAll('.increment, .decrement')
.data(rtl ? [1, -1] : [-1, 1]);
.data(rtl ? [inc, -inc] : [-inc, inc]);
buttons.enter()
.append('button')
.attr('class', function(d) {
var which = (d === 1 ? 'increment' : 'decrement');
var which = (d > 0 ? 'increment' : 'decrement');
return 'form-field-button ' + which;
})
.merge(buttons)
+2
View File
@@ -24,6 +24,7 @@ export function uiStatus(context) {
selection
.html(t.html('osm_api_status.message.rateLimit'))
.append('a')
.attr('href', '#')
.attr('class', 'api-status-login')
.attr('target', '_blank')
.call(svgIcon('#iD-icon-out-link', 'inline'))
@@ -48,6 +49,7 @@ export function uiStatus(context) {
selection
.html(t.html('osm_api_status.message.error') + ' ')
.append('a')
.attr('href', '#')
// let the user manually retry their connection directly
.html(t.html('osm_api_status.retry'))
.on('click.retry', function(d3_event) {
+1 -1
View File
@@ -32,7 +32,7 @@ export function uiSuccess(context) {
let ociFeatures = {};
Object.values(ociResources).forEach(resource => {
const feature = loco.resolveLocationSet(resource.locationSet);
const feature = loco.resolveLocationSet(resource.locationSet).feature;
let ociFeature = ociFeatures[feature.id];
if (!ociFeature) {
ociFeature = JSON.parse(JSON.stringify(feature)); // deep clone