openlayers/ol3 — pull request #2841 by elemoine (2014-10-14 20:02:49+00:00)
Title: Add a "map" property to ol.control.Control (RFC)

As [reported](https://groups.google.com/d/msg/ol3-dev/Gxb3_Ab8NfU/7ORplUExxUYJ) on the mailing list there's no (`change:map`) event triggered when a control is added to, or removed from, the map.

Overlays, on the other hand, do generate `change:map` (and `propertychange`) events when `setMap` is called. "map" is indeed an `ol.Object` property of `ol.Overlay`.

This PR adds a "map" `ol.Object` property to `ol.control.Control`. I'm creating it as an RFC.

With this PR specific controls (subclasses of `ol.control.Control`) need to override `mapChanged` rather than `setMap` to be notified when the control is added to, or removed from, the map.

What I like about this change:

* Events are emitted when controls are added to/removed from the map.
* More consistency between `ol.Overlay` and `ol.control.Control`.

What I like less:

* `mapChanged` may not be as natural as `setMap` for people creating custom controls.