From a66e21c76f764ecd335b3b5a6d5081e9bae73f77 Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Fri, 11 Oct 2019 12:46:02 +0200 Subject: [PATCH] Fix tooltips on zoom buttons when they're disabled --- modules/ui/zoom.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/ui/zoom.js b/modules/ui/zoom.js index 2893b4798..e986a5532 100644 --- a/modules/ui/zoom.js +++ b/modules/ui/zoom.js @@ -56,7 +56,11 @@ export function uiZoom(context) { .enter() .append('button') .attr('class', function(d) { return d.id; }) - .on('click.editor', function(d) { d.action(); }) + .on('click.editor', function(d) { + if (!d3_select(this).classed('disabled')) { + d.action(); + } + }) .call(tooltip() .placement((textDirection === 'rtl') ? 'right' : 'left') .html(true) @@ -83,13 +87,11 @@ export function uiZoom(context) { function updateButtonStates() { var canZoomIn = context.map().canZoomIn(); selection.select('button.zoom-in') - .classed('disabled', !canZoomIn) - .attr('disabled', canZoomIn ? null : true); + .classed('disabled', !canZoomIn); var canZoomOut = context.map().canZoomOut(); selection.select('button.zoom-out') - .classed('disabled', !canZoomOut) - .attr('disabled', canZoomOut ? null : true); + .classed('disabled', !canZoomOut); } updateButtonStates();