Lint removal

This commit is contained in:
Tim Schaub
2018-07-16 17:57:57 -06:00
parent f78d0d4cfa
commit d0ab8dce38
63 changed files with 2945 additions and 2917 deletions

View File

@@ -50,91 +50,91 @@ import {listen, unlistenByKey} from '../events.js';
* @api
*/
class Control {
constructor(options) {
constructor(options) {
BaseObject.call(this);
BaseObject.call(this);
/**
/**
* @protected
* @type {Element}
*/
this.element = options.element ? options.element : null;
this.element = options.element ? options.element : null;
/**
/**
* @private
* @type {Element}
*/
this.target_ = null;
this.target_ = null;
/**
/**
* @private
* @type {module:ol/PluggableMap}
*/
this.map_ = null;
this.map_ = null;
/**
/**
* @protected
* @type {!Array.<module:ol/events~EventsKey>}
*/
this.listenerKeys = [];
this.listenerKeys = [];
/**
/**
* @type {function(module:ol/MapEvent)}
*/
this.render = options.render ? options.render : UNDEFINED;
this.render = options.render ? options.render : UNDEFINED;
if (options.target) {
this.setTarget(options.target);
}
if (options.target) {
this.setTarget(options.target);
}
}
}
/**
/**
* @inheritDoc
*/
disposeInternal() {
removeNode(this.element);
BaseObject.prototype.disposeInternal.call(this);
}
disposeInternal() {
removeNode(this.element);
BaseObject.prototype.disposeInternal.call(this);
}
/**
/**
* Get the map associated with this control.
* @return {module:ol/PluggableMap} Map.
* @api
*/
getMap() {
return this.map_;
}
getMap() {
return this.map_;
}
/**
/**
* Remove the control from its current map and attach it to the new map.
* Subclasses may set up event handlers to get notified about changes to
* the map here.
* @param {module:ol/PluggableMap} map Map.
* @api
*/
setMap(map) {
if (this.map_) {
removeNode(this.element);
}
for (let i = 0, ii = this.listenerKeys.length; i < ii; ++i) {
unlistenByKey(this.listenerKeys[i]);
}
this.listenerKeys.length = 0;
this.map_ = map;
if (this.map_) {
const target = this.target_ ?
this.target_ : map.getOverlayContainerStopEvent();
target.appendChild(this.element);
if (this.render !== UNDEFINED) {
this.listenerKeys.push(listen(map,
MapEventType.POSTRENDER, this.render, this));
}
map.render();
}
}
setMap(map) {
if (this.map_) {
removeNode(this.element);
}
for (let i = 0, ii = this.listenerKeys.length; i < ii; ++i) {
unlistenByKey(this.listenerKeys[i]);
}
this.listenerKeys.length = 0;
this.map_ = map;
if (this.map_) {
const target = this.target_ ?
this.target_ : map.getOverlayContainerStopEvent();
target.appendChild(this.element);
if (this.render !== UNDEFINED) {
this.listenerKeys.push(listen(map,
MapEventType.POSTRENDER, this.render, this));
}
map.render();
}
}
/**
/**
* This function is used to set a target element for the control. It has no
* effect if it is called after the control has been added to the map (i.e.
* after `setMap` is called on the control). If no `target` is set in the
@@ -143,11 +143,11 @@ class Control {
* @param {Element|string} target Target.
* @api
*/
setTarget(target) {
this.target_ = typeof target === 'string' ?
document.getElementById(target) :
target;
}
setTarget(target) {
this.target_ = typeof target === 'string' ?
document.getElementById(target) :
target;
}
}
inherits(Control, BaseObject);

View File

@@ -32,57 +32,57 @@ import {CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';
* @api
*/
class ZoomToExtent {
constructor(opt_options) {
const options = opt_options ? opt_options : {};
constructor(opt_options) {
const options = opt_options ? opt_options : {};
/**
/**
* @type {module:ol/extent~Extent}
* @protected
*/
this.extent = options.extent ? options.extent : null;
this.extent = options.extent ? options.extent : null;
const className = options.className !== undefined ? options.className : 'ol-zoom-extent';
const className = options.className !== undefined ? options.className : 'ol-zoom-extent';
const label = options.label !== undefined ? options.label : 'E';
const tipLabel = options.tipLabel !== undefined ? options.tipLabel : 'Fit to extent';
const button = document.createElement('button');
button.setAttribute('type', 'button');
button.title = tipLabel;
button.appendChild(
typeof label === 'string' ? document.createTextNode(label) : label
);
const label = options.label !== undefined ? options.label : 'E';
const tipLabel = options.tipLabel !== undefined ? options.tipLabel : 'Fit to extent';
const button = document.createElement('button');
button.setAttribute('type', 'button');
button.title = tipLabel;
button.appendChild(
typeof label === 'string' ? document.createTextNode(label) : label
);
listen(button, EventType.CLICK, this.handleClick_, this);
listen(button, EventType.CLICK, this.handleClick_, this);
const cssClasses = className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;
const element = document.createElement('div');
element.className = cssClasses;
element.appendChild(button);
const cssClasses = className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;
const element = document.createElement('div');
element.className = cssClasses;
element.appendChild(button);
Control.call(this, {
element: element,
target: options.target
});
}
Control.call(this, {
element: element,
target: options.target
});
}
/**
/**
* @param {MouseEvent} event The event to handle
* @private
*/
handleClick_(event) {
event.preventDefault();
this.handleZoomToExtent();
}
handleClick_(event) {
event.preventDefault();
this.handleZoomToExtent();
}
/**
/**
* @protected
*/
handleZoomToExtent() {
const map = this.getMap();
const view = map.getView();
const extent = !this.extent ? view.getProjection().getExtent() : this.extent;
view.fit(extent);
}
handleZoomToExtent() {
const map = this.getMap();
const view = map.getView();
const extent = !this.extent ? view.getProjection().getExtent() : this.extent;
view.fit(extent);
}
}
inherits(ZoomToExtent, Control);