Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Export ol.Object#dispatchEvent ? #851

Closed
fredj opened this Issue · 2 comments

2 participants

@fredj
Owner

What I'm trying to do is a context menu that can be activated on acontextmenu event or (on touch device) after a long press.

The context menu handler:

map.on('contextmenu', function(event) {
  event.preventDefault();
  // something useful here
});

On touch devices, the contextmenu is manually triggered:

var holdTimeout;
map.on('touchstart', function(event) {
  holdTimeout = window.setTimeout(function() {
    // trigger a 'contextmenu' event using the touchstart event
    event.type = 'contextmenu';
    map.trigger(event);
  }, 750);
});
map.on(['touchmove', 'touchend'], function(event) {
  window.clearTimeout(holdTimeout);
});

Is it the right direction?

See https://github.com/fredj/ol3/compare/contextmenu

@twpayne

@fredj, is this still needed?

@fredj
Owner

no, can be closed

@fredj fredj closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.