diff --git a/modules/behavior/lasso.js b/modules/behavior/lasso.js index 4dc40720f..337a87f17 100644 --- a/modules/behavior/lasso.js +++ b/modules/behavior/lasso.js @@ -53,7 +53,7 @@ export function behaviorLasso(context) { var bounds = lasso.extent().map(context.projection.invert); var extent = geoExtent(normalize(bounds[0], bounds[1])); - var intersects = context.intersects(extent).filter(function(entity) { + var intersects = context.history().intersects(extent).filter(function(entity) { return entity.type === 'node' && geoPointInPolygon(context.projection(entity.loc), lasso.coordinates) && !context.features().isHidden(entity, graph, entity.geometry(graph)); diff --git a/modules/core/context.js b/modules/core/context.js index 970ac538d..7dc32011a 100644 --- a/modules/core/context.js +++ b/modules/core/context.js @@ -429,7 +429,6 @@ export function coreContext() { _history = coreHistory(context); context.graph = _history.graph; - context.intersects = _history.intersects; context.pauseChangeDispatch = _history.pauseChangeDispatch; context.resumeChangeDispatch = _history.resumeChangeDispatch; context.perform = withDebouncedSave(_history.perform); diff --git a/modules/core/history.js b/modules/core/history.js index 3ea1af48e..9a082491a 100644 --- a/modules/core/history.js +++ b/modules/core/history.js @@ -268,6 +268,8 @@ export function coreHistory(context) { }, + // Returns the entities from the active graph with bounding boxes + // overlapping the given `extent`. intersects: function(extent) { return _tree.intersects(extent, _stack[_index].graph); }, diff --git a/modules/renderer/map.js b/modules/renderer/map.js index fb89fa794..f7d545a89 100644 --- a/modules/renderer/map.js +++ b/modules/renderer/map.js @@ -313,7 +313,7 @@ export function rendererMap(context) { var mode = context.mode(); var graph = context.graph(); var features = context.features(); - var all = context.intersects(map.extent()); + var all = context.history().intersects(map.extent()); var fullRedraw = false; var data; var set; @@ -343,7 +343,7 @@ export function rendererMap(context) { } if (extent) { - data = context.intersects(map.extent().intersection(extent)); + data = context.history().intersects(map.extent().intersection(extent)); set = new Set(data.map(function(entity) { return entity.id; })); filter = function(d) { return set.has(d.id); }; diff --git a/modules/ui/contributors.js b/modules/ui/contributors.js index 5ded850a8..4cfae70c0 100644 --- a/modules/ui/contributors.js +++ b/modules/ui/contributors.js @@ -18,7 +18,7 @@ export function uiContributors(context) { if (!osm) return; var users = {}, - entities = context.intersects(context.map().extent()); + entities = context.history().intersects(context.map().extent()); entities.forEach(function(entity) { if (entity && entity.user) users[entity.user] = true; diff --git a/modules/ui/fields/address.js b/modules/ui/fields/address.js index 8425e3e75..e4ec80973 100644 --- a/modules/ui/fields/address.js +++ b/modules/ui/fields/address.js @@ -36,7 +36,7 @@ export function uiFieldAddress(field, context) { var l = extent.center(); var box = geoExtent(l).padByMeters(200); - var streets = context.intersects(box) + var streets = context.history().intersects(box) .filter(isAddressable) .map(function(d) { var loc = context.projection([ @@ -68,7 +68,7 @@ export function uiFieldAddress(field, context) { var l = extent.center(); var box = geoExtent(l).padByMeters(200); - var cities = context.intersects(box) + var cities = context.history().intersects(box) .filter(isAddressable) .map(function(d) { return { @@ -106,7 +106,7 @@ export function uiFieldAddress(field, context) { var l = extent.center(); var box = geoExtent(l).padByMeters(200); - var results = context.intersects(box) + var results = context.history().intersects(box) .filter(function hasTag(d) { return _entityIDs.indexOf(d.id) === -1 && d.tags[key]; }) .map(function(d) { return { diff --git a/modules/ui/sections/raw_membership_editor.js b/modules/ui/sections/raw_membership_editor.js index 8c93fd134..498c1f101 100644 --- a/modules/ui/sections/raw_membership_editor.js +++ b/modules/ui/sections/raw_membership_editor.js @@ -146,7 +146,7 @@ export function uiSectionRawMembershipEditor(context) { }); } else { - context.intersects(context.map().extent()).forEach(function(entity) { + context.history().intersects(context.map().extent()).forEach(function(entity) { if (entity.type !== 'relation' || entity.id === entityID) return; var value = baseDisplayLabel(entity);