Skip to content

Commit

Permalink
Hide Turn Restriction field on trivial junctions
Browse files Browse the repository at this point in the history
(closes #4934)
  • Loading branch information
bhousel committed Mar 28, 2018
1 parent 4840fea commit a160c00
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion modules/ui/fields/restrictions.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,17 @@ export function uiFieldRestrictions(field, context) {
// It's possible for there to be no actual intersection here.
// for example, a vertex of two `highway=path`
// In this case, hide the field.
var isOK = (_intersection && _intersection.vertices.length && _intersection.ways.length);
var isOK = (
_intersection &&
_intersection.vertices.length && // has vertices
_intersection.vertices // has the vertex that the user selected
.filter(function(vertex) { return vertex.id === _vertexID; }).length &&
_intersection.ways.length > 2 && // has more than 2 ways
_intersection.ways // has more than 1 TO way
.filter(function(way) { return way.__to; }).length > 1
);

// Also hide in the case where
d3_select(selection.node().parentNode).classed('hide', !isOK);

// if form field is hidden or has detached from dom, clean up.
Expand Down

0 comments on commit a160c00

Please sign in to comment.