From 313022728c2bc73ea6bee1ba43e150d2c08ae5db Mon Sep 17 00:00:00 2001 From: Devin Fahnestock <137579835+fahnestd@users.noreply.github.com> Date: Fri, 13 Dec 2024 09:08:50 -0500 Subject: [PATCH] prevent map panels from covering up edit menu, fixes #10495 (#10586) --- CHANGELOG.md | 2 ++ modules/ui/edit_menu.js | 4 ++++ modules/ui/init.js | 13 ++++++++----- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c036640b1..c23bb38ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ _Breaking developer changes, which may affect downstream projects or sites that #### :bug: Bugfixes * Fix unsolvable validator error triggered by regional presets ([#10459]) * Render highway direction cones only on matching parent ways ([#9013]) +* Prevent edit menu from being covered up by street level imagery or other map overlay panels ([#10495]) #### :earth_asia: Localization * Update Sinitic languages in the Multilingual Names field ([#10488], thanks [@winstonsung]) * Update the list of languages in the Wikipedia field ([#10489]) @@ -60,6 +61,7 @@ _Breaking developer changes, which may affect downstream projects or sites that [#10459]: https://github.com/openstreetmap/iD/pull/10459 [#10488]: https://github.com/openstreetmap/iD/pull/10488 [#10489]: https://github.com/openstreetmap/iD/pull/10489 +[#10495]: https://github.com/openstreetmap/iD/issues/10495 [@winstonsung]: https://github.com/winstonsung/ diff --git a/modules/ui/edit_menu.js b/modules/ui/edit_menu.js index 9b9bbbdfc..c91827b7c 100644 --- a/modules/ui/edit_menu.js +++ b/modules/ui/edit_menu.js @@ -6,6 +6,7 @@ import { localizer } from '../core/localizer'; import { uiTooltip } from './tooltip'; import { utilRebind } from '../util/rebind'; import { utilHighlightEntities } from '../util/util'; +import { utilGetDimensions } from '../util/dimensions'; import { svgIcon } from '../svg/icon'; @@ -226,6 +227,9 @@ export function uiEditMenu(context) { } var origin = geoVecAdd(anchorLoc, offset); + // repositioning the menu to account for the top menu height + var _verticalOffset = parseFloat(utilGetDimensions(d3_select('.top-toolbar-wrap'))[1]); + origin[1] -= _verticalOffset; _menu .style('left', origin[0] + 'px') diff --git a/modules/ui/init.js b/modules/ui/init.js index 8616dcd98..e38e34c13 100644 --- a/modules/ui/init.js +++ b/modules/ui/init.js @@ -54,6 +54,7 @@ export function uiInit(context) { var _lastPointerType; + var overMap; function render(container) { @@ -160,7 +161,7 @@ export function uiInit(context) { .attr('dir', 'ltr') .call(map); - var overMap = content + overMap = content .append('div') .attr('class', 'over-map'); @@ -665,14 +666,16 @@ export function uiInit(context) { .triggerType(triggerType) .operations(operations); - // render the menu - context.map().supersurface.call(_editMenu); + // render the menu onto the overmap + overMap + .call(_editMenu); }; ui.closeEditMenu = function() { // remove any existing menu no matter how it was added - context.map().supersurface - .select('.edit-menu').remove(); + if (overMap !== undefined) { + overMap.select('.edit-menu').remove(); + } };