Fix context "edit" menu on touchscreens

* render labels properly, fixes #9425
* always open the touch-specific edit menu (the contextmenu event is always triggered by the browser on long presses, where we need to make sure that this event doesn't override the `isTouchMenu` property of the edit menu)
This commit is contained in:
Martin Raifer
2023-01-19 18:27:02 +01:00
parent 267bf6e346
commit 73773b61f1
3 changed files with 18 additions and 3 deletions
+8
View File
@@ -35,6 +35,14 @@ _Breaking developer changes, which may affect downstream projects or sites that
[@xxxx]: https://github.com/xxxx
-->
# Unreleased
#### :bug: Bugfixes
* Fix context "edit" menu on touchscreens: render labels properly and always open the touch-specific edit menu ([#9425])
[#9425]: https://github.com/openstreetmap/iD/issues/9425
# 2.24.0
##### 2023-Jan-19
+8 -1
View File
@@ -180,7 +180,14 @@ export function behaviorSelect(context) {
}
} else {
_lastMouseEvent = d3_event;
_lastInteractionType = 'rightclick';
if (d3_event.pointerType === 'touch' || d3_event.pointerType === 'pen' ||
d3_event.mozInputSource && ( // firefox doesn't give a pointerType on contextmenu events
d3_event.mozInputSource === MouseEvent.MOZ_SOURCE_TOUCH ||
d3_event.mozInputSource === MouseEvent.MOZ_SOURCE_PEN)) {
_lastInteractionType = 'touch';
} else {
_lastInteractionType = 'rightclick';
}
}
_showMenu = true;
+2 -2
View File
@@ -120,8 +120,8 @@ export function uiEditMenu(context) {
if (showLabels) {
buttonsEnter.append('span')
.attr('class', 'label')
.html(function(d) {
return d.title;
.each(function(d) {
d3_select(this).call(d.title);
});
}