Fix extent in turn restrictions viewer, so vertices will render

This commit is contained in:
Bryan Housel
2017-12-18 00:34:54 -05:00
parent b5eaa76d1a
commit bcd511573f

View File

@@ -46,12 +46,12 @@ import {
export function uiFieldRestrictions(field, context) {
var dispatch = d3_dispatch('change'),
breathe = behaviorBreathe(context),
hover = behaviorHover(context),
initialized = false,
vertexID,
fromNodeID;
var dispatch = d3_dispatch('change');
var breathe = behaviorBreathe(context);
var hover = behaviorHover(context);
var initialized = false;
var vertexID;
var fromNodeID;
function restrictions(selection) {
@@ -73,16 +73,15 @@ export function uiFieldRestrictions(field, context) {
.attr('class', 'restriction-help');
var intersection = osmIntersection(context.graph(), vertexID),
graph = intersection.graph,
vertex = graph.entity(vertexID),
filter = utilFunctor(true),
extent = geoExtent(),
projection = geoRawMercator();
var intersection = osmIntersection(context.graph(), vertexID);
var graph = intersection.graph;
var vertex = graph.entity(vertexID);
var filter = utilFunctor(true);
var projection = geoRawMercator();
var d = utilGetDimensions(wrap.merge(enter)),
c = [d[0] / 2, d[1] / 2],
z = 24;
var d = utilGetDimensions(wrap.merge(enter));
var c = [d[0] / 2, d[1] / 2];
var z = 24;
projection
.scale(256 * Math.pow(2, z) / (2 * Math.PI));
@@ -93,10 +92,12 @@ export function uiFieldRestrictions(field, context) {
.translate([c[0] - s[0], c[1] - s[1]])
.clipExtent([[0, 0], d]);
var drawLayers = svgLayers(projection, context).only('osm').dimensions(d),
drawVertices = svgVertices(projection, context),
drawLines = svgLines(projection, context),
drawTurns = svgTurns(projection, context);
var extent = geoExtent(projection.invert([0, d[1]]), projection.invert([d[0], 0]));
var drawLayers = svgLayers(projection, context).only('osm').dimensions(d);
var drawVertices = svgVertices(projection, context);
var drawLines = svgLines(projection, context);
var drawTurns = svgTurns(projection, context);
enter
.call(drawLayers);
@@ -115,7 +116,7 @@ export function uiFieldRestrictions(field, context) {
surface
.call(utilSetDimensions, d)
.call(drawVertices, graph, [vertex], filter, extent)
.call(drawVertices, graph, [vertex], filter, extent, true)
.call(drawLines, graph, intersection.ways, filter)
.call(drawTurns, graph, intersection.turns(fromNodeID));
@@ -174,9 +175,9 @@ export function uiFieldRestrictions(field, context) {
function mouseover() {
var datum = d3_event.target.__data__;
if (datum instanceof osmTurn) {
var graph = context.graph(),
presets = context.presets(),
preset;
var graph = context.graph();
var presets = context.presets();
var preset;
if (datum.restriction) {
preset = presets.match(graph.entity(datum.restriction), graph);