return d3.rebind(context, dispatch, 'on');
};
-iD.version = '1.3.8';
+iD.version = '1.3.9';
(function() {
var detected = {};
var action = function(graph) {
var node = graph.entity(nodeId),
- replacements = action.replacements(graph);
+ connections = action.connections(graph);
+
+ connections.forEach(function(connection) {
+ var way = graph.entity(connection.wayID),
+ newNode = iD.Node({id: newNodeId, loc: node.loc, tags: node.tags});
- replacements.forEach(function(replacement) {
- var newNode = iD.Node({id: newNodeId, loc: node.loc, tags: node.tags});
graph = graph.replace(newNode);
- graph = graph.replace(graph.entity(replacement.wayID).updateNode(newNode.id, replacement.index));
+ if (connection.index === 0 && way.isArea()) {
+ // replace shared node with shared node..
+ graph = graph.replace(way.replaceNode(way.nodes[0], newNode.id));
+ } else {
+ // replace shared node with multiple new nodes..
+ graph = graph.replace(way.updateNode(newNode.id, connection.index));
+ }
});
return graph;
};
- action.replacements = function(graph) {
+ action.connections = function(graph) {
var candidates = [],
keeping = false,
- parents = graph.parentWays(graph.entity(nodeId));
+ parentWays = graph.parentWays(graph.entity(nodeId));
- parents.forEach(function(parent) {
- if (wayIds && wayIds.indexOf(parent.id) === -1) {
+ parentWays.forEach(function(way) {
+ if (wayIds && wayIds.indexOf(way.id) === -1) {
keeping = true;
return;
}
-
- parent.nodes.forEach(function(waynode, index) {
- if (waynode === nodeId) {
- candidates.push({wayID: parent.id, index: index});
- }
- });
+ if (way.isArea() && (way.nodes[0] === nodeId)) {
+ candidates.push({wayID: way.id, index: 0});
+ } else {
+ way.nodes.forEach(function(waynode, index) {
+ if (waynode === nodeId) {
+ candidates.push({wayID: way.id, index: index});
+ }
+ });
+ }
});
return keeping ? candidates : candidates.slice(1);
};
action.disabled = function(graph) {
- var replacements = action.replacements(graph);
- if (replacements.length === 0 || (wayIds && wayIds.length !== replacements.length))
+ var connections = action.connections(graph);
+ if (connections.length === 0 || (wayIds && wayIds.length !== connections.length))
return 'not_connected';
};
['right', [-1, 0]],
['bottom', [0, 1]]],
opacityDefault = (context.storage('background-opacity') !== null) ?
- (+context.storage('background-opacity')) : 0.5;
+ (+context.storage('background-opacity')) : 0.5,
+ customTemplate;
// Can be 0 from <1.3.0 use or due to issue #1923.
if (opacityDefault === 0) opacityDefault = 0.5;
selectLayer();
}
- function clickCustom() {
+ function editCustom() {
d3.event.preventDefault();
- var template = window.prompt(t('background.custom_prompt'));
- if (!template || template.indexOf('google.com') !== -1 ||
- template.indexOf('googleapis.com') !== -1 ||
- template.indexOf('google.ru') !== -1) {
+ var template = window.prompt(t('background.custom_prompt'), customTemplate);
+ if (!template ||
+ template.indexOf('google.com') !== -1 ||
+ template.indexOf('googleapis.com') !== -1 ||
+ template.indexOf('google.ru') !== -1) {
selectLayer();
return;
}
+ setCustom(template);
+ }
+
+ function setCustom(template) {
context.background().baseLayerSource(iD.BackgroundSource.Custom(template));
selectLayer();
}
.property('checked', showsGpx);
selectLayer();
+
+ var source = context.background().baseLayerSource();
+ if (source.id === 'custom') {
+ customTemplate = source.template;
+ }
}
function clickNudge(d) {
.attr('class', 'custom_layer')
.datum(iD.BackgroundSource.Custom());
+ custom.append('button')
+ .attr('class', 'layer-browse')
+ .call(bootstrap.tooltip()
+ .title(t('background.custom_button'))
+ .placement('left'))
+ .on('click', editCustom)
+ .append('span')
+ .attr('class', 'icon geocode');
+
var label = custom.append('label');
label.append('input')
.attr('type', 'radio')
.attr('name', 'layers')
- .on('change', clickCustom);
+ .on('change', function () {
+ if (customTemplate) {
+ setCustom(customTemplate);
+ } else {
+ editCustom();
+ }
+ });
label.append('span')
.text(t('background.custom'));
"overlay": true
},
{
- "name": "MapBox Satellite",
+ "name": "MapQuest Open Aerial",
+ "type": "tms",
+ "template": "http://oatile{switch:1,2,3,4}.mqcdn.com/tiles/1.0.0/sat/{zoom}/{x}/{y}.png",
+ "default": true
+ },
+ {
+ "name": "Mapbox Satellite",
"type": "tms",
"description": "Satellite and aerial imagery.",
"template": "http://{switch:a,b,c}.tiles.mapbox.com/v3/openstreetmap.map-4wvf9l0l/{zoom}/{x}/{y}.png",
"scaleExtent": [
0,
- 16
+ 19
],
"terms_url": "http://www.mapbox.com/about/maps/",
"terms_text": "Terms & Feedback",
- "default": true
- },
- {
- "name": "MapQuest Open Aerial",
- "type": "tms",
- "template": "http://oatile{switch:1,2,3,4}.mqcdn.com/tiles/1.0.0/sat/{zoom}/{x}/{y}.png",
+ "id": "Mapbox",
"default": true
},
{
"opening_hours"
]
},
- "craft/photographic_labratory": {
- "name": "Photographic Labratory",
+ "craft/photographic_laboratory": {
+ "name": "Photographic Laboratory",
"geometry": [
"point",
"area"
],
"terms": [
- "photographic labratory",
+ "photographic laboratory",
"film developer"
],
"tags": {
- "craft": "photographic_labratory"
+ "craft": "photographic_laboratory"
},
"icon": "camera",
"fields": [
],
"name": "Neighborhood"
},
+ "place/suburb": {
+ "icon": "triangle-stroked",
+ "geometry": [
+ "point",
+ "area"
+ ],
+ "tags": {
+ "place": "suburb"
+ },
+ "terms": [
+ "Boro",
+ "Quarter"
+ ],
+ "name": "Borough"
+ },
"place/town": {
"icon": "town",
"geometry": [
"tags": {
"shop": "fishmonger"
},
- "name": "Fishmonger"
+ "name": "Fishmonger",
+ "searchable": false
},
"shop/florist": {
"icon": "shop",
},
"name": "Photography Store"
},
+ "shop/seafood": {
+ "icon": "shop",
+ "fields": [
+ "address",
+ "building_area",
+ "opening_hours"
+ ],
+ "geometry": [
+ "point",
+ "vertex",
+ "area"
+ ],
+ "tags": {
+ "shop": "seafood"
+ },
+ "terms": [
+ "fishmonger"
+ ],
+ "name": "Seafood Shop"
+ },
"shop/shoes": {
"icon": "shop",
"fields": [
"waterway/stream": {
"icon": "waterway-stream",
"fields": [
- "layer",
"tunnel"
],
"geometry": [
"nl",
"en-GB",
"et",
+ "fil",
"fi",
"fr",
"gl",
"percent_brightness": "{opacity}% brightness",
"none": "None",
"custom": "Custom",
- "custom_prompt": "Enter a tile template. Valid tokens are {z}, {x}, {y} for Z/X/Y scheme and {u} for quadtile scheme.",
+ "custom_button": "Edit custom background",
+ "custom_prompt": "Enter a tile URL template. Valid tokens are {z}, {x}, {y} for Z/X/Y scheme and {u} for quadtile scheme.",
"fix_misalignment": "Fix alignment",
"reset": "reset"
},
"name": "Photographer",
"terms": "photographer"
},
- "craft/photographic_labratory": {
- "name": "Photographic Labratory",
- "terms": "photographic labratory,film developer"
+ "craft/photographic_laboratory": {
+ "name": "Photographic Laboratory",
+ "terms": "photographic laboratory,film developer"
},
"craft/plasterer": {
"name": "Plasterer",
"name": "Neighborhood",
"terms": "neighbourhood"
},
+ "place/suburb": {
+ "name": "Borough",
+ "terms": "Boro,Quarter"
+ },
"place/town": {
"name": "Town",
"terms": ""
"name": "Photography Store",
"terms": ""
},
+ "shop/seafood": {
+ "name": "Seafood Shop",
+ "terms": "fishmonger"
+ },
"shop/shoes": {
"name": "Shoe Store",
"terms": ""