mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-19 17:43:39 +00:00
Having two kinds of Ways (fetched and non-fetched) introduced some accidental complexity. This brings things more in line with how parentWays/parentRelations work. Fixes #73.
30 lines
808 B
JavaScript
30 lines
808 B
JavaScript
iD.svg = {
|
|
RoundProjection: function (projection) {
|
|
return function (d) {
|
|
return iD.geo.roundCoords(projection(d));
|
|
};
|
|
},
|
|
|
|
PointTransform: function (projection) {
|
|
return function (entity) {
|
|
return 'translate(' + projection(entity.loc) + ')';
|
|
};
|
|
},
|
|
|
|
LineString: function (projection, graph) {
|
|
var cache = {};
|
|
return function (entity) {
|
|
if (cache[entity.id] !== undefined) {
|
|
return cache[entity.id];
|
|
}
|
|
|
|
if (entity.nodes.length === 0) {
|
|
return (cache[entity.id] = null);
|
|
}
|
|
|
|
return (cache[entity.id] =
|
|
'M' + graph.childNodes(entity).map(function (n) { return projection(n.loc); }).join('L'));
|
|
}
|
|
}
|
|
};
|