|
14 | 14 | */
|
15 | 15 | import { TileLayer, setOptions } from 'leaflet';
|
16 | 16 | import { getStaticBasemapTilesUrl, fetchAttribution } from './Util';
|
17 |
| -import { Util } from 'esri-leaflet'; |
| 17 | +// import { Util } from 'esri-leaflet'; |
| 18 | + |
| 19 | +// In the future, get this from Esri Leaflet Util: |
| 20 | +const POWERED_BY_ESRI_ATTRIBUTION_STRING = 'Powered by <a href="https://www.esri.com">Esri</a>'; |
18 | 21 |
|
19 | 22 | export var StaticBasemapTileLayer = TileLayer.extend({
|
20 | 23 | initialize: function (style, options) {
|
@@ -78,14 +81,17 @@ export var StaticBasemapTileLayer = TileLayer.extend({
|
78 | 81 | },
|
79 | 82 | _setupAttribution: function () {
|
80 | 83 | if (!this._map) return;
|
81 |
| - Util.setEsriAttribution(this._map); |
82 | 84 | fetchAttribution(this.options.style, this.options.token).then(attribution => {
|
83 | 85 | // Add attribution directly to map
|
84 |
| - this._map.attributionControl.addAttribution(attribution); |
| 86 | + this.currentAttribution = `${POWERED_BY_ESRI_ATTRIBUTION_STRING} | ${attribution}`; |
| 87 | + this._map.attributionControl.addAttribution(this.currentAttribution); |
85 | 88 | });
|
86 | 89 | },
|
87 | 90 | _removeAttribution: function () {
|
88 |
| - if (Util.removeEsriAttribution) Util.removeEsriAttribution(this._map); |
| 91 | + if (this.currentAttribution) { |
| 92 | + this._map.attributionControl.removeAttribution(this.currentAttribution); |
| 93 | + this.currentAttribution = undefined; |
| 94 | + } |
89 | 95 | },
|
90 | 96 | _initPane: function () {
|
91 | 97 | if (this._map.getPane(this.options.pane)) return;
|
|
0 commit comments