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:
@@ -76,7 +76,8 @@ class OSM extends XYZ {
|
||||
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
|
||||
tileLoadFunction: options.tileLoadFunction,
|
||||
url: url,
|
||||
wrapX: options.wrapX
|
||||
wrapX: options.wrapX,
|
||||
attributionsCollapsible: false
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -14,6 +14,7 @@ import {wrapX, getForProjection as getTileGridForProjection} from '../tilegrid.j
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {import("./Source.js").AttributionLike} [attributions]
|
||||
* @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.
|
||||
* @property {number} [cacheSize]
|
||||
* @property {boolean} [opaque]
|
||||
* @property {number} [tilePixelRatio]
|
||||
@@ -40,6 +41,7 @@ class TileSource extends Source {
|
||||
|
||||
super({
|
||||
attributions: options.attributions,
|
||||
attributionsCollapsible: options.attributionsCollapsible,
|
||||
projection: options.projection,
|
||||
state: options.state,
|
||||
wrapX: options.wrapX
|
||||
|
||||
@@ -17,6 +17,7 @@ import {getForProjection as getTileGridForProjection} from '../tilegrid.js';
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {import("./Source.js").AttributionLike} [attributions] Attributions.
|
||||
* @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.
|
||||
* @property {number} [cacheSize=2048] Cache size.
|
||||
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
|
||||
* you must provide a `crossOrigin` value if you are using the WebGL renderer or if you want to
|
||||
@@ -81,7 +82,8 @@ class TileImage extends UrlTile {
|
||||
url: options.url,
|
||||
urls: options.urls,
|
||||
wrapX: options.wrapX,
|
||||
transition: options.transition
|
||||
transition: options.transition,
|
||||
attributionsCollapsible: options.attributionsCollapsible
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,6 +11,7 @@ import {getKeyZXY} from '../tilecoord.js';
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {import("./Source.js").AttributionLike} [attributions]
|
||||
* @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.
|
||||
* @property {number} [cacheSize]
|
||||
* @property {boolean} [opaque]
|
||||
* @property {import("../proj.js").ProjectionLike} [projection]
|
||||
@@ -47,7 +48,8 @@ class UrlTile extends TileSource {
|
||||
tileGrid: options.tileGrid,
|
||||
tilePixelRatio: options.tilePixelRatio,
|
||||
wrapX: options.wrapX,
|
||||
transition: options.transition
|
||||
transition: options.transition,
|
||||
attributionsCollapsible: options.attributionsCollapsible
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,6 +8,7 @@ import {createXYZ, extentFromProjection} from '../tilegrid.js';
|
||||
/**
|
||||
* @typedef {Object} Options
|
||||
* @property {import("./Source.js").AttributionLike} [attributions] Attributions.
|
||||
* @property {boolean} [attributionsCollapsible=true] Attributions are collapsible.
|
||||
* @property {number} [cacheSize=2048] Cache size.
|
||||
* @property {null|string} [crossOrigin] The `crossOrigin` attribute for loaded images. Note that
|
||||
* you must provide a `crossOrigin` value if you are using the WebGL renderer or if you want to
|
||||
@@ -93,7 +94,8 @@ class XYZ extends TileImage {
|
||||
url: options.url,
|
||||
urls: options.urls,
|
||||
wrapX: options.wrapX !== undefined ? options.wrapX : true,
|
||||
transition: options.transition
|
||||
transition: options.transition,
|
||||
attributionsCollapsible: options.attributionsCollapsible
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user