ol 10.0.1-dev.1722809835779 → 10.0.1-dev.1722903959857
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/control/Attribution.d.ts +12 -0
- package/control/Attribution.d.ts.map +1 -1
- package/control/Attribution.js +16 -3
- package/dist/ol.js +1 -1
- package/dist/ol.js.map +1 -1
- package/package.json +1 -1
- package/util.js +1 -1
package/control/Attribution.d.ts
CHANGED
|
@@ -53,6 +53,11 @@ export type Options = {
|
|
|
53
53
|
* callback.
|
|
54
54
|
*/
|
|
55
55
|
render?: ((arg0: import("../MapEvent.js").default) => void) | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Optional attribution(s) that will always be
|
|
58
|
+
* displayed regardless of the layers rendered
|
|
59
|
+
*/
|
|
60
|
+
attributions?: string | Array<string> | undefined;
|
|
56
61
|
};
|
|
57
62
|
/**
|
|
58
63
|
* @typedef {Object} Options
|
|
@@ -79,6 +84,8 @@ export type Options = {
|
|
|
79
84
|
* @property {function(import("../MapEvent.js").default):void} [render] Function called when
|
|
80
85
|
* the control should be re-rendered. This is called in a `requestAnimationFrame`
|
|
81
86
|
* callback.
|
|
87
|
+
* @property {string|Array<string>|undefined} [attributions] Optional attribution(s) that will always be
|
|
88
|
+
* displayed regardless of the layers rendered
|
|
82
89
|
*/
|
|
83
90
|
/**
|
|
84
91
|
* @classdesc
|
|
@@ -119,6 +126,11 @@ declare class Attribution extends Control {
|
|
|
119
126
|
* @type {boolean}
|
|
120
127
|
*/
|
|
121
128
|
private collapsible_;
|
|
129
|
+
/**
|
|
130
|
+
* @private
|
|
131
|
+
* @type {string | Array<string> | undefined}
|
|
132
|
+
*/
|
|
133
|
+
private attributions_;
|
|
122
134
|
/**
|
|
123
135
|
* @private
|
|
124
136
|
* @type {HTMLElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Attribution.d.ts","sourceRoot":"","sources":["Attribution.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAgCuB,OAAO,gBAAgB,EAAE,OAAO,KAAE,IAAI;;
|
|
1
|
+
{"version":3,"file":"Attribution.d.ts","sourceRoot":"","sources":["Attribution.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAgCuB,OAAO,gBAAgB,EAAE,OAAO,KAAE,IAAI;;;;;mBAG/C,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC,GAAC,SAAS;;AAzB5C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH;;;;;;;;GAQG;AACH;IACE;;OAEG;IACH,2CA4IC;IAnIC;;;OAGG;IACH,mBAA8C;IAE9C;;;OAGG;IACH,mBAC4D;IAE5D;;;OAGG;IACH,uBAAqC;IAErC;;;OAGG;IACH,6BAA6D;IAE7D;;;OAGG;IACH,qBACgE;IAMhE;;;OAGG;IACH,sBAAyC;IAsBvC;;;OAGG;IACH,uBAAoD;IAUpD;;;OAGG;IACH,eAA4C;IAU9C;;;OAGG;IACH,sBAAqD;IAyBrD;;;;OAIG;IACH,8BAA+B;IAE/B;;;OAGG;IACH,yBAA4B;IAG9B;;;;;OAKG;IACH,mCAkBC;IAED;;;OAGG;IACH,uBAmCC;IAED;;;OAGG;IACH,qBAIC;IAED;;OAEG;IACH,sBASC;IAED;;;;OAIG;IACH,kBAHY,OAAO,CAKlB;IAED;;;;OAIG;IACH,4BAHW,OAAO,QAYjB;IAED;;;;;;OAMG;IACH,wBAHW,OAAO,QASjB;IAED;;;;;OAKG;IACH,gBAHY,OAAO,CAKlB;CAUF;oBApVmB,cAAc"}
|
package/control/Attribution.js
CHANGED
|
@@ -33,6 +33,8 @@ import {toPromise} from '../functions.js';
|
|
|
33
33
|
* @property {function(import("../MapEvent.js").default):void} [render] Function called when
|
|
34
34
|
* the control should be re-rendered. This is called in a `requestAnimationFrame`
|
|
35
35
|
* callback.
|
|
36
|
+
* @property {string|Array<string>|undefined} [attributions] Optional attribution(s) that will always be
|
|
37
|
+
* displayed regardless of the layers rendered
|
|
36
38
|
*/
|
|
37
39
|
|
|
38
40
|
/**
|
|
@@ -93,6 +95,12 @@ class Attribution extends Control {
|
|
|
93
95
|
this.collapsed_ = false;
|
|
94
96
|
}
|
|
95
97
|
|
|
98
|
+
/**
|
|
99
|
+
* @private
|
|
100
|
+
* @type {string | Array<string> | undefined}
|
|
101
|
+
*/
|
|
102
|
+
this.attributions_ = options.attributions;
|
|
103
|
+
|
|
96
104
|
const className =
|
|
97
105
|
options.className !== undefined ? options.className : 'ol-attribution';
|
|
98
106
|
|
|
@@ -192,9 +200,14 @@ class Attribution extends Control {
|
|
|
192
200
|
*/
|
|
193
201
|
collectSourceAttributions_(frameState) {
|
|
194
202
|
const layers = this.getMap().getAllLayers();
|
|
195
|
-
const visibleAttributions =
|
|
196
|
-
|
|
203
|
+
const visibleAttributions = new Set(
|
|
204
|
+
layers.flatMap((layer) => layer.getAttributions(frameState)),
|
|
197
205
|
);
|
|
206
|
+
if (this.attributions_ !== undefined) {
|
|
207
|
+
Array.isArray(this.attributions_)
|
|
208
|
+
? this.attributions_.forEach((item) => visibleAttributions.add(item))
|
|
209
|
+
: visibleAttributions.add(this.attributions_);
|
|
210
|
+
}
|
|
198
211
|
|
|
199
212
|
if (!this.overrideCollapsible_) {
|
|
200
213
|
const collapsible = !layers.some(
|
|
@@ -202,7 +215,7 @@ class Attribution extends Control {
|
|
|
202
215
|
);
|
|
203
216
|
this.setCollapsible(collapsible);
|
|
204
217
|
}
|
|
205
|
-
return visibleAttributions;
|
|
218
|
+
return Array.from(visibleAttributions);
|
|
206
219
|
}
|
|
207
220
|
|
|
208
221
|
/**
|