mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
Allow adding vertex-only features from the serach-to-add field
Allow favoriting vertex presets Don't allow adding vertex-only presets as points Rename Other preset to Vertex
This commit is contained in:
@@ -23,6 +23,8 @@ en:
|
||||
title: Point
|
||||
description: "Add restaurants, monuments, postal boxes or other points to the map."
|
||||
tail: Click on the map to add a point.
|
||||
add_vertex:
|
||||
title: Vertex
|
||||
add_note:
|
||||
title: Note
|
||||
description: "Spotted an issue? Let other mappers know."
|
||||
@@ -35,6 +37,8 @@ en:
|
||||
title: "Add {feature} as a line"
|
||||
area:
|
||||
title: "Add {feature} as an area"
|
||||
vertex:
|
||||
title: "Add {feature} as a vertex"
|
||||
browse:
|
||||
title: Browse
|
||||
description: Pan and zoom the map.
|
||||
|
||||
+3
-2
@@ -6944,8 +6944,9 @@ en:
|
||||
name: Waterway
|
||||
terms: '<translate with synonyms or related terms for ''Waterway'', separated by commas>'
|
||||
vertex:
|
||||
name: Other
|
||||
terms: '<translate with synonyms or related terms for ''Other'', separated by commas>'
|
||||
name: Vertex
|
||||
# 'terms: other'
|
||||
terms: '<translate with synonyms or related terms for ''Vertex'', separated by commas>'
|
||||
waterway:
|
||||
# waterway=*
|
||||
name: Waterway
|
||||
|
||||
@@ -1060,7 +1060,7 @@
|
||||
"type/route/tram": {"icon": "iD-route-tram", "fields": ["name", "ref_route", "operator", "network", "to", "from"], "geometry": ["relation"], "tags": {"type": "route", "route": "tram"}, "name": "Tram Route"},
|
||||
"type/site": {"icon": "iD-relation", "fields": ["name", "site"], "geometry": ["relation"], "tags": {"type": "site"}, "name": "Site"},
|
||||
"type/waterway": {"icon": "iD-route-water", "fields": ["name", "waterway", "ref"], "geometry": ["relation"], "tags": {"type": "waterway"}, "name": "Waterway"},
|
||||
"vertex": {"moreFields": ["name"], "geometry": ["vertex"], "tags": {}, "name": "Other", "matchScore": 0.1},
|
||||
"vertex": {"moreFields": ["name"], "geometry": ["vertex"], "terms": ["other"], "tags": {}, "name": "Vertex", "matchScore": 0.1},
|
||||
"waterway/riverbank": {"icon": "maki-water", "geometry": ["area"], "tags": {"waterway": "riverbank"}, "name": "Riverbank", "searchable": false},
|
||||
"waterway/boatyard": {"icon": "maki-harbor", "fields": ["name", "operator"], "moreFields": ["address", "website", "phone", "email", "fax", "wheelchair"], "geometry": ["area", "vertex", "point"], "tags": {"waterway": "boatyard"}, "name": "Boatyard"},
|
||||
"waterway/canal": {"icon": "iD-waterway-canal", "fields": ["name", "width", "intermittent"], "moreFields": ["salt"], "geometry": ["line"], "tags": {"waterway": "canal"}, "name": "Canal"},
|
||||
|
||||
@@ -5,7 +5,10 @@
|
||||
"geometry": [
|
||||
"vertex"
|
||||
],
|
||||
"terms": [
|
||||
"other"
|
||||
],
|
||||
"tags": {},
|
||||
"name": "Other",
|
||||
"name": "Vertex",
|
||||
"matchScore": 0.1
|
||||
}
|
||||
|
||||
Vendored
+8
-2
@@ -29,6 +29,9 @@
|
||||
"description": "Add restaurants, monuments, postal boxes or other points to the map.",
|
||||
"tail": "Click on the map to add a point."
|
||||
},
|
||||
"add_vertex": {
|
||||
"title": "Vertex"
|
||||
},
|
||||
"add_note": {
|
||||
"title": "Note",
|
||||
"description": "Spotted an issue? Let other mappers know.",
|
||||
@@ -44,6 +47,9 @@
|
||||
},
|
||||
"area": {
|
||||
"title": "Add {feature} as an area"
|
||||
},
|
||||
"vertex": {
|
||||
"title": "Add {feature} as a vertex"
|
||||
}
|
||||
},
|
||||
"browse": {
|
||||
@@ -8127,8 +8133,8 @@
|
||||
"terms": ""
|
||||
},
|
||||
"vertex": {
|
||||
"name": "Other",
|
||||
"terms": ""
|
||||
"name": "Vertex",
|
||||
"terms": "other"
|
||||
},
|
||||
"waterway/riverbank": {
|
||||
"name": "Riverbank",
|
||||
|
||||
@@ -129,13 +129,11 @@ export function behaviorDraw(context) {
|
||||
|
||||
var mode = context.mode();
|
||||
|
||||
var allowsSnappingToWay = (mode.id !== 'add-point' || mode.preset.matchGeometry('vertex'));
|
||||
|
||||
if (target && target.type === 'node' && allowsVertex(target)) { // Snap to a node
|
||||
dispatch.call('clickNode', this, target, d);
|
||||
return;
|
||||
|
||||
} else if (target && target.type === 'way' && allowsSnappingToWay) { // Snap to a way
|
||||
} else if (target && target.type === 'way' && (mode.id !== 'add-point' || mode.preset.matchGeometry('vertex'))) { // Snap to a way
|
||||
var choice = geoChooseEdge(
|
||||
context.childNodes(target), context.mouse(), context.projection, context.activeID()
|
||||
);
|
||||
@@ -144,8 +142,10 @@ export function behaviorDraw(context) {
|
||||
dispatch.call('clickWay', this, choice.loc, edge, d);
|
||||
return;
|
||||
}
|
||||
} else if (mode.id !== 'add-point' || mode.preset.matchGeometry('point')) {
|
||||
dispatch.call('click', this, context.map().mouseCoordinates(), d);
|
||||
}
|
||||
dispatch.call('click', this, context.map().mouseCoordinates(), d);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ export function uiModes(context) {
|
||||
}
|
||||
var presetName = t('presets.presets.' + preset.id + '.name');
|
||||
var relevantMatchingGeometry = preset.geometry.filter(function(geometry) {
|
||||
return ['point', 'line', 'area'].indexOf(geometry) !== -1;
|
||||
return ['vertex', 'point', 'line', 'area'].indexOf(geometry) !== -1;
|
||||
});
|
||||
var tooltipTitleID = 'modes.add_preset.title';
|
||||
if (relevantMatchingGeometry.length !== 1) {
|
||||
|
||||
@@ -15,7 +15,7 @@ export function uiPresetFavorite(preset, geom, context, klass) {
|
||||
|
||||
presetFavorite.button = function(selection) {
|
||||
|
||||
var canFavorite = geom !== 'vertex' && geom !== 'relation';
|
||||
var canFavorite = geom !== 'relation';
|
||||
|
||||
_button = selection.selectAll('.preset-favorite-button')
|
||||
.data(canFavorite ? [0] : []);
|
||||
|
||||
+19
-17
@@ -25,7 +25,7 @@ export function uiSearchAdd(context) {
|
||||
var presets;
|
||||
var search = d3_select(null), popover = d3_select(null), list = d3_select(null);
|
||||
|
||||
var shownGeometry = ['point', 'line', 'area'];
|
||||
var shownGeometry = ['vertex', 'point', 'line', 'area'];
|
||||
|
||||
function searchAdd(selection) {
|
||||
|
||||
@@ -192,20 +192,28 @@ export function uiSearchAdd(context) {
|
||||
}
|
||||
}
|
||||
|
||||
function itemForPreset(preset) {
|
||||
var supportedGeometry = preset.geometry.filter(function(geometry) {
|
||||
return shownGeometry.indexOf(geometry) !== -1;
|
||||
}).sort();
|
||||
var vertexIndex = supportedGeometry.indexOf('vertex');
|
||||
if (vertexIndex !== -1 && supportedGeometry.indexOf('point') !== -1) {
|
||||
// both point and vertex allowed, just show point
|
||||
supportedGeometry.splice(vertexIndex, 1);
|
||||
}
|
||||
if (supportedGeometry.length === 1) {
|
||||
return AddablePresetItem(preset, supportedGeometry[0]);
|
||||
}
|
||||
return MultiGeometryPresetItem(preset, supportedGeometry);
|
||||
}
|
||||
|
||||
function drawList(list, presets) {
|
||||
|
||||
var collection = presets.collection.map(function(preset) {
|
||||
if (preset.members) {
|
||||
return CategoryItem(preset);
|
||||
} else if (preset.visible()) {
|
||||
var supportedGeometry = preset.geometry.filter(function(geometry) {
|
||||
return shownGeometry.indexOf(geometry) !== -1;
|
||||
}).sort();
|
||||
if (supportedGeometry.length === 1) {
|
||||
return AddablePresetItem(preset, supportedGeometry[0]);
|
||||
}
|
||||
return MultiGeometryPresetItem(preset, supportedGeometry);
|
||||
}
|
||||
return itemForPreset(preset);
|
||||
});
|
||||
|
||||
var items = list.selectAll('.list-item')
|
||||
@@ -279,7 +287,7 @@ export function uiSearchAdd(context) {
|
||||
|
||||
row.each(function(d) {
|
||||
if (d.geometry) {
|
||||
var presetFavorite = uiPresetFavorite(d.preset,d.geometry, context, 'accessory');
|
||||
var presetFavorite = uiPresetFavorite(d.preset, d.geometry, context, 'accessory');
|
||||
d3_select(this).call(presetFavorite.button);
|
||||
}
|
||||
});
|
||||
@@ -354,13 +362,7 @@ export function uiSearchAdd(context) {
|
||||
};
|
||||
item.subitems = function() {
|
||||
return preset.members.matchAnyGeometry(shownGeometry).collection.map(function(preset) {
|
||||
var supportedGeometry = preset.geometry.filter(function(geometry) {
|
||||
return shownGeometry.indexOf(geometry) !== -1;
|
||||
}).sort();
|
||||
if (supportedGeometry.length === 1) {
|
||||
return AddablePresetItem(preset, supportedGeometry[0]);
|
||||
}
|
||||
return MultiGeometryPresetItem(preset, supportedGeometry);
|
||||
return itemForPreset(preset);
|
||||
});
|
||||
};
|
||||
return item;
|
||||
|
||||
Reference in New Issue
Block a user