allow target to be specified as a string for controls, update the documentation to make more clear what element and target are for
This commit is contained in:
@@ -170,8 +170,11 @@
|
||||
|
||||
/**
|
||||
* @typedef {Object} olx.control.ControlOptions
|
||||
* @property {Element|undefined} element Element.
|
||||
* @property {Element|undefined} target Target.
|
||||
* @property {Element|undefined} element The element is the control's container
|
||||
* element. This only needs to be specified if you're developing a custom
|
||||
* control.
|
||||
* @property {Element|string|undefined} target Specify a target if you want the
|
||||
* control to be rendered outside of the map's viewport.
|
||||
* @todo stability experimental
|
||||
*/
|
||||
|
||||
|
||||
@@ -32,7 +32,10 @@ ol.control.Control = function(options) {
|
||||
* @private
|
||||
* @type {Element|undefined}
|
||||
*/
|
||||
this.target_ = options.target;
|
||||
this.target_ = goog.isDef(options.target) ? (goog.isString(options.target) ?
|
||||
goog.dom.getElement(options.target) !== null ?
|
||||
goog.dom.getElement(options.target) : undefined : options.target) :
|
||||
undefined;
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
||||
Reference in New Issue
Block a user