mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-23 08:39:56 +02:00
Fix merge issues
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
import { geoBounds as d3_geoBounds } from 'd3-geo';
|
||||
|
||||
import {
|
||||
|
||||
@@ -3,8 +3,6 @@ import {
|
||||
select as d3_select
|
||||
} from 'd3-selection';
|
||||
|
||||
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
|
||||
|
||||
import {
|
||||
behaviorBreathe,
|
||||
behaviorHover,
|
||||
@@ -13,8 +11,9 @@ import {
|
||||
} from '../behavior';
|
||||
|
||||
import { services } from '../services';
|
||||
import { modeBrowse } from './browse';
|
||||
import { modeBrowse, modeDragNode, modeDragNote } from '../modes';
|
||||
import { uiKeepRightEditor } from '../ui';
|
||||
import { utilKeybinding } from '../util';
|
||||
|
||||
|
||||
export function modeSelectError(context, selectedErrorID) {
|
||||
@@ -24,7 +23,7 @@ export function modeSelectError(context, selectedErrorID) {
|
||||
};
|
||||
|
||||
var keepRight = services.keepRight;
|
||||
var keybinding = d3_keybinding('select-error');
|
||||
var keybinding = utilKeybinding('select-error');
|
||||
var keepRightEditor = uiKeepRightEditor(context)
|
||||
.on('change', function() {
|
||||
context.map().pan([0,0]); // trigger a redraw
|
||||
@@ -39,6 +38,8 @@ export function modeSelectError(context, selectedErrorID) {
|
||||
behaviorHover(context),
|
||||
behaviorSelect(context),
|
||||
behaviorLasso(context),
|
||||
modeDragNode(context).behavior,
|
||||
modeDragNote(context).behavior
|
||||
];
|
||||
|
||||
|
||||
@@ -51,6 +52,7 @@ export function modeSelectError(context, selectedErrorID) {
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
mode.enter = function() {
|
||||
|
||||
// class the error as selected, or return to browse mode if the error is gone
|
||||
@@ -76,48 +78,45 @@ export function modeSelectError(context, selectedErrorID) {
|
||||
}
|
||||
|
||||
function esc() {
|
||||
if (d3_select('.combobox').size()) return;
|
||||
context.enter(modeBrowse(context));
|
||||
}
|
||||
|
||||
var error = checkSelectedID();
|
||||
if (!error) return;
|
||||
|
||||
behaviors.forEach(function(behavior) {
|
||||
context.install(behavior);
|
||||
});
|
||||
|
||||
keybinding
|
||||
.on('⎋', esc, true);
|
||||
behaviors.forEach(context.install);
|
||||
keybinding.on('⎋', esc, true);
|
||||
|
||||
d3_select(document)
|
||||
.call(keybinding);
|
||||
|
||||
selectError();
|
||||
|
||||
context.ui().sidebar
|
||||
.show(keepRightEditor.error(error));
|
||||
var sidebar = context.ui().sidebar;
|
||||
sidebar.show(keepRightEditor.error(error));
|
||||
|
||||
context.map()
|
||||
.on('drawn.select', selectError);
|
||||
.on('drawn.select-error', selectError);
|
||||
};
|
||||
|
||||
|
||||
mode.exit = function() {
|
||||
behaviors.forEach(function(behavior) {
|
||||
context.uninstall(behavior);
|
||||
});
|
||||
behaviors.forEach(context.uninstall);
|
||||
|
||||
keybinding.off();
|
||||
d3_select(document)
|
||||
.call(keybinding.unbind);
|
||||
|
||||
context.surface()
|
||||
.selectAll('.kr_error.selected')
|
||||
.classed('selected hover', false);
|
||||
|
||||
context.map()
|
||||
.on('drawn.select', null);
|
||||
.on('drawn.select-error', null);
|
||||
|
||||
context.ui().sidebar
|
||||
.hide();
|
||||
|
||||
context.selectedErrorID(null);
|
||||
};
|
||||
|
||||
|
||||
@@ -355,7 +355,7 @@ export function rendererMap(context) {
|
||||
|
||||
var mode = context.mode();
|
||||
if (mode && mode.id !== 'save' && mode.id !== 'select-note' &&
|
||||
mode.id !== 'select-data' && && mode.id !== 'select-error') {
|
||||
mode.id !== 'select-data' && mode.id !== 'select-error') {
|
||||
context.enter(modeBrowse(context));
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@ import { select as d3_select } from 'd3-selection';
|
||||
|
||||
import { svgPointTransform } from './helpers';
|
||||
import { geoMetersToLat } from '../geo';
|
||||
import _throttle from 'lodash-es/throttle';
|
||||
|
||||
export function svgGeolocate(projection, context, dispatch) {
|
||||
|
||||
export function svgGeolocate(projection) {
|
||||
var layer = d3_select(null);
|
||||
var _position;
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
|
||||
import { t } from '../util/locale';
|
||||
import { svgIcon } from '../svg';
|
||||
import { services } from '../services';
|
||||
@@ -28,9 +26,9 @@ export function uiKeepRightComment() {
|
||||
.text(_error.comment);
|
||||
}
|
||||
|
||||
keepRightComment.error = function(_) {
|
||||
keepRightComment.error = function(val) {
|
||||
if (!arguments.length) return _error;
|
||||
_error = _;
|
||||
_error = val;
|
||||
return keepRightComment;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { t } from '../util/locale';
|
||||
import { parseErrorDescriptions, errorTypes } from '../util';
|
||||
import { select as d3_selectAll } from 'd3-selection';
|
||||
|
||||
import { clickLink } from '../util/keepRight';
|
||||
|
||||
|
||||
+56
-65
@@ -22,8 +22,6 @@ export function uiMapData(context) {
|
||||
|
||||
var key = t('map_data.key');
|
||||
var features = context.features().keys();
|
||||
var QAs = ['keepRight'];
|
||||
// var errors = Object.keys(errorTypes.errors); // TODO: add warnings
|
||||
var layers = context.layers();
|
||||
var fills = ['wireframe', 'partial', 'full'];
|
||||
|
||||
@@ -36,7 +34,6 @@ export function uiMapData(context) {
|
||||
var _fillList = d3_select(null);
|
||||
var _featureList = d3_select(null);
|
||||
var _QAList = d3_select(null);
|
||||
// var _KeepRightList = d3_select(null);
|
||||
|
||||
|
||||
function showsFeature(d) {
|
||||
@@ -57,7 +54,6 @@ export function uiMapData(context) {
|
||||
|
||||
|
||||
function showsQA(d) {
|
||||
|
||||
var QAKeys = [d];
|
||||
var QALayers = layers.all().filter(function(obj) { return QAKeys.indexOf(obj.id) !== -1; });
|
||||
var data = QALayers.filter(function(obj) { return obj.layer.supported(); });
|
||||
@@ -70,18 +66,8 @@ export function uiMapData(context) {
|
||||
}
|
||||
|
||||
return layerEnabled(data[0]);
|
||||
|
||||
}
|
||||
|
||||
// function clickError(d) {
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// function showsError(d) {
|
||||
|
||||
// }
|
||||
|
||||
|
||||
function showsFill(d) {
|
||||
return _fillSelected === d;
|
||||
@@ -242,6 +228,58 @@ export function uiMapData(context) {
|
||||
}
|
||||
|
||||
|
||||
function drawQAItems(selection) {
|
||||
var qaKeys = ['keepRight'];
|
||||
var qaLayers = layers.all().filter(function(obj) { return qaKeys.indexOf(obj.id) !== -1; });
|
||||
|
||||
var ul = selection
|
||||
.selectAll('.layer-list-qa')
|
||||
.data([0]);
|
||||
|
||||
ul = ul.enter()
|
||||
.append('ul')
|
||||
.attr('class', 'layer-list layer-list-qa')
|
||||
.merge(ul);
|
||||
|
||||
var li = ul.selectAll('.list-item')
|
||||
.data(qaLayers);
|
||||
|
||||
li.exit()
|
||||
.remove();
|
||||
|
||||
var liEnter = li.enter()
|
||||
.append('li')
|
||||
.attr('class', function(d) { return 'list-item list-item-' + d.id; });
|
||||
|
||||
var labelEnter = liEnter
|
||||
.append('label')
|
||||
.each(function(d) {
|
||||
d3_select(this)
|
||||
.call(tooltip()
|
||||
.title(t('map_data.layers.' + d.id + '.tooltip'))
|
||||
.placement('bottom')
|
||||
);
|
||||
});
|
||||
|
||||
labelEnter
|
||||
.append('input')
|
||||
.attr('type', 'checkbox')
|
||||
.on('change', function(d) { toggleLayer(d.id); });
|
||||
|
||||
labelEnter
|
||||
.append('span')
|
||||
.text(function(d) { return t('map_data.layers.' + d.id + '.title'); });
|
||||
|
||||
|
||||
// Update
|
||||
li
|
||||
.merge(liEnter)
|
||||
.classed('active', function (d) { return d.layer.enabled(); })
|
||||
.selectAll('input')
|
||||
.property('checked', function (d) { return d.layer.enabled(); });
|
||||
}
|
||||
|
||||
|
||||
// Beta feature - sample vector layers to support Detroit Mapping Challenge
|
||||
// https://github.com/osmus/detroit-mapping-challenge
|
||||
function drawVectorItems(selection) {
|
||||
@@ -451,9 +489,6 @@ export function uiMapData(context) {
|
||||
var QAButtons = d3_select('.layer-QA').selectAll('li').select('label').select('input');
|
||||
var buttonSection = selection.selectAll('.QA-buttons')
|
||||
.data([0]);
|
||||
// function drawQAButtons(selection) {
|
||||
|
||||
// var QAButtons = d3_select('.layer-QA').selectAll('li').select('label').select('input');
|
||||
|
||||
// var buttonSection = selection.selectAll('.QA-buttons')
|
||||
// .data([0]);
|
||||
@@ -487,7 +522,7 @@ export function uiMapData(context) {
|
||||
|
||||
// buttonSection = buttonSection
|
||||
// .merge(buttonEnter);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
function drawListItems(selection, data, type, name, change, active) {
|
||||
@@ -578,30 +613,10 @@ export function uiMapData(context) {
|
||||
}
|
||||
|
||||
|
||||
function renderQAList(selection) {
|
||||
var container = selection.selectAll('layer-QA')
|
||||
.data([0]);
|
||||
|
||||
_QAList = container.enter()
|
||||
.append('ul')
|
||||
.attr('class', 'layer-list layer-QA')
|
||||
.merge(container);
|
||||
}
|
||||
|
||||
// function renderKeepRightList(selection) {
|
||||
// var container = selection.selectAll('layer-keepRight')
|
||||
// .data([0]);
|
||||
|
||||
// _KeepRightList = container.enter()
|
||||
// .append('ul')
|
||||
// .attr('class', 'layer-list layer-keepRight')
|
||||
// .merge(container);
|
||||
// }
|
||||
|
||||
|
||||
function update() {
|
||||
_dataLayerContainer
|
||||
.call(drawOsmItems)
|
||||
.call(drawQAItems)
|
||||
.call(drawPhotoItems)
|
||||
.call(drawCustomDataItems)
|
||||
.call(drawVectorItems); // Beta - Detroit mapping challenge
|
||||
@@ -613,12 +628,7 @@ export function uiMapData(context) {
|
||||
.call(drawListItems, features, 'checkbox', 'feature', clickFeature, showsFeature);
|
||||
|
||||
_QAList
|
||||
.call(drawListItems, QAs, 'checkbox', 'QA', function(d) { toggleLayer(d); }, showsQA);
|
||||
|
||||
// _KeepRightList
|
||||
// .call(drawListItems, errors, 'checkbox', 'QA.keepRight.errorTypes.errors', clickError, showsError);
|
||||
// d3_select('.disclosure-wrap-QA')
|
||||
// .call(drawQAButtons);
|
||||
.call(drawListItems, ['keep-right'], 'checkbox', 'QA', function(d) { toggleLayer(d); }, showsQA);
|
||||
}
|
||||
|
||||
|
||||
@@ -718,6 +728,7 @@ export function uiMapData(context) {
|
||||
.append('div')
|
||||
.attr('class', 'pane-content');
|
||||
|
||||
|
||||
// data layers
|
||||
content
|
||||
.append('div')
|
||||
@@ -745,31 +756,11 @@ export function uiMapData(context) {
|
||||
.content(renderFeatureList)
|
||||
);
|
||||
|
||||
// Q/A tools
|
||||
content
|
||||
.append('div')
|
||||
.attr('class', 'map-data-QA')
|
||||
.call(uiDisclosure(context, 'QA', false)
|
||||
.title(t('map_data.QA.title'))
|
||||
.content(renderQAList)
|
||||
);
|
||||
|
||||
// // adding keepRight sublayers
|
||||
// QA_list
|
||||
// .append('div')
|
||||
// .attr('class', 'keepRight-errors')
|
||||
// .call(uiDisclosure(context, 'keepRight', false)
|
||||
// .title(t('map_data.QA.keepRight'))
|
||||
// .content(renderKeepRightList)
|
||||
// );
|
||||
|
||||
|
||||
// add listeners
|
||||
context.features()
|
||||
.on('change.map_data-update', update);
|
||||
|
||||
// context.errors()
|
||||
// .on('change.map_data-update', update); // TODO: add errors list to context?
|
||||
update();
|
||||
setFill(_fillSelected);
|
||||
|
||||
|
||||
@@ -125,14 +125,14 @@ export function uiSidebar(context) {
|
||||
selection.selectAll('.sidebar-component')
|
||||
.classed('inspector-hover', true);
|
||||
|
||||
} else if (what instanceof krError) {
|
||||
} else if (datum instanceof krError) {
|
||||
_was_krError = true;
|
||||
var kr_errors = d3_selectAll('.kr_error');
|
||||
kr_errors
|
||||
.classed('hover', function(d) { return d === what; });
|
||||
.classed('hover', function(d) { return d === datum; });
|
||||
|
||||
sidebar
|
||||
.show(keepRightEditor.error(what));
|
||||
.show(keepRightEditor.error(datum));
|
||||
|
||||
selection.selectAll('.sidebar-component')
|
||||
.classed('inspector-hover', true);
|
||||
|
||||
@@ -6,50 +6,6 @@ import { krError } from '../../osm';
|
||||
import { errorTypes } from './errorSchema.json';
|
||||
import { parseError } from './parse_error';
|
||||
|
||||
// TODO: for reference; remove
|
||||
var keepRightSchema = {
|
||||
'schema': '',
|
||||
'id': 0,
|
||||
'error_type': 0,
|
||||
'error_name': 0,
|
||||
'object_type': [
|
||||
'node',
|
||||
'way',
|
||||
'relation'
|
||||
],
|
||||
'object_id': 0,
|
||||
'state': [
|
||||
'new',
|
||||
'reopened',
|
||||
'ignore_temporarily',
|
||||
'ignore'
|
||||
],
|
||||
'first_occurrence': new Date(),
|
||||
'last_checked': new Date(),
|
||||
'object_timestamp': new Date(),
|
||||
'user_name': '',
|
||||
'lat': 0,
|
||||
'lon': 0,
|
||||
'comment': '',
|
||||
'comment_timestamp': new Date(),
|
||||
'msgid': '',
|
||||
'txt1': '',
|
||||
'txt2': '',
|
||||
'txt3': '',
|
||||
'txt4': '',
|
||||
'txt5': ''
|
||||
};
|
||||
// TODO: for reference; remove
|
||||
var keepRightSchemaFromWeb = {
|
||||
'error_type': '192',
|
||||
'object_type': 'way',
|
||||
'object_id': '339948768',
|
||||
'comment': null,
|
||||
'error_id': '92854860',
|
||||
'schema': '58',
|
||||
'description': 'This waterway intersects the highway #450282565',
|
||||
'title': 'intersections without junctions, highway-waterway'
|
||||
};
|
||||
|
||||
export function parseErrorDescriptions(entity) {
|
||||
var parsedDetails = {};
|
||||
|
||||
Reference in New Issue
Block a user