mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-22 16:19:48 +02:00
Fix rendering when dragging intersection vertex
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
iD.ui.preset.restrictions = function(field, context) {
|
||||
var event = d3.dispatch('change'),
|
||||
vertex,
|
||||
vertexID,
|
||||
selectedID;
|
||||
|
||||
function restrictions(selection) {
|
||||
@@ -14,11 +14,22 @@ iD.ui.preset.restrictions = function(field, context) {
|
||||
.call(iD.svg.Surface(context))
|
||||
.call(iD.behavior.Hover(context));
|
||||
|
||||
var intersection = iD.geo.Intersection(context.graph(), vertexID),
|
||||
graph = intersection.graph,
|
||||
vertex = graph.entity(vertexID),
|
||||
surface = wrap.selectAll('svg'),
|
||||
filter = function () { return true; },
|
||||
extent = iD.geo.Extent(),
|
||||
projection = iD.geo.RawMercator(),
|
||||
lines = iD.svg.Lines(projection, context),
|
||||
vertices = iD.svg.Vertices(projection, context),
|
||||
turns = iD.svg.Turns(projection, context);
|
||||
|
||||
var d = wrap.dimensions(),
|
||||
c = [d[0] / 2, d[1] / 2],
|
||||
z = 21;
|
||||
|
||||
var projection = iD.geo.RawMercator()
|
||||
projection
|
||||
.scale(256 * Math.pow(2, z) / (2 * Math.PI));
|
||||
|
||||
var s = projection(vertex.loc);
|
||||
@@ -27,15 +38,6 @@ iD.ui.preset.restrictions = function(field, context) {
|
||||
.translate([c[0] - s[0], c[1] - s[1]])
|
||||
.clipExtent([[0, 0], d]);
|
||||
|
||||
var surface = wrap.selectAll('svg'),
|
||||
filter = function () { return true; },
|
||||
extent = iD.geo.Extent(),
|
||||
intersection = iD.geo.Intersection(context.graph(), vertex.id),
|
||||
graph = intersection.graph,
|
||||
lines = iD.svg.Lines(projection, context),
|
||||
vertices = iD.svg.Vertices(projection, context),
|
||||
turns = iD.svg.Turns(projection, context);
|
||||
|
||||
surface
|
||||
.call(vertices, graph, [vertex], filter, extent, z)
|
||||
.call(lines, graph, intersection.highways, filter)
|
||||
@@ -81,9 +83,9 @@ iD.ui.preset.restrictions = function(field, context) {
|
||||
}
|
||||
|
||||
restrictions.entity = function(_) {
|
||||
if (!vertex || vertex.id !== _.id) {
|
||||
if (!vertexID || vertexID !== _.id) {
|
||||
selectedID = null;
|
||||
vertex = _;
|
||||
vertexID = _.id;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user