From cf868464f43e6d2b02cca7ef4f19d97356047637 Mon Sep 17 00:00:00 2001 From: Quincy Morgan <2046746+quincylvania@users.noreply.github.com> Date: Mon, 13 Jul 2020 15:47:12 -0400 Subject: [PATCH] Fix issue where hover sidebar wouldn't be closed when zooming out past editable extent (close #7765) --- modules/renderer/map.js | 2 +- modules/ui/sidebar.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/renderer/map.js b/modules/renderer/map.js index 273f17812..ab0a1290f 100644 --- a/modules/renderer/map.js +++ b/modules/renderer/map.js @@ -593,7 +593,7 @@ export function rendererMap(context) { if (_lastWithinEditableZoom !== withinEditableZoom) { if (_lastWithinEditableZoom !== undefined) { // notify that the map zoomed in or out over the editable zoom threshold - dispatch.call('crossEditableZoom', this, map); + dispatch.call('crossEditableZoom', this, withinEditableZoom); } _lastWithinEditableZoom = withinEditableZoom; } diff --git a/modules/ui/sidebar.js b/modules/ui/sidebar.js index 0f87ceecb..6eddadaaf 100644 --- a/modules/ui/sidebar.js +++ b/modules/ui/sidebar.js @@ -412,6 +412,13 @@ export function uiSidebar(context) { // toggle the sidebar collapse when double-clicking the resizer resizer.on('dblclick', sidebar.toggle); + + // ensure hover sidebar is closed when zooming out beyond editable zoom + context.map().on('crossEditableZoom.sidebar', function(within) { + if (!within && !selection.select('.inspector-hover').empty()) { + hover([]); + } + }); } sidebar.showPresetList = function() {};