return d3.rebind(context, dispatch, 'on');
};
-iD.version = '1.5.3';
+iD.version = '1.5.4';
(function() {
var detected = {};
background.zoomToGpxLayer = function() {
if (background.hasGpxLayer()) {
- var gpx = d3.geo.bounds(gpxLayer.geojson());
-
- if (!context.map().extent().intersects(gpx)) {
- context.map().extent(gpx);
+ var viewport = context.map().extent().polygon(),
+ coords = _.reduce(gpxLayer.geojson().features, function(coords, feature) {
+ var c = feature.geometry.coordinates;
+ return _.union(coords, feature.geometry.type === 'Point' ? [c] : c);
+ }, []);
+
+ if (!iD.geo.polygonIntersectsPolygon(viewport, coords)) {
+ context.map().extent(d3.geo.bounds(gpxLayer.geojson()));
}
}
};
var patternKeys = ['landuse', 'natural', 'amenity'];
+ var clipped = ['residential', 'commercial', 'retail', 'industrial'];
+
+ function clip(entity) {
+ return clipped.indexOf(entity.tags.landuse) !== -1;
+ }
+
function setPattern(d) {
for (var i = 0; i < patternKeys.length; i++) {
if (patterns.hasOwnProperty(d.tags[patternKeys[i]])) {
});
var data = {
+ clip: areas.filter(clip),
shadow: strokes,
stroke: strokes,
fill: areas
};
+ var clipPaths = surface.selectAll('defs').selectAll('.clipPath')
+ .filter(filter)
+ .data(data.clip, iD.Entity.key);
+
+ clipPaths.enter()
+ .append('clipPath')
+ .attr('class', 'clipPath')
+ .attr('id', function(entity) { return entity.id + '-clippath'; })
+ .append('path');
+
+ clipPaths.selectAll('path')
+ .attr('d', path);
+
+ clipPaths.exit()
+ .remove();
+
var areagroup = surface
.select('.layer-areas')
.selectAll('g.areagroup')
this.setAttribute('class', entity.type + ' area ' + layer + ' ' + entity.id);
+ if (layer === 'fill' && clip(entity)) {
+ this.setAttribute('clip-path', 'url(#' + entity.id + '-clippath)');
+ }
+
if (layer === 'fill') {
setPattern.apply(this, arguments);
}
.filter(midpointFilter)
.data(_.values(midpoints), function(d) { return d.id; });
- var group = groups.enter()
+ var enter = groups.enter()
.insert('g', ':first-child')
.attr('class', 'midpoint');
- group.append('polygon')
+ enter.append('polygon')
.attr('points', '-6,8 10,0 -6,-8')
.attr('class', 'shadow');
- group.append('polygon')
+ enter.append('polygon')
.attr('points', '-3,4 5,0 -3,-4')
.attr('class', 'fill');
- groups.attr('transform', function(d) {
- var translate = iD.svg.PointTransform(projection),
- a = context.entity(d.edge[0]),
- b = context.entity(d.edge[1]),
- angle = Math.round(iD.geo.angle(a, b, projection) * (180 / Math.PI));
- return translate(d) + ' rotate(' + angle + ')';
- });
+ groups
+ .attr('transform', function(d) {
+ var translate = iD.svg.PointTransform(projection),
+ a = context.entity(d.edge[0]),
+ b = context.entity(d.edge[1]),
+ angle = Math.round(iD.geo.angle(a, b, projection) * (180 / Math.PI));
+ return translate(d) + ' rotate(' + angle + ')';
+ })
+ .call(iD.svg.TagClasses().tags(
+ function(d) { return d.parents[0].tags; }
+ ));
// Propagate data bindings.
groups.select('polygon.shadow');
};
iD.svg.Surface = function() {
return function (selection) {
+ selection.selectAll('defs')
+ .data([0])
+ .enter()
+ .append('defs');
+
var layers = selection.selectAll('.layer')
.data(['areas', 'lines', 'hit', 'halo', 'label']);
"advanced": "Advanced (black diamond)",
"expert": "Expert (double black diamond)",
"freeride": "Freeride (off-piste)",
- "extreme": "Extreme (climing equipment required)"
+ "extreme": "Extreme (climbing equipment required)"
}
}
},
},
"delete": {
"title": "Delete",
- "description": "Remove this from the map.",
+ "description": "Delete object permanently.",
"annotation": {
"point": "Deleted a point.",
"vertex": "Deleted a node from a way.",
"advanced": "Advanced (black diamond)",
"expert": "Expert (double black diamond)",
"freeride": "Freeride (off-piste)",
- "extreme": "Extreme (climing equipment required)"
+ "extreme": "Extreme (climbing equipment required)"
}
},
"piste/grooming": {