Automated class transform

npx lebab --replace src --transform class
This commit is contained in:
Tim Schaub
2018-07-16 16:18:16 -06:00
parent 60e85e7d89
commit 7b4a73f3b9
145 changed files with 32887 additions and 33714 deletions
+103 -103
View File
@@ -38,117 +38,117 @@ import {inherits} from '../util.js';
* @param {module:ol/control/Rotate~Options=} opt_options Rotate options.
* @api
*/
const Rotate = function(opt_options) {
class Rotate {
constructor(opt_options) {
const options = opt_options ? opt_options : {};
const options = opt_options ? opt_options : {};
const className = options.className !== undefined ? options.className : 'ol-rotate';
const className = options.className !== undefined ? options.className : 'ol-rotate';
const label = options.label !== undefined ? options.label : '\u21E7';
const label = options.label !== undefined ? options.label : '\u21E7';
/**
* @type {Element}
* @private
*/
this.label_ = null;
/**
* @type {Element}
* @private
*/
this.label_ = null;
if (typeof label === 'string') {
this.label_ = document.createElement('span');
this.label_.className = 'ol-compass';
this.label_.textContent = label;
} else {
this.label_ = label;
this.label_.classList.add('ol-compass');
}
const tipLabel = options.tipLabel ? options.tipLabel : 'Reset rotation';
const button = document.createElement('button');
button.className = className + '-reset';
button.setAttribute('type', 'button');
button.title = tipLabel;
button.appendChild(this.label_);
listen(button, EventType.CLICK,
Rotate.prototype.handleClick_, this);
const cssClasses = className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;
const element = document.createElement('div');
element.className = cssClasses;
element.appendChild(button);
this.callResetNorth_ = options.resetNorth ? options.resetNorth : undefined;
Control.call(this, {
element: element,
render: options.render || render,
target: options.target
});
/**
* @type {number}
* @private
*/
this.duration_ = options.duration !== undefined ? options.duration : 250;
/**
* @type {boolean}
* @private
*/
this.autoHide_ = options.autoHide !== undefined ? options.autoHide : true;
/**
* @private
* @type {number|undefined}
*/
this.rotation_ = undefined;
if (this.autoHide_) {
this.element.classList.add(CLASS_HIDDEN);
}
};
inherits(Rotate, Control);
/**
* @param {MouseEvent} event The event to handle
* @private
*/
Rotate.prototype.handleClick_ = function(event) {
event.preventDefault();
if (this.callResetNorth_ !== undefined) {
this.callResetNorth_();
} else {
this.resetNorth_();
}
};
/**
* @private
*/
Rotate.prototype.resetNorth_ = function() {
const map = this.getMap();
const view = map.getView();
if (!view) {
// the map does not have a view, so we can't act
// upon it
return;
}
if (view.getRotation() !== undefined) {
if (this.duration_ > 0) {
view.animate({
rotation: 0,
duration: this.duration_,
easing: easeOut
});
if (typeof label === 'string') {
this.label_ = document.createElement('span');
this.label_.className = 'ol-compass';
this.label_.textContent = label;
} else {
view.setRotation(0);
this.label_ = label;
this.label_.classList.add('ol-compass');
}
const tipLabel = options.tipLabel ? options.tipLabel : 'Reset rotation';
const button = document.createElement('button');
button.className = className + '-reset';
button.setAttribute('type', 'button');
button.title = tipLabel;
button.appendChild(this.label_);
listen(button, EventType.CLICK,
Rotate.prototype.handleClick_, this);
const cssClasses = className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;
const element = document.createElement('div');
element.className = cssClasses;
element.appendChild(button);
this.callResetNorth_ = options.resetNorth ? options.resetNorth : undefined;
Control.call(this, {
element: element,
render: options.render || render,
target: options.target
});
/**
* @type {number}
* @private
*/
this.duration_ = options.duration !== undefined ? options.duration : 250;
/**
* @type {boolean}
* @private
*/
this.autoHide_ = options.autoHide !== undefined ? options.autoHide : true;
/**
* @private
* @type {number|undefined}
*/
this.rotation_ = undefined;
if (this.autoHide_) {
this.element.classList.add(CLASS_HIDDEN);
}
}
/**
* @param {MouseEvent} event The event to handle
* @private
*/
handleClick_(event) {
event.preventDefault();
if (this.callResetNorth_ !== undefined) {
this.callResetNorth_();
} else {
this.resetNorth_();
}
}
};
/**
* @private
*/
resetNorth_() {
const map = this.getMap();
const view = map.getView();
if (!view) {
// the map does not have a view, so we can't act
// upon it
return;
}
if (view.getRotation() !== undefined) {
if (this.duration_ > 0) {
view.animate({
rotation: 0,
duration: this.duration_,
easing: easeOut
});
} else {
view.setRotation(0);
}
}
}
}
inherits(Rotate, Control);
/**