Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add beforeopen event #31

Merged
merged 2 commits into from
May 23, 2016
Merged

Add beforeopen event #31

merged 2 commits into from
May 23, 2016

Conversation

jonataswalker
Copy link
Owner

If you want to disable this plugin under certain circumstances, listen to beforeopen:

contextmenu.on('beforeopen', function(evt){
  var feature = map.forEachFeatureAtPixel(evt.pixel, function(ft, l){
    return ft;
  });

  if (feature) { // open only on features
    contextmenu.disable();
  } else {
    contextmenu.enable();
  }
});

@jonataswalker jonataswalker merged commit 5abad41 into master May 23, 2016
@jonataswalker jonataswalker deleted the add-beforeopen-event branch May 23, 2016 18:04
This was referenced May 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant