mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
Make sure all targets are redrawn during a mode change
There was an issue where the lines did not redraw their targets right away when entering drag node, which could make it possible for a quick drag node to try to connect to its parent line. With the chooseEdge exclusion it would not connect to the parent nearby, but in another weird part of the line.
This commit is contained in:
@@ -201,17 +201,35 @@ export function rendererMap(context) {
|
||||
|
||||
context.on('enter.map', function() {
|
||||
if (map.editable() && !transformed) {
|
||||
// redraw immediately the objects that are affected by a chnage in selectedIDs.
|
||||
var all = context.intersects(map.extent());
|
||||
var filter = utilFunctor(true);
|
||||
var graph = context.graph();
|
||||
|
||||
all = context.features().filter(all, graph);
|
||||
// redraw immediately any objects affected by a change in selectedIDs.
|
||||
var graph = context.graph();
|
||||
var selectedAndParents = {};
|
||||
context.selectedIDs().forEach(function(id) {
|
||||
var entity = graph.hasEntity(id);
|
||||
if (entity) {
|
||||
selectedAndParents[entity.id] = entity;
|
||||
if (entity.type === 'node') {
|
||||
graph.parentWays(entity).forEach(function(parent) {
|
||||
selectedAndParents[parent.id] = parent;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
var data = _values(selectedAndParents);
|
||||
var filter = function(d) { return d.id in selectedAndParents; };
|
||||
|
||||
data = context.features().filter(data, graph);
|
||||
|
||||
surface.selectAll('.data-layer-osm')
|
||||
.call(drawVertices.drawSelected, graph, map.extent())
|
||||
.call(drawMidpoints, graph, all, filter, map.trimmedExtent());
|
||||
.call(drawLines, graph, data, filter)
|
||||
.call(drawAreas, graph, data, filter)
|
||||
.call(drawMidpoints, graph, data, filter, map.trimmedExtent());
|
||||
|
||||
dispatch.call('drawn', this, { full: false });
|
||||
|
||||
|
||||
// redraw everything else later
|
||||
scheduleRedraw();
|
||||
}
|
||||
|
||||
@@ -345,7 +345,7 @@ export function svgVertices(projection, context) {
|
||||
|
||||
// Draw the vertices..
|
||||
// The filter function controls the scope of what objects d3 will touch (exit/enter/update)
|
||||
// It's important to adjust the filter function to expand the scope beyond whatever entities were passed in.
|
||||
// Adjust the filter function to expand the scope beyond whatever entities were passed in.
|
||||
var filterRendered = function(d) {
|
||||
return d.id in _currPersistent || d.id in _currSelected || d.id in _currHover || filter(d);
|
||||
};
|
||||
@@ -353,8 +353,12 @@ export function svgVertices(projection, context) {
|
||||
.call(draw, graph, currentVisible(all), sets, filterRendered);
|
||||
|
||||
// Draw touch targets..
|
||||
// When drawing, render all targets (not just those affected by a partial redraw)
|
||||
var filterTouch = function(d) {
|
||||
return isMoving ? true : filterRendered(d);
|
||||
};
|
||||
selection.selectAll('.layer-points .layer-points-targets')
|
||||
.call(drawTargets, graph, currentVisible(all), filterRendered);
|
||||
.call(drawTargets, graph, currentVisible(all), filterTouch);
|
||||
|
||||
|
||||
function currentVisible(which) {
|
||||
|
||||
Reference in New Issue
Block a user