mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-31 01:09:22 +02:00
Properly disable the zoom to custom data button when there's no data
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user