Remove context.childNodes function

This commit is contained in:
Quincy Morgan
2020-03-21 13:56:11 -07:00
parent 5fd25601fe
commit fac613e1dc
6 changed files with 5 additions and 6 deletions

View File

@@ -133,7 +133,7 @@ export function behaviorDraw(context) {
} else if (target && target.type === 'way' && (mode.id !== 'add-point' || mode.preset.matchGeometry('vertex'))) { // Snap to a way
var choice = geoChooseEdge(
context.childNodes(target), loc, context.projection, context.activeID()
context.graph().childNodes(target), loc, context.projection, context.activeID()
);
if (choice) {
var edge = [target.nodes[choice.index - 1], target.nodes[choice.index]];

View File

@@ -247,7 +247,6 @@ export function coreContext() {
/* Graph */
context.hasEntity = (id) => _history.graph().hasEntity(id);
context.entity = (id) => _history.graph().entity(id);
context.childNodes = (way) => _history.graph().childNodes(way);
context.geometry = (id) => context.entity(id).geometry(_history.graph());

View File

@@ -379,7 +379,7 @@ export function modeDragNode(context) {
);
} else if (target && target.type === 'way') {
var choice = geoChooseEdge(context.childNodes(target), context.mouse(), context.projection, entity.id);
var choice = geoChooseEdge(context.graph().childNodes(target), context.mouse(), context.projection, entity.id);
context.replace(
actionAddMidpoint({
loc: choice.loc,

View File

@@ -354,7 +354,7 @@ export function modeSelect(context, selectedIDs) {
if (!entity) return;
if (entity instanceof osmWay && target.classed('target')) {
var choice = geoChooseEdge(context.childNodes(entity), loc, context.projection);
var choice = geoChooseEdge(context.graph().childNodes(entity), loc, context.projection);
var prev = entity.nodes[choice.index - 1];
var next = entity.nodes[choice.index];

View File

@@ -343,7 +343,7 @@ export function uiFeatureList(context) {
context.map().center(d.entity.loc);
} else if (d.entity.type === 'way') {
var center = context.projection(context.map().center());
var edge = geoChooseEdge(context.childNodes(d.entity), center, context.projection);
var edge = geoChooseEdge(context.graph().childNodes(d.entity), center, context.projection);
context.map().center(edge.loc);
}
context.enter(modeSelect(context, [d.entity.id]));

View File

@@ -41,7 +41,7 @@ export function uiFieldAddress(field, context) {
(extent[0][0] + extent[1][0]) / 2,
(extent[0][1] + extent[1][1]) / 2
]);
var choice = geoChooseEdge(context.childNodes(d), loc, context.projection);
var choice = geoChooseEdge(context.graph().childNodes(d), loc, context.projection);
return {
title: d.tags.name,