From 24638fe8e407aa2903cc3dcfa03372e868f0812b Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Thu, 25 Jun 2020 14:28:02 -0400 Subject: [PATCH] Disable node lasso selection when zoomed out (re: #7728) --- modules/behavior/lasso.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/behavior/lasso.js b/modules/behavior/lasso.js index 5eda6db5f..f6a39a381 100644 --- a/modules/behavior/lasso.js +++ b/modules/behavior/lasso.js @@ -51,19 +51,19 @@ export function behaviorLasso(context) { function lassoed() { if (!lasso) return []; - if (!context.map().editableDataEnabled(true /* skipZoomCheck */)) return []; - var graph = context.graph(); - var bounds = lasso.extent().map(context.projection.invert); - var extent = geoExtent(normalize(bounds[0], bounds[1])); - var limitToNodes; - if (context.map().isInWideSelection()) { + if (context.map().editableDataEnabled(true /* skipZoomCheck */) && context.map().isInWideSelection()) { // only select from the visible nodes - limitToNodes = new Set(utilGetAllNodes(context.selectedIDs(), context.graph())); + limitToNodes = new Set(utilGetAllNodes(context.selectedIDs(), graph)); + } else if (!context.map().editableDataEnabled()) { + return []; } + var bounds = lasso.extent().map(context.projection.invert); + var extent = geoExtent(normalize(bounds[0], bounds[1])); + var intersects = context.history().intersects(extent).filter(function(entity) { return entity.type === 'node' && (!limitToNodes || limitToNodes.has(entity)) &&