diff --git a/examples/attributions.js b/examples/attributions.js index fa19bab4ef..b0c5aa0356 100644 --- a/examples/attributions.js +++ b/examples/attributions.js @@ -1,11 +1,11 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; import _ol_control_ from '../src/ol/control.js'; -import _ol_control_Attribution_ from '../src/ol/control/Attribution.js'; +import Attribution from '../src/ol/control/Attribution.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_source_OSM_ from '../src/ol/source/OSM.js'; -var attribution = new _ol_control_Attribution_({ +var attribution = new Attribution({ collapsible: false }); var map = new _ol_Map_({ diff --git a/src/ol/control.js b/src/ol/control.js index a0ae3d38ed..b8eb66d09b 100644 --- a/src/ol/control.js +++ b/src/ol/control.js @@ -2,7 +2,7 @@ * @module ol/control */ import _ol_Collection_ from './Collection.js'; -import _ol_control_Attribution_ from './control/Attribution.js'; +import Attribution from './control/Attribution.js'; import _ol_control_Rotate_ from './control/Rotate.js'; import _ol_control_Zoom_ from './control/Zoom.js'; var _ol_control_ = {}; @@ -39,7 +39,7 @@ _ol_control_.defaults = function(opt_options) { var attributionControl = options.attribution !== undefined ? options.attribution : true; if (attributionControl) { - controls.push(new _ol_control_Attribution_(options.attributionOptions)); + controls.push(new Attribution(options.attributionOptions)); } return controls; diff --git a/src/ol/control/Attribution.js b/src/ol/control/Attribution.js index 476f90d297..a583f05107 100644 --- a/src/ol/control/Attribution.js +++ b/src/ol/control/Attribution.js @@ -25,7 +25,7 @@ import _ol_obj_ from '../obj.js'; * @param {olx.control.AttributionOptions=} opt_options Attribution options. * @api */ -var _ol_control_Attribution_ = function(opt_options) { +var Attribution = function(opt_options) { var options = opt_options ? opt_options : {}; @@ -110,7 +110,7 @@ var _ol_control_Attribution_ = function(opt_options) { element.appendChild(this.ulElement_); element.appendChild(button); - var render = options.render ? options.render : _ol_control_Attribution_.render; + var render = options.render ? options.render : Attribution.render; _ol_control_Control_.call(this, { element: element, @@ -139,7 +139,7 @@ var _ol_control_Attribution_ = function(opt_options) { }; -inherits(_ol_control_Attribution_, _ol_control_Control_); +inherits(Attribution, _ol_control_Control_); /** @@ -148,7 +148,7 @@ inherits(_ol_control_Attribution_, _ol_control_Control_); * @return {Array.} Attributions. * @private */ -_ol_control_Attribution_.prototype.getSourceAttributions_ = function(frameState) { +Attribution.prototype.getSourceAttributions_ = function(frameState) { /** * Used to determine if an attribution already exists. * @type {Object.} @@ -208,7 +208,7 @@ _ol_control_Attribution_.prototype.getSourceAttributions_ = function(frameState) * @this {ol.control.Attribution} * @api */ -_ol_control_Attribution_.render = function(mapEvent) { +Attribution.render = function(mapEvent) { this.updateElement_(mapEvent.frameState); }; @@ -217,7 +217,7 @@ _ol_control_Attribution_.render = function(mapEvent) { * @private * @param {?olx.FrameState} frameState Frame state. */ -_ol_control_Attribution_.prototype.updateElement_ = function(frameState) { +Attribution.prototype.updateElement_ = function(frameState) { if (!frameState) { if (this.renderedVisible_) { this.element.style.display = 'none'; @@ -265,7 +265,7 @@ _ol_control_Attribution_.prototype.updateElement_ = function(frameState) { * @param {?olx.FrameState} frameState Frame state. * @private */ -_ol_control_Attribution_.prototype.insertLogos_ = function(frameState) { +Attribution.prototype.insertLogos_ = function(frameState) { var logo; var logos = frameState.logos; @@ -309,7 +309,7 @@ _ol_control_Attribution_.prototype.insertLogos_ = function(frameState) { * @param {Event} event The event to handle * @private */ -_ol_control_Attribution_.prototype.handleClick_ = function(event) { +Attribution.prototype.handleClick_ = function(event) { event.preventDefault(); this.handleToggle_(); }; @@ -318,7 +318,7 @@ _ol_control_Attribution_.prototype.handleClick_ = function(event) { /** * @private */ -_ol_control_Attribution_.prototype.handleToggle_ = function() { +Attribution.prototype.handleToggle_ = function() { this.element.classList.toggle('ol-collapsed'); if (this.collapsed_) { replaceNode(this.collapseLabel_, this.label_); @@ -334,7 +334,7 @@ _ol_control_Attribution_.prototype.handleToggle_ = function() { * @return {boolean} True if the widget is collapsible. * @api */ -_ol_control_Attribution_.prototype.getCollapsible = function() { +Attribution.prototype.getCollapsible = function() { return this.collapsible_; }; @@ -344,7 +344,7 @@ _ol_control_Attribution_.prototype.getCollapsible = function() { * @param {boolean} collapsible True if the widget is collapsible. * @api */ -_ol_control_Attribution_.prototype.setCollapsible = function(collapsible) { +Attribution.prototype.setCollapsible = function(collapsible) { if (this.collapsible_ === collapsible) { return; } @@ -363,7 +363,7 @@ _ol_control_Attribution_.prototype.setCollapsible = function(collapsible) { * @param {boolean} collapsed True if the widget is collapsed. * @api */ -_ol_control_Attribution_.prototype.setCollapsed = function(collapsed) { +Attribution.prototype.setCollapsed = function(collapsed) { if (!this.collapsible_ || this.collapsed_ === collapsed) { return; } @@ -377,7 +377,7 @@ _ol_control_Attribution_.prototype.setCollapsed = function(collapsed) { * @return {boolean} True if the widget is collapsed. * @api */ -_ol_control_Attribution_.prototype.getCollapsed = function() { +Attribution.prototype.getCollapsed = function() { return this.collapsed_; }; -export default _ol_control_Attribution_; +export default Attribution; diff --git a/test/spec/ol/control/attribution.test.js b/test/spec/ol/control/attribution.test.js index 7d31a45659..5fbafcdc9d 100644 --- a/test/spec/ol/control/attribution.test.js +++ b/test/spec/ol/control/attribution.test.js @@ -1,7 +1,7 @@ import _ol_Map_ from '../../../../src/ol/Map.js'; import _ol_Tile_ from '../../../../src/ol/Tile.js'; import _ol_View_ from '../../../../src/ol/View.js'; -import _ol_control_Attribution_ from '../../../../src/ol/control/Attribution.js'; +import Attribution from '../../../../src/ol/control/Attribution.js'; import _ol_layer_Tile_ from '../../../../src/ol/layer/Tile.js'; import _ol_source_Tile_ from '../../../../src/ol/source/Tile.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; @@ -15,7 +15,7 @@ describe('ol.control.Attribution', function() { document.body.appendChild(target); map = new _ol_Map_({ target: target, - controls: [new _ol_control_Attribution_({ + controls: [new Attribution({ collapsed: false, collapsible: false })],