Performance: only draw midpoints in select mode

This commit is contained in:
Bryan Housel
2017-04-26 10:27:38 -04:00
parent 1dfd3f46ac
commit 8520e06c5a
+7 -2
View File
@@ -15,6 +15,13 @@ import {
export function svgMidpoints(projection, context) {
return function drawMidpoints(selection, graph, entities, filter, extent) {
var layer = selection.selectAll('.layer-hit');
if (context.mode().id !== 'select') {
layer.selectAll('g.midpoint').remove();
return;
}
var poly = extent.polygon(),
midpoints = {};
@@ -86,8 +93,6 @@ export function svgMidpoints(projection, context) {
}
var layer = selection.selectAll('.layer-hit');
var groups = layer
.selectAll('g.midpoint')
.filter(midpointFilter)