Add possibility to disable collapsible attributions from Source

This commit is contained in:
Bobo Häggström
2018-10-11 14:11:56 +02:00
parent da41515944
commit 2f4d31c8f4
7 changed files with 33 additions and 4 deletions

View File

@@ -31,6 +31,7 @@ import SourceState from './State.js';
/**
* @typedef {Object} Options
* @property {AttributionLike} [attributions]
* @property {boolean} [attributionsCollapsible] Whether attributions should be collapsible.
* @property {import("../proj.js").ProjectionLike} projection
* @property {SourceState} [state]
* @property {boolean} [wrapX]
@@ -66,6 +67,13 @@ class Source extends BaseObject {
*/
this.attributions_ = this.adaptAttributions_(options.attributions);
/**
* @private
* @type {boolean}
*/
this.attributionsCollapsible_ = options.attributionsCollapsible !== undefined ?
options.attributionsCollapsible : true;
/**
* This source is currently loading data. Sources that defer loading to the
* map's tile queue never set this to `true`.
@@ -120,6 +128,13 @@ class Source extends BaseObject {
return this.attributions_;
}
/**
* @return {boolean} Should the attributions be collapsible or not.
*/
getAttributionsCollapsible() {
return this.attributionsCollapsible_;
}
/**
* Get the projection of the source.
* @return {import("../proj/Projection.js").default} Projection.