openlayers/ol3 — pull request #1129 by elemoine (2013-10-14 14:07:58+00:00)
Title: Add ol.Map#getEventPixel and ol.Map#getEventCoordinate

This PR suggests adding two functions to `ol.Map.prototype`: `getEventPixel` and `getEventCoordinate`. Both functions take a native browser event as an argument. The former returns the map pixel for the passed browser event. The latter returns the geographical coordinate for the passed browser event.

These functions are useful when you listen to native events on the map viewport. For example:

```
$(map.getViewport()).on('contextmenu', function(evt) {
var coordinate = map.getEventCoordinate(evt.originalEvent);
console.log(coordinate);
evt.preventDefault();
});
```

More context: @fredj and I have been discussing the way we handle events in the library. We've come up with a few plans. One of our plans is to no longer have the map [relay](https://github.com/openlayers/ol3/blob/master/src/ol/mapbrowserevent.js#L178-180) native browser events like `contextmenu`. We (now) think it's not a good idea to listen to every browser event, as there are many of them, and handling new browser event types would make the map browser event handler code more complex and thus harder to maintain.

Please review.