From e79ff7909220424dcaa420b9bda9f657b28abb07 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Thu, 26 Feb 2015 14:33:03 -0500 Subject: [PATCH] Cleaner code for indeterminate feature checkboxes (fixes #2532) --- js/id/ui/map_data.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/js/id/ui/map_data.js b/js/id/ui/map_data.js index d5f282af0..7c3a94ede 100644 --- a/js/id/ui/map_data.js +++ b/js/id/ui/map_data.js @@ -8,7 +8,7 @@ iD.ui.MapData = function(context) { function map_data(selection) { function showsFeature(d) { - return autoHiddenFeature(d) ? null : context.features().enabled(d); + return context.features().enabled(d); } function autoHiddenFeature(d) { @@ -83,13 +83,10 @@ iD.ui.MapData = function(context) { items .classed('active', active) .selectAll('input') - .property('checked', active); - - if (name === 'feature') { - items - .selectAll('input') - .property('indeterminate', autoHiddenFeature); - } + .property('checked', active) + .property('indeterminate', function(d) { + return (name === 'feature' && autoHiddenFeature(d)); + }); //exit items.exit() @@ -309,7 +306,6 @@ iD.ui.MapData = function(context) { context.features() .on('change.map_data-update', update); - update(); setFill(fillDefault); var keybinding = d3.keybinding('features')