Properly disable the zoom to custom data button when there's no data

This commit is contained in:
Quincy Morgan
2020-09-21 10:01:16 -04:00
parent a788353635
commit bcb613c29b

View File

@@ -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() {