From bcb613c29b6c8ddd122b98c7f39c17ba6acf8d7c Mon Sep 17 00:00:00 2001 From: Quincy Morgan <2046746+quincylvania@users.noreply.github.com> Date: Mon, 21 Sep 2020 10:01:16 -0400 Subject: [PATCH] Properly disable the zoom to custom data button when there's no data --- modules/ui/sections/data_layers.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/ui/sections/data_layers.js b/modules/ui/sections/data_layers.js index f74cb9b4d..5a418fe3d 100644 --- a/modules/ui/sections/data_layers.js +++ b/modules/ui/sections/data_layers.js @@ -329,6 +329,7 @@ export function uiSectionDataLayers(context) { liEnter .append('button') + .attr('class', 'open-data-options') .call(uiTooltip() .title(t('settings.custom_data.tooltip')) .placement((localizer.textDirection() === 'rtl') ? 'right' : 'left') @@ -338,16 +339,19 @@ export function uiSectionDataLayers(context) { liEnter .append('button') + .attr('class', 'zoom-to-data') .call(uiTooltip() .title(t('map_data.layers.custom.zoom')) .placement((localizer.textDirection() === 'rtl') ? 'right' : 'left') ) .on('click', function() { + if (d3_select(this).classed('disabled')) return; + d3_event.preventDefault(); d3_event.stopPropagation(); dataLayer.fitZoom(); }) - .call(svgIcon('#iD-icon-framed-dot')); + .call(svgIcon('#iD-icon-framed-dot', 'monochrome')); // Update ul = ul @@ -360,6 +364,9 @@ export function uiSectionDataLayers(context) { .selectAll('input') .property('disabled', !hasData) .property('checked', showsData); + + ul.selectAll('button.zoom-to-data') + .classed('disabled', !hasData); } function editCustom() {