mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 05:30:35 +02:00
Merge branch 'master' into validation
# Conflicts: # data/core.yaml # dist/locales/en.json # modules/ui/commit_warnings.js # modules/ui/entity_editor.js # modules/util/index.js # modules/util/util.js # modules/validations/index.js # modules/validations/many_deletions.js # modules/validations/missing_tag.js
This commit is contained in:
+79
-5
@@ -30,6 +30,7 @@ export function uiMapData(context) {
|
||||
var _dataLayerContainer = d3_select(null);
|
||||
var _fillList = d3_select(null);
|
||||
var _featureList = d3_select(null);
|
||||
var _QAList = d3_select(null);
|
||||
|
||||
|
||||
function showsFeature(d) {
|
||||
@@ -38,6 +39,7 @@ export function uiMapData(context) {
|
||||
|
||||
|
||||
function autoHiddenFeature(d) {
|
||||
if (d.type === 'kr_error') return context.errors().autoHidden(d);
|
||||
return context.features().autoHidden(d);
|
||||
}
|
||||
|
||||
@@ -48,6 +50,22 @@ 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(); });
|
||||
|
||||
function layerSupported(d) {
|
||||
return d.layer && d.layer.supported();
|
||||
}
|
||||
function layerEnabled(d) {
|
||||
return layerSupported(d) && d.layer.enabled();
|
||||
}
|
||||
|
||||
return layerEnabled(data[0]);
|
||||
}
|
||||
|
||||
|
||||
function showsFill(d) {
|
||||
return _fillSelected === d;
|
||||
}
|
||||
@@ -207,6 +225,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) {
|
||||
@@ -427,10 +497,9 @@ export function uiMapData(context) {
|
||||
.call(tooltip()
|
||||
.html(true)
|
||||
.title(function(d) {
|
||||
var tip = t(name + '.' + d + '.tooltip'),
|
||||
key = (d === 'wireframe' ? t('area_fill.wireframe.key') : null);
|
||||
|
||||
if (name === 'feature' && autoHiddenFeature(d)) {
|
||||
var tip = t(name + '.' + d + '.tooltip');
|
||||
var key = (d === 'wireframe' ? t('area_fill.wireframe.key') : null);
|
||||
if ((name === 'feature' || name === 'keepRight') && autoHiddenFeature(d)) {
|
||||
var msg = showsLayer('osm') ? t('map_data.autohidden') : t('map_data.osmhidden');
|
||||
tip += '<div>' + msg + '</div>';
|
||||
}
|
||||
@@ -461,7 +530,7 @@ export function uiMapData(context) {
|
||||
.selectAll('input')
|
||||
.property('checked', active)
|
||||
.property('indeterminate', function(d) {
|
||||
return (name === 'feature' && autoHiddenFeature(d));
|
||||
return ((name === 'feature' || name === 'keepRight') && autoHiddenFeature(d));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -502,6 +571,7 @@ export function uiMapData(context) {
|
||||
function update() {
|
||||
_dataLayerContainer
|
||||
.call(drawOsmItems)
|
||||
.call(drawQAItems)
|
||||
.call(drawPhotoItems)
|
||||
.call(drawCustomDataItems)
|
||||
.call(drawVectorItems); // Beta - Detroit mapping challenge
|
||||
@@ -511,6 +581,9 @@ export function uiMapData(context) {
|
||||
|
||||
_featureList
|
||||
.call(drawListItems, features, 'checkbox', 'feature', clickFeature, showsFeature);
|
||||
|
||||
_QAList
|
||||
.call(drawListItems, ['keep-right'], 'checkbox', 'QA', function(d) { toggleLayer(d); }, showsQA);
|
||||
}
|
||||
|
||||
|
||||
@@ -611,6 +684,7 @@ export function uiMapData(context) {
|
||||
.append('div')
|
||||
.attr('class', 'pane-content');
|
||||
|
||||
|
||||
// data layers
|
||||
content
|
||||
.append('div')
|
||||
|
||||
Reference in New Issue
Block a user