From fd9b3931d83998d72efbb24c4107811c9786f49c Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Fri, 13 Jan 2017 18:44:42 +0530 Subject: [PATCH] Use temp names for temp segments (closes #1369) --- modules/behavior/draw_way.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/behavior/draw_way.js b/modules/behavior/draw_way.js index 396b4a2a5..4e969058a 100644 --- a/modules/behavior/draw_way.js +++ b/modules/behavior/draw_way.js @@ -42,16 +42,19 @@ export function behaviorDrawWay(context, wayId, index, mode, baseGraph) { 'operations.start.annotation.' : 'operations.continue.annotation.') + context.geometry(wayId)), draw = behaviorDraw(context), - end = osmNode({ loc: context.map().mouseCoordinates() }), - startIndex, start, segment; + startIndex, start, end, segment; + if (!isArea) { startIndex = typeof index === 'undefined' ? way.nodes.length - 1 : 0; - start = osmNode({ loc: context.entity(way.nodes[startIndex]).loc }); - segment = osmWay({ + start = osmNode({ id: 'nStart', loc: context.entity(way.nodes[startIndex]).loc }); + end = osmNode({ id: 'nEnd', loc: context.map().mouseCoordinates() }); + segment = osmWay({ id: 'wTemp', nodes: typeof index === 'undefined' ? [start.id, end.id] : [end.id, start.id], tags: _.clone(way.tags) }); + } else { + end = osmNode({ loc: context.map().mouseCoordinates() }); }