Merge pull request #8804 from notnotse/issue/8621-disable-collapsible-attributions-for-osm

Add possibility to disable collapsible attributions from Source
This commit is contained in:
Andreas Hocevar
2018-10-14 12:16:36 +02:00
committed by GitHub
36 changed files with 105 additions and 178 deletions

View File

@@ -31,6 +31,7 @@ import SourceState from './State.js';
/**
* @typedef {Object} Options
* @property {AttributionLike} [attributions]
* @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.
* @property {import("../proj.js").ProjectionLike} projection
* @property {SourceState} [state='ready']
* @property {boolean} [wrapX=false]
@@ -66,6 +67,13 @@ class Source extends BaseObject {
*/
this.attributions_ = 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`.
@@ -96,6 +104,13 @@ class Source extends BaseObject {
return this.attributions_;
}
/**
* @return {boolean} Aattributions are collapsible.
*/
getAttributionsCollapsible() {
return this.attributionsCollapsible_;
}
/**
* Get the projection of the source.
* @return {import("../proj/Projection.js").default} Projection.