Document custom controls

This commit is contained in:
Peter Robins
2014-06-30 13:33:49 -04:00
parent 64fcb1a0f5
commit 3bbf9ae720

View File

@@ -10,13 +10,26 @@ goog.require('ol.Object');
/**
* @classdesc
* Abstract base class; normally only used for creating subclasses and not
* instantiated in apps.
* A control is a visible widget with a DOM element in a fixed position on the
* screen. They can involve user input (buttons), or be informational only;
* the position is determined using CSS. By default these are part of the map
* container, but can use any outside DOM element.
*
* This is the base class for controls. You can use it for simple custom
* controls by creating the element with listeners, creating an instance:
* ```js
* var myControl = new ol.control.Control({element: myElement});
* ```
* and then adding this to the map.
*
* The main advantage of having this as a control rather than a simple separate
* DOM element is that preventing propagation is handled for you. Controls
* will also be `ol.Object`s in a `ol.Collection`, so you can use their
* methods.
*
* You can also extend this base for your own control class. See
* examples/custom-controls for an example of how to do this.
*
* @constructor
* @extends {ol.Object}
* @implements {oli.control.Control}