mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-20 23:44:47 +02:00
Fix double clicking on a way to create a vertex
This commit is contained in:
@@ -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
@@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user