Fix an issue where added nodes would highlight momentarily while drawing an area

This commit is contained in:
Quincy Morgan
2019-02-26 09:34:45 -05:00
parent a4e0bcb29c
commit 5262358d81
2 changed files with 8 additions and 7 deletions

View File

@@ -21,7 +21,8 @@ export function behaviorDrawWay(context, wayID, index, mode, startGraph, baselin
);
var behavior = behaviorDraw(context);
behavior.hover().initialNodeId(index ? origWay.nodes[index] : origWay.nodes[origWay.nodes.length - 1]);
behavior.hover().initialNodeID(index ? origWay.nodes[index] :
(origWay.isClosed() ? origWay.nodes[origWay.nodes.length - 2] : origWay.nodes[origWay.nodes.length - 1]));
var _tempEdits = 0;

View File

@@ -21,7 +21,7 @@ export function behaviorHover(context) {
var dispatch = d3_dispatch('hover');
var _selection = d3_select(null);
var _newNodeId = null;
var _initialNodeId = null;
var _initialNodeID = null;
var _buttonDown;
var _altDisables;
var _ignoreVertex;
@@ -59,9 +59,9 @@ export function behaviorHover(context) {
function behavior(selection) {
_selection = selection;
if (_initialNodeId) {
_newNodeId = _initialNodeId;
_initialNodeId = null;
if (_initialNodeID) {
_newNodeId = _initialNodeID;
_initialNodeID = null;
} else {
_newNodeId = null;
}
@@ -198,8 +198,8 @@ export function behaviorHover(context) {
return behavior;
};
behavior.initialNodeId = function(nodeId) {
_initialNodeId = nodeId;
behavior.initialNodeID = function(nodeId) {
_initialNodeID = nodeId;
return behavior;
};