Fix double clicking on a way to create a vertex

This commit is contained in:
Bryan Housel
2017-12-18 16:09:07 -05:00
parent 2e2b037e36
commit 7155ef8bc6
2 changed files with 22 additions and 10 deletions
+6 -6
View File
@@ -245,13 +245,13 @@ export function modeSelect(context, selectedIDs) {
function dblclick() {
var target = d3_select(d3_event.target),
datum = target.datum();
var target = d3_select(d3_event.target);
var datum = target.datum();
if (datum instanceof osmWay && !target.classed('fill')) {
var choice = geoChooseEdge(context.childNodes(datum), context.mouse(), context.projection),
prev = datum.nodes[choice.index - 1],
next = datum.nodes[choice.index];
if (datum instanceof osmWay && target.classed('target')) {
var choice = geoChooseEdge(context.childNodes(datum), context.mouse(), context.projection);
var prev = datum.nodes[choice.index - 1];
var next = datum.nodes[choice.index];
context.perform(
actionAddMidpoint({loc: choice.loc, edge: [prev, next]}, osmNode()),
+16 -4
View File
@@ -268,15 +268,27 @@ export function svgVertices(projection, context) {
for (var i = 0; i < entities.length; i++) {
var entity = entities[i];
var geometry = entity.geometry(graph);
var keep = false;
// a point that looks like a vertex..
if ((geometry === 'point') && renderAsVertex(entity, graph, wireframe, zoom)) {
_currPersistent[entity.id] = entity;
keep = true;
} else if ((geometry === 'vertex') &&
(entity.hasInterestingTags() || entity.isEndpoint(graph) || entity.isConnected(graph)) ) {
_currPersistent[entity.id] = entity;
// a vertex of some importance..
} else if (geometry === 'vertex') {
if (entity.hasInterestingTags() || entity.isEndpoint(graph) || entity.isConnected(graph)) {
_currPersistent[entity.id] = entity;
keep = true;
}
// partial redraw in select mode - probably because the user double clicked a way.
if (!fullRedraw && mode.id === 'select') {
_currSelected[entity.id] = entity;
}
}
} else if (!fullRedraw) {
// whatever this is, it's not a persistent vertex..
if (!keep && !fullRedraw) {
delete _currPersistent[entity.id];
}
}