Rename _ol_control_Attribution_ to Attribution

This commit is contained in:
Tim Schaub
2017-12-14 12:56:38 -07:00
parent b74203b846
commit 46e5755f40
4 changed files with 20 additions and 20 deletions
+2 -2
View File
@@ -1,11 +1,11 @@
import _ol_Map_ from '../src/ol/Map.js'; import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js'; import _ol_View_ from '../src/ol/View.js';
import _ol_control_ from '../src/ol/control.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_layer_Tile_ from '../src/ol/layer/Tile.js';
import _ol_source_OSM_ from '../src/ol/source/OSM.js'; import _ol_source_OSM_ from '../src/ol/source/OSM.js';
var attribution = new _ol_control_Attribution_({ var attribution = new Attribution({
collapsible: false collapsible: false
}); });
var map = new _ol_Map_({ var map = new _ol_Map_({
+2 -2
View File
@@ -2,7 +2,7 @@
* @module ol/control * @module ol/control
*/ */
import _ol_Collection_ from './Collection.js'; 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_Rotate_ from './control/Rotate.js';
import _ol_control_Zoom_ from './control/Zoom.js'; import _ol_control_Zoom_ from './control/Zoom.js';
var _ol_control_ = {}; var _ol_control_ = {};
@@ -39,7 +39,7 @@ _ol_control_.defaults = function(opt_options) {
var attributionControl = options.attribution !== undefined ? var attributionControl = options.attribution !== undefined ?
options.attribution : true; options.attribution : true;
if (attributionControl) { if (attributionControl) {
controls.push(new _ol_control_Attribution_(options.attributionOptions)); controls.push(new Attribution(options.attributionOptions));
} }
return controls; return controls;
+14 -14
View File
@@ -25,7 +25,7 @@ import _ol_obj_ from '../obj.js';
* @param {olx.control.AttributionOptions=} opt_options Attribution options. * @param {olx.control.AttributionOptions=} opt_options Attribution options.
* @api * @api
*/ */
var _ol_control_Attribution_ = function(opt_options) { var Attribution = function(opt_options) {
var options = opt_options ? 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(this.ulElement_);
element.appendChild(button); 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, { _ol_control_Control_.call(this, {
element: element, 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.<string>} Attributions. * @return {Array.<string>} Attributions.
* @private * @private
*/ */
_ol_control_Attribution_.prototype.getSourceAttributions_ = function(frameState) { Attribution.prototype.getSourceAttributions_ = function(frameState) {
/** /**
* Used to determine if an attribution already exists. * Used to determine if an attribution already exists.
* @type {Object.<string, boolean>} * @type {Object.<string, boolean>}
@@ -208,7 +208,7 @@ _ol_control_Attribution_.prototype.getSourceAttributions_ = function(frameState)
* @this {ol.control.Attribution} * @this {ol.control.Attribution}
* @api * @api
*/ */
_ol_control_Attribution_.render = function(mapEvent) { Attribution.render = function(mapEvent) {
this.updateElement_(mapEvent.frameState); this.updateElement_(mapEvent.frameState);
}; };
@@ -217,7 +217,7 @@ _ol_control_Attribution_.render = function(mapEvent) {
* @private * @private
* @param {?olx.FrameState} frameState Frame state. * @param {?olx.FrameState} frameState Frame state.
*/ */
_ol_control_Attribution_.prototype.updateElement_ = function(frameState) { Attribution.prototype.updateElement_ = function(frameState) {
if (!frameState) { if (!frameState) {
if (this.renderedVisible_) { if (this.renderedVisible_) {
this.element.style.display = 'none'; this.element.style.display = 'none';
@@ -265,7 +265,7 @@ _ol_control_Attribution_.prototype.updateElement_ = function(frameState) {
* @param {?olx.FrameState} frameState Frame state. * @param {?olx.FrameState} frameState Frame state.
* @private * @private
*/ */
_ol_control_Attribution_.prototype.insertLogos_ = function(frameState) { Attribution.prototype.insertLogos_ = function(frameState) {
var logo; var logo;
var logos = frameState.logos; var logos = frameState.logos;
@@ -309,7 +309,7 @@ _ol_control_Attribution_.prototype.insertLogos_ = function(frameState) {
* @param {Event} event The event to handle * @param {Event} event The event to handle
* @private * @private
*/ */
_ol_control_Attribution_.prototype.handleClick_ = function(event) { Attribution.prototype.handleClick_ = function(event) {
event.preventDefault(); event.preventDefault();
this.handleToggle_(); this.handleToggle_();
}; };
@@ -318,7 +318,7 @@ _ol_control_Attribution_.prototype.handleClick_ = function(event) {
/** /**
* @private * @private
*/ */
_ol_control_Attribution_.prototype.handleToggle_ = function() { Attribution.prototype.handleToggle_ = function() {
this.element.classList.toggle('ol-collapsed'); this.element.classList.toggle('ol-collapsed');
if (this.collapsed_) { if (this.collapsed_) {
replaceNode(this.collapseLabel_, this.label_); replaceNode(this.collapseLabel_, this.label_);
@@ -334,7 +334,7 @@ _ol_control_Attribution_.prototype.handleToggle_ = function() {
* @return {boolean} True if the widget is collapsible. * @return {boolean} True if the widget is collapsible.
* @api * @api
*/ */
_ol_control_Attribution_.prototype.getCollapsible = function() { Attribution.prototype.getCollapsible = function() {
return this.collapsible_; return this.collapsible_;
}; };
@@ -344,7 +344,7 @@ _ol_control_Attribution_.prototype.getCollapsible = function() {
* @param {boolean} collapsible True if the widget is collapsible. * @param {boolean} collapsible True if the widget is collapsible.
* @api * @api
*/ */
_ol_control_Attribution_.prototype.setCollapsible = function(collapsible) { Attribution.prototype.setCollapsible = function(collapsible) {
if (this.collapsible_ === collapsible) { if (this.collapsible_ === collapsible) {
return; return;
} }
@@ -363,7 +363,7 @@ _ol_control_Attribution_.prototype.setCollapsible = function(collapsible) {
* @param {boolean} collapsed True if the widget is collapsed. * @param {boolean} collapsed True if the widget is collapsed.
* @api * @api
*/ */
_ol_control_Attribution_.prototype.setCollapsed = function(collapsed) { Attribution.prototype.setCollapsed = function(collapsed) {
if (!this.collapsible_ || this.collapsed_ === collapsed) { if (!this.collapsible_ || this.collapsed_ === collapsed) {
return; return;
} }
@@ -377,7 +377,7 @@ _ol_control_Attribution_.prototype.setCollapsed = function(collapsed) {
* @return {boolean} True if the widget is collapsed. * @return {boolean} True if the widget is collapsed.
* @api * @api
*/ */
_ol_control_Attribution_.prototype.getCollapsed = function() { Attribution.prototype.getCollapsed = function() {
return this.collapsed_; return this.collapsed_;
}; };
export default _ol_control_Attribution_; export default Attribution;
+2 -2
View File
@@ -1,7 +1,7 @@
import _ol_Map_ from '../../../../src/ol/Map.js'; import _ol_Map_ from '../../../../src/ol/Map.js';
import _ol_Tile_ from '../../../../src/ol/Tile.js'; import _ol_Tile_ from '../../../../src/ol/Tile.js';
import _ol_View_ from '../../../../src/ol/View.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_layer_Tile_ from '../../../../src/ol/layer/Tile.js';
import _ol_source_Tile_ from '../../../../src/ol/source/Tile.js'; import _ol_source_Tile_ from '../../../../src/ol/source/Tile.js';
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
@@ -15,7 +15,7 @@ describe('ol.control.Attribution', function() {
document.body.appendChild(target); document.body.appendChild(target);
map = new _ol_Map_({ map = new _ol_Map_({
target: target, target: target,
controls: [new _ol_control_Attribution_({ controls: [new Attribution({
collapsed: false, collapsed: false,
collapsible: false collapsible: false
})], })],