mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-25 17:37:49 +02:00
Use more generic classes for errors
This commit is contained in:
@@ -112,13 +112,12 @@ export function behaviorHover(context) {
|
||||
entity = datum;
|
||||
selector = '.data' + datum.__featurehash__;
|
||||
|
||||
} else if (datum instanceof impOsmError) {
|
||||
} else if (
|
||||
datum instanceof impOsmError ||
|
||||
datum instanceof krError
|
||||
) {
|
||||
entity = datum;
|
||||
selector = '.iOSM_error-' + datum.id;
|
||||
|
||||
} else if (datum instanceof krError) {
|
||||
entity = datum;
|
||||
selector = '.kr_error-' + datum.id;
|
||||
selector = '.' + datum.source + '.error_id-' + datum.id;
|
||||
|
||||
} else if (datum instanceof osmNote) {
|
||||
entity = datum;
|
||||
|
||||
@@ -174,11 +174,11 @@ export function behaviorSelect(context) {
|
||||
} else if (datum instanceof impOsmError & !isMultiselect) { // clicked an improveOSM error
|
||||
context
|
||||
.selectedErrorID(datum.id)
|
||||
.enter(modeSelectError(context, datum.id, 'ImproveOSM'));
|
||||
.enter(modeSelectError(context, datum.id, datum.source));
|
||||
} else if (datum instanceof krError & !isMultiselect) { // clicked a krError error
|
||||
context
|
||||
.selectedErrorID(datum.id)
|
||||
.enter(modeSelectError(context, datum.id, 'KeepRight'));
|
||||
.enter(modeSelectError(context, datum.id, datum.source));
|
||||
} else { // clicked nothing..
|
||||
context.selectedNoteID(null);
|
||||
context.selectedErrorID(null);
|
||||
|
||||
@@ -27,7 +27,7 @@ export function modeSelectError(context, selectedErrorID, selectedErrorSource) {
|
||||
|
||||
var errorService, errorEditor;
|
||||
switch (selectedErrorSource) {
|
||||
case 'ImproveOSM':
|
||||
case 'iOSM':
|
||||
errorService = services.improveOSM;
|
||||
errorEditor = uiImproveOsmEditor(context)
|
||||
.on('change', function() {
|
||||
@@ -38,7 +38,7 @@ export function modeSelectError(context, selectedErrorID, selectedErrorSource) {
|
||||
.show(errorEditor.error(error));
|
||||
});
|
||||
break;
|
||||
case 'KeepRight':
|
||||
case 'kr':
|
||||
errorService = services.keepRight;
|
||||
errorEditor = uiKeepRightEditor(context)
|
||||
.on('change', function() {
|
||||
@@ -107,7 +107,7 @@ export function modeSelectError(context, selectedErrorID, selectedErrorSource) {
|
||||
if (!checkSelectedID()) return;
|
||||
|
||||
var selection = context.surface()
|
||||
.selectAll('.kr_error-' + selectedErrorID);
|
||||
.selectAll('.error_id-' + selectedErrorID + '.' + selectedErrorSource);
|
||||
|
||||
if (selection.empty()) {
|
||||
// Return to browse mode if selected DOM elements have
|
||||
@@ -139,7 +139,7 @@ export function modeSelectError(context, selectedErrorID, selectedErrorSource) {
|
||||
.call(keybinding.unbind);
|
||||
|
||||
context.surface()
|
||||
.selectAll('.kr_error.selected')
|
||||
.selectAll('.qa_error.selected')
|
||||
.classed('selected hover', false);
|
||||
|
||||
context.map()
|
||||
|
||||
@@ -22,6 +22,7 @@ impOsmError.id.next = -1;
|
||||
_extend(impOsmError.prototype, {
|
||||
|
||||
type: 'impOsmError',
|
||||
source: 'iOSM',
|
||||
|
||||
initialize: function(sources) {
|
||||
for (var i = 0; i < sources.length; ++i) {
|
||||
|
||||
@@ -21,6 +21,7 @@ krError.id.next = -1;
|
||||
_extend(krError.prototype, {
|
||||
|
||||
type: 'krError',
|
||||
source: 'kr',
|
||||
|
||||
initialize: function(sources) {
|
||||
for (var i = 0; i < sources.length; ++i) {
|
||||
@@ -46,4 +47,4 @@ _extend(krError.prototype, {
|
||||
update: function(attrs) {
|
||||
return krError(this, attrs); // {v: 1 + (this.v || 0)}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -216,7 +216,7 @@ export default {
|
||||
var d = new impOsmError({
|
||||
loc: pointAverage(feature.points),
|
||||
comments: null,
|
||||
error_subtype: '_' + geoType,
|
||||
error_subtype: geoType,
|
||||
error_type: k
|
||||
});
|
||||
|
||||
|
||||
@@ -54,9 +54,9 @@ export function svgImproveOSM(projection, context, dispatch) {
|
||||
_improveOsmVisible = false;
|
||||
drawLayer
|
||||
.style('display', 'none');
|
||||
drawLayer.selectAll('.iOSM_error')
|
||||
drawLayer.selectAll('.qa_error.iOSM')
|
||||
.remove();
|
||||
touchLayer.selectAll('.iOSM_error')
|
||||
touchLayer.selectAll('.qa_error.iOSM')
|
||||
.remove();
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ export function svgImproveOSM(projection, context, dispatch) {
|
||||
function layerOff() {
|
||||
throttledRedraw.cancel();
|
||||
drawLayer.interrupt();
|
||||
touchLayer.selectAll('.iOSM_error')
|
||||
touchLayer.selectAll('.qa_error.iOSM')
|
||||
.remove();
|
||||
|
||||
drawLayer
|
||||
@@ -105,7 +105,7 @@ export function svgImproveOSM(projection, context, dispatch) {
|
||||
var getTransform = svgPointTransform(projection);
|
||||
|
||||
// Draw markers..
|
||||
var markers = drawLayer.selectAll('.iOSM_error')
|
||||
var markers = drawLayer.selectAll('.qa_error.iOSM')
|
||||
.data(data, function(d) { return d.id; });
|
||||
|
||||
// exit
|
||||
@@ -116,8 +116,13 @@ export function svgImproveOSM(projection, context, dispatch) {
|
||||
var markersEnter = markers.enter()
|
||||
.append('g')
|
||||
.attr('class', function(d) {
|
||||
return 'iOSM_error iOSM_error-' + d.id + ' iOSM_error_type_' + d.error_type + d.error_subtype; }
|
||||
);
|
||||
return [
|
||||
'qa_error',
|
||||
d.source,
|
||||
'error_id-' + d.id,
|
||||
'error_type-' + d.error_type + '-' + d.error_subtype
|
||||
].join(' ');
|
||||
});
|
||||
|
||||
markersEnter
|
||||
.append('ellipse')
|
||||
@@ -133,7 +138,7 @@ export function svgImproveOSM(projection, context, dispatch) {
|
||||
|
||||
markersEnter
|
||||
.append('use')
|
||||
.attr('class', 'iOSM_error-fill')
|
||||
.attr('class', 'qa_error-fill')
|
||||
.attr('width', '20px')
|
||||
.attr('height', '20px')
|
||||
.attr('x', '-8px')
|
||||
@@ -152,7 +157,7 @@ export function svgImproveOSM(projection, context, dispatch) {
|
||||
if (touchLayer.empty()) return;
|
||||
var fillClass = context.getDebug('target') ? 'pink ' : 'nocolor ';
|
||||
|
||||
var targets = touchLayer.selectAll('.iOSM_error')
|
||||
var targets = touchLayer.selectAll('.qa_error.iOSM')
|
||||
.data(data, function(d) { return d.id; });
|
||||
|
||||
// exit
|
||||
@@ -169,7 +174,7 @@ export function svgImproveOSM(projection, context, dispatch) {
|
||||
.merge(targets)
|
||||
.sort(sortY)
|
||||
.attr('class', function(d) {
|
||||
return 'iOSM_error target iOSM_error-' + d.id + ' ' + fillClass;
|
||||
return 'qa_error ' + d.source + ' target error_id-' + d.id + ' ' + fillClass;
|
||||
})
|
||||
.attr('transform', getTransform);
|
||||
|
||||
|
||||
@@ -54,9 +54,9 @@ export function svgKeepRight(projection, context, dispatch) {
|
||||
_keepRightVisible = false;
|
||||
drawLayer
|
||||
.style('display', 'none');
|
||||
drawLayer.selectAll('.kr_error')
|
||||
drawLayer.selectAll('.qa_error.kr')
|
||||
.remove();
|
||||
touchLayer.selectAll('.kr_error')
|
||||
touchLayer.selectAll('.qa_error.kr')
|
||||
.remove();
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ export function svgKeepRight(projection, context, dispatch) {
|
||||
function layerOff() {
|
||||
throttledRedraw.cancel();
|
||||
drawLayer.interrupt();
|
||||
touchLayer.selectAll('.kr_error')
|
||||
touchLayer.selectAll('.qa_error.kr')
|
||||
.remove();
|
||||
|
||||
drawLayer
|
||||
@@ -105,7 +105,7 @@ export function svgKeepRight(projection, context, dispatch) {
|
||||
var getTransform = svgPointTransform(projection);
|
||||
|
||||
// Draw markers..
|
||||
var markers = drawLayer.selectAll('.kr_error')
|
||||
var markers = drawLayer.selectAll('.qa_error.kr')
|
||||
.data(data, function(d) { return d.id; });
|
||||
|
||||
// exit
|
||||
@@ -116,8 +116,13 @@ export function svgKeepRight(projection, context, dispatch) {
|
||||
var markersEnter = markers.enter()
|
||||
.append('g')
|
||||
.attr('class', function(d) {
|
||||
return 'kr_error kr_error-' + d.id + ' kr_error_type_' + d.parent_error_type; }
|
||||
);
|
||||
return [
|
||||
'qa_error',
|
||||
d.source,
|
||||
'error_id-' + d.id,
|
||||
'error_type-' + d.parent_error_type
|
||||
].join(' ');
|
||||
});
|
||||
|
||||
markersEnter
|
||||
.append('ellipse')
|
||||
@@ -133,7 +138,7 @@ export function svgKeepRight(projection, context, dispatch) {
|
||||
|
||||
markersEnter
|
||||
.append('use')
|
||||
.attr('class', 'kr_error-fill')
|
||||
.attr('class', 'qa_error-fill')
|
||||
.attr('width', '20px')
|
||||
.attr('height', '20px')
|
||||
.attr('x', '-8px')
|
||||
@@ -152,7 +157,7 @@ export function svgKeepRight(projection, context, dispatch) {
|
||||
if (touchLayer.empty()) return;
|
||||
var fillClass = context.getDebug('target') ? 'pink ' : 'nocolor ';
|
||||
|
||||
var targets = touchLayer.selectAll('.kr_error')
|
||||
var targets = touchLayer.selectAll('.qa_error.kr')
|
||||
.data(data, function(d) { return d.id; });
|
||||
|
||||
// exit
|
||||
@@ -169,7 +174,7 @@ export function svgKeepRight(projection, context, dispatch) {
|
||||
.merge(targets)
|
||||
.sort(sortY)
|
||||
.attr('class', function(d) {
|
||||
return 'kr_error target kr_error-' + d.id + ' ' + fillClass;
|
||||
return 'qa_error ' + d.source + ' target error_id-' + d.id + ' ' + fillClass;
|
||||
})
|
||||
.attr('transform', getTransform);
|
||||
|
||||
|
||||
@@ -44,9 +44,9 @@ export function uiImproveOsmHeader() {
|
||||
iconEnter
|
||||
.append('div')
|
||||
.attr('class', function(d) {
|
||||
return 'preset-icon-28 iOSM_error iOSM_error-' + d.id + ' iOSM_error_type_' + d.error_type + d.error_subtype;
|
||||
return 'preset-icon-28 qa_error ' + d.source + ' error_id-' + d.id + ' error_type-' + d.error_type + '-' + d.error_subtype;
|
||||
})
|
||||
.call(svgIcon('#iD-icon-bolt', 'iOSM_error-fill'));
|
||||
.call(svgIcon('#iD-icon-bolt', 'qa_error-fill'));
|
||||
|
||||
headerEnter
|
||||
.append('div')
|
||||
|
||||
@@ -49,9 +49,9 @@ export function uiKeepRightHeader() {
|
||||
iconEnter
|
||||
.append('div')
|
||||
.attr('class', function(d) {
|
||||
return 'preset-icon-28 kr_error kr_error-' + d.id + ' kr_error_type_' + d.parent_error_type;
|
||||
return 'preset-icon-28 qa_error ' + d.source + ' error_id-' + d.id + ' error_type-' + d.parent_error_type;
|
||||
})
|
||||
.call(svgIcon('#iD-icon-bolt', 'kr_error-fill'));
|
||||
.call(svgIcon('#iD-icon-bolt', 'qa_error-fill'));
|
||||
|
||||
headerEnter
|
||||
.append('div')
|
||||
|
||||
Reference in New Issue
Block a user