diff --git a/modules/behavior/draw_way.js b/modules/behavior/draw_way.js index c93b5f1a1..aed7a8042 100644 --- a/modules/behavior/draw_way.js +++ b/modules/behavior/draw_way.js @@ -329,6 +329,9 @@ export function behaviorDrawWay(context, wayID, index, mode, startGraph, baselin }, 1000); var isNewFeature = !mode.isContinuing; context.enter(modeSelect(context, [wayID]).newFeature(isNewFeature)); + if (isNewFeature) { + context.validator().validate(); + } }; diff --git a/modules/modes/draw_area.js b/modules/modes/draw_area.js index 00ef60d50..c365be4a8 100644 --- a/modules/modes/draw_area.js +++ b/modules/modes/draw_area.js @@ -2,7 +2,7 @@ import { t } from '../util/locale'; import { behaviorDrawWay } from '../behavior'; -export function modeDrawArea(context, wayId, startGraph, baselineGraph) { +export function modeDrawArea(context, wayID, startGraph, baselineGraph) { var mode = { button: 'area', id: 'draw-area' @@ -10,11 +10,12 @@ export function modeDrawArea(context, wayId, startGraph, baselineGraph) { var behavior; + mode.wayID = wayID; mode.enter = function() { - var way = context.entity(wayId); + var way = context.entity(wayID); - behavior = behaviorDrawWay(context, wayId, undefined, mode, startGraph, baselineGraph) + behavior = behaviorDrawWay(context, wayID, undefined, mode, startGraph, baselineGraph) .tail(t('modes.draw_area.tail')); var addNode = behavior.addNode; @@ -40,7 +41,7 @@ export function modeDrawArea(context, wayId, startGraph, baselineGraph) { mode.selectedIDs = function() { - return [wayId]; + return [wayID]; }; diff --git a/modules/modes/draw_line.js b/modules/modes/draw_line.js index ba6748e3e..f37910500 100644 --- a/modules/modes/draw_line.js +++ b/modules/modes/draw_line.js @@ -10,6 +10,8 @@ export function modeDrawLine(context, wayID, startGraph, baselineGraph, affix, c var behavior; + mode.wayID = wayID; + mode.isContinuing = continuing; mode.enter = function() { diff --git a/modules/validations/missing_tag.js b/modules/validations/missing_tag.js index e54f20e42..a3464a9e9 100644 --- a/modules/validations/missing_tag.js +++ b/modules/validations/missing_tag.js @@ -29,6 +29,14 @@ export function validationMissingTag() { return []; } + var mode = context.mode(); + if (entity.type === 'way' && mode && + (mode.id === 'draw-area' || (mode.id === 'draw-line' && !mode.isContinuing)) && + mode.wayID === entity.id) { + // don't flag missing tag issues if drawing a new way + return []; + } + var messageObj = {}; var missingTagType;