Skip to content

Commit

Permalink
Merge pull request #1075 from geoadmin/bugfix-PB-960-handle-longpress…
Browse files Browse the repository at this point in the history
…-event-conflict

PB-960: handle long press events error on some mobiles
  • Loading branch information
ltkum authored Sep 26, 2024
2 parents d0f0931 + 72ad49e commit 32c3910
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ export default function useMapInteractions(map) {

function onMapRightClick(event) {
clearTimeout(longClickTimeout)
longClickTriggered = event.updateLongClickTriggered ?? false
store.dispatch('click', {
clickInfo: new ClickInfo({
coordinate: event.coordinate,
Expand Down Expand Up @@ -212,14 +213,14 @@ export default function useMapInteractions(map) {
// LocationPopup by touching the same-ish spot for 500ms
longClickTimeout = setTimeout(() => {
if (!mapHasMoved) {
longClickTriggered = true
// we are outside of OL event handling, on the HTML element, so we do not receive map pixel and coordinate automatically
const pixel = map.getEventPixel(event)
const coordinate = map.getCoordinateFromPixel(pixel)
onMapRightClick({
...event,
pixel,
coordinate,
updateLongClickTriggered: true,
})
}
mapHasMoved = false
Expand Down

0 comments on commit 32c3910

Please sign in to comment.