@geolonia/embed 5.2.2 → 6.0.0-pre.3
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/.github/workflows/build.yml +25 -1
- package/CHANGELOG.md +15 -0
- package/README.md +24 -1
- package/dist/embed +1 -1
- package/dist/embed-chunks/4ada77b78cc0cc5ccef9.js +1 -0
- package/dist/embed-chunks/8176630945512b29f294.js +2 -0
- package/dist/embed-chunks/c783fffcd28083f7d5cb.js +2 -0
- package/dist/embed-chunks/f2124097fda51d0079ee.js +1 -0
- package/dist/embed-core.d.ts +6 -7
- package/dist/embed-core.js +1 -1
- package/dist/embed.d.ts +2 -4
- package/dist/embed.js +1 -1
- package/dist/lib/parse-atts.d.ts +19 -0
- package/dist/lib/render.d.ts +1 -1
- package/dist/lib/util.d.ts +14 -55
- package/dist/types.d.ts +155 -1
- package/dist/version.d.ts +1 -1
- package/e2e/auto-render.spec.ts +44 -0
- package/e2e/basic.spec.ts +10 -74
- package/e2e/cleanup.spec.ts +43 -0
- package/e2e/data-attributes.spec.ts +56 -0
- package/e2e/globals.spec.ts +51 -0
- package/e2e/helper.ts +170 -4
- package/e2e/iframe.spec.ts +35 -0
- package/e2e/lazy-loading.spec.ts +32 -0
- package/e2e/legacy-constructor.spec.ts +102 -0
- package/e2e/plugin.spec.ts +25 -0
- package/e2e/pmtiles.spec.ts +13 -0
- package/package.json +8 -11
- package/playwright.config.ts +6 -32
- package/src/embed-core.ts +12 -14
- package/src/embed.ts +2 -4
- package/src/lib/parse-atts.test.ts +186 -18
- package/src/lib/parse-atts.ts +151 -5
- package/src/lib/render.ts +50 -12
- package/src/lib/util.ts +37 -350
- package/src/types.ts +155 -1
- package/src/version.ts +1 -1
- package/typedoc.json +13 -0
- package/vitest.config.ts +7 -0
- package/dist/embed-chunks/12cbd0d1cb4cf744c32f.js +0 -2
- package/dist/embed-chunks/8a521e8312a5b4da123d.js +0 -2
- package/dist/lib/CustomAttributionControl.d.ts +0 -47
- package/dist/lib/controls/geolonia-control.d.ts +0 -7
- package/dist/lib/geolonia-map.d.ts +0 -30
- package/dist/lib/geolonia-marker.d.ts +0 -9
- package/dist/lib/keyring.d.ts +0 -45
- package/dist/lib/maplibre-util.d.ts +0 -25
- package/dist/lib/simplestyle-vector.d.ts +0 -26
- package/dist/lib/simplestyle.d.ts +0 -31
- package/e2e/external-style.spec.ts +0 -25
- package/e2e/map.spec.ts +0 -69
- package/src/lib/CustomAttributionControl.ts +0 -394
- package/src/lib/controls/geolonia-control.ts +0 -38
- package/src/lib/geolonia-map.ts +0 -429
- package/src/lib/geolonia-marker.ts +0 -53
- package/src/lib/keyring.test.ts +0 -127
- package/src/lib/keyring.ts +0 -136
- package/src/lib/maplibre-util.ts +0 -137
- package/src/lib/marker.svg +0 -1
- package/src/lib/simplestyle-vector.ts +0 -257
- package/src/lib/simplestyle.test.ts +0 -289
- package/src/lib/simplestyle.ts +0 -435
- package/src/lib/util.test.ts +0 -364
- /package/dist/embed-chunks/{12cbd0d1cb4cf744c32f.js.LICENSE.txt → 8176630945512b29f294.js.LICENSE.txt} +0 -0
- /package/dist/embed-chunks/{8a521e8312a5b4da123d.js.LICENSE.txt → c783fffcd28083f7d5cb.js.LICENSE.txt} +0 -0
|
@@ -1,394 +0,0 @@
|
|
|
1
|
-
import { DOM, bindAll } from './maplibre-util';
|
|
2
|
-
import type { ControlPosition, IControl } from 'maplibre-gl';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* This class is a copy of maplibre-gl-js's AttributionControl class and rewrite by shadow DOM.
|
|
6
|
-
* https://github.com/maplibre/maplibre-gl-js/blob/main/src/ui/control/attribution_control.ts
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* When the map is too small to display the full attribution, it will be
|
|
11
|
-
* collapsed in to a "i" icon. It is open by default, and will hide itself
|
|
12
|
-
* when user interaction is detected.
|
|
13
|
-
* For more information on why this is open by default, see the following links:
|
|
14
|
-
*
|
|
15
|
-
* The OSM Foundation attribution guidelines.
|
|
16
|
-
* https://wiki.osmfoundation.org/wiki/Licence/Attribution_Guidelines#Interactive_maps
|
|
17
|
-
* > You may use a mechanism to fade/collapse the attribution under certain conditions:
|
|
18
|
-
* > * immediately with a dismiss interaction, for example clicking an ‘x’ in the corner of a dialog
|
|
19
|
-
* > * automatically on map interaction such as panning, clicking, or zooming
|
|
20
|
-
* > * automatically after five seconds. This also applies to splash screens or pop-ups.
|
|
21
|
-
*
|
|
22
|
-
* This is the issue where attribution is open by default in the MapLibre GL JS library:
|
|
23
|
-
* https://github.com/maplibre/maplibre-gl-js/issues/205
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
class CustomAttributionControl implements IControl {
|
|
27
|
-
private options;
|
|
28
|
-
private _map;
|
|
29
|
-
private _compact;
|
|
30
|
-
private _container;
|
|
31
|
-
private _shadowContainer;
|
|
32
|
-
private _innerContainer;
|
|
33
|
-
private _compactButton;
|
|
34
|
-
private _editLink;
|
|
35
|
-
private _attribHTML;
|
|
36
|
-
private styleId;
|
|
37
|
-
private styleOwner;
|
|
38
|
-
private printQuery;
|
|
39
|
-
private onMediaPrintChange;
|
|
40
|
-
|
|
41
|
-
constructor(options = {}) {
|
|
42
|
-
this.options = options;
|
|
43
|
-
|
|
44
|
-
bindAll(
|
|
45
|
-
[
|
|
46
|
-
'_toggleAttribution',
|
|
47
|
-
'_updateData',
|
|
48
|
-
'_updateCompact',
|
|
49
|
-
'_updateCompactMinimize',
|
|
50
|
-
],
|
|
51
|
-
this,
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
getDefaultPosition(): ControlPosition {
|
|
56
|
-
return 'bottom-right';
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
onAdd(map) {
|
|
60
|
-
this._map = map;
|
|
61
|
-
this._compact = this.options && this.options.compact;
|
|
62
|
-
this._container = DOM.create('div');
|
|
63
|
-
|
|
64
|
-
const shadow = this._container.attachShadow({ mode: 'open' });
|
|
65
|
-
|
|
66
|
-
this._shadowContainer = DOM.create(
|
|
67
|
-
'details',
|
|
68
|
-
'maplibregl-ctrl maplibregl-ctrl-attrib',
|
|
69
|
-
);
|
|
70
|
-
this._compactButton = DOM.create(
|
|
71
|
-
'summary',
|
|
72
|
-
'maplibregl-ctrl-attrib-button',
|
|
73
|
-
this._shadowContainer,
|
|
74
|
-
);
|
|
75
|
-
this._compactButton.addEventListener('click', this._toggleAttribution);
|
|
76
|
-
this._setElementTitle(this._compactButton, 'ToggleAttribution');
|
|
77
|
-
this._innerContainer = DOM.create(
|
|
78
|
-
'div',
|
|
79
|
-
'maplibregl-ctrl-attrib-inner',
|
|
80
|
-
this._shadowContainer,
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
const style = document.createElement('style');
|
|
84
|
-
style.textContent = `
|
|
85
|
-
.maplibregl-ctrl {
|
|
86
|
-
font: 12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;
|
|
87
|
-
clear: both;
|
|
88
|
-
pointer-events: auto;
|
|
89
|
-
transform: translate(0);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus {
|
|
93
|
-
box-shadow: 0 0 2px 2px #0096ff
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.maplibregl-ctrl.maplibregl-ctrl-attrib {
|
|
97
|
-
background-color: hsla(0,0%,100%,.5);
|
|
98
|
-
margin: 0;
|
|
99
|
-
padding: 0 5px
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
@media screen {
|
|
103
|
-
.maplibregl-ctrl-attrib.maplibregl-compact {
|
|
104
|
-
background-color: #fff;
|
|
105
|
-
border-radius: 12px;
|
|
106
|
-
box-sizing: content-box;
|
|
107
|
-
min-height: 20px;
|
|
108
|
-
padding: 2px 24px 2px 0;
|
|
109
|
-
position: relative;
|
|
110
|
-
margin: 10px 10px 10px auto;
|
|
111
|
-
width: 0;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.maplibregl-ctrl-attrib.maplibregl-compact-show {
|
|
115
|
-
padding: 2px 28px 2px 8px;
|
|
116
|
-
visibility: visible;
|
|
117
|
-
width: auto;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show {
|
|
121
|
-
border-radius: 12px;
|
|
122
|
-
padding: 2px 8px 2px 28px
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner {
|
|
126
|
-
display: none
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.maplibregl-ctrl-attrib-button {
|
|
130
|
-
background-color: hsla(0,0%,100%,.5);
|
|
131
|
-
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E");
|
|
132
|
-
border: 0;
|
|
133
|
-
border-radius: 12px;
|
|
134
|
-
box-sizing: border-box;
|
|
135
|
-
cursor: pointer;
|
|
136
|
-
display: none;
|
|
137
|
-
height: 24px;
|
|
138
|
-
outline: none;
|
|
139
|
-
position: absolute;
|
|
140
|
-
right: 0;
|
|
141
|
-
top: 0;
|
|
142
|
-
width: 24px
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button {
|
|
146
|
-
appearance: none;
|
|
147
|
-
list-style: none
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker {
|
|
151
|
-
display: none
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button {
|
|
155
|
-
left: 0
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner {
|
|
159
|
-
display: block
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button {
|
|
163
|
-
background-color: rgb(0 0 0/5%)
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after {
|
|
167
|
-
bottom: 0;
|
|
168
|
-
right: 0
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after {
|
|
172
|
-
right: 0;
|
|
173
|
-
top: 0
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after {
|
|
177
|
-
left: 0;
|
|
178
|
-
top: 0
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after {
|
|
182
|
-
bottom: 0;
|
|
183
|
-
left: 0
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
@media screen and (-ms-high-contrast:active) {
|
|
188
|
-
.maplibregl-ctrl-attrib.maplibregl-compact:after {
|
|
189
|
-
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd' fill='%23fff'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
@media screen and (-ms-high-contrast:black-on-white) {
|
|
194
|
-
.maplibregl-ctrl-attrib.maplibregl-compact:after {
|
|
195
|
-
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='24' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg' fill-rule='evenodd'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E")
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
@media print {
|
|
200
|
-
.maplibregl-ctrl-attrib-button {
|
|
201
|
-
display: none!important;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
.maplibregl-ctrl-attrib a {
|
|
206
|
-
color: rgba(0,0,0,.75);
|
|
207
|
-
text-decoration: none;
|
|
208
|
-
white-space: nowrap;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
.maplibregl-ctrl-attrib a:hover {
|
|
212
|
-
color: inherit;
|
|
213
|
-
text-decoration: underline
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
.maplibregl-attrib-empty {
|
|
217
|
-
display: none
|
|
218
|
-
}
|
|
219
|
-
`;
|
|
220
|
-
|
|
221
|
-
this._updateAttributions();
|
|
222
|
-
this._updateCompact();
|
|
223
|
-
|
|
224
|
-
this._map.on('styledata', this._updateData);
|
|
225
|
-
this._map.on('sourcedata', this._updateData);
|
|
226
|
-
this._map.on('terrain', this._updateData);
|
|
227
|
-
this._map.on('resize', this._updateCompact);
|
|
228
|
-
this._map.on('drag', this._updateCompactMinimize);
|
|
229
|
-
|
|
230
|
-
shadow.appendChild(style);
|
|
231
|
-
shadow.appendChild(this._shadowContainer);
|
|
232
|
-
|
|
233
|
-
this.printQuery = window.matchMedia('print');
|
|
234
|
-
this.onMediaPrintChange = (e) => {
|
|
235
|
-
if (e.matches) {
|
|
236
|
-
// force open
|
|
237
|
-
this._shadowContainer.setAttribute('open', '');
|
|
238
|
-
this._shadowContainer.classList.remove('maplibregl-compact-show');
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
this.printQuery.addEventListener('change', this.onMediaPrintChange);
|
|
242
|
-
|
|
243
|
-
return this._container;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
onRemove() {
|
|
247
|
-
DOM.remove(this._container);
|
|
248
|
-
|
|
249
|
-
this._map.off('styledata', this._updateData);
|
|
250
|
-
this._map.off('sourcedata', this._updateData);
|
|
251
|
-
this._map.off('terrain', this._updateData);
|
|
252
|
-
this._map.off('resize', this._updateCompact);
|
|
253
|
-
this._map.off('drag', this._updateCompactMinimize);
|
|
254
|
-
|
|
255
|
-
this._map = undefined;
|
|
256
|
-
this._compact = undefined;
|
|
257
|
-
this._attribHTML = undefined;
|
|
258
|
-
|
|
259
|
-
this.printQuery.removeEventListener('change', this.onMediaPrintChange);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
_setElementTitle(element, title) {
|
|
263
|
-
const str = this._map._getUIString(`AttributionControl.${title}`);
|
|
264
|
-
element.title = str;
|
|
265
|
-
element.setAttribute('aria-label', str);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
_toggleAttribution() {
|
|
269
|
-
if (this._shadowContainer.classList.contains('maplibregl-compact')) {
|
|
270
|
-
if (this._shadowContainer.classList.contains('maplibregl-compact-show')) {
|
|
271
|
-
this._shadowContainer.setAttribute('open', '');
|
|
272
|
-
this._shadowContainer.classList.remove('maplibregl-compact-show');
|
|
273
|
-
} else {
|
|
274
|
-
this._shadowContainer.classList.add('maplibregl-compact-show');
|
|
275
|
-
this._shadowContainer.removeAttribute('open');
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
_updateData(e) {
|
|
281
|
-
if (
|
|
282
|
-
e &&
|
|
283
|
-
(e.sourceDataType === 'metadata' ||
|
|
284
|
-
e.sourceDataType === 'visibility' ||
|
|
285
|
-
e.dataType === 'style' ||
|
|
286
|
-
e.type === 'terrain')
|
|
287
|
-
) {
|
|
288
|
-
this._updateAttributions();
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
_updateAttributions() {
|
|
293
|
-
if (!this._map.style) return;
|
|
294
|
-
let attributions = [];
|
|
295
|
-
if (this.options.customAttribution) {
|
|
296
|
-
if (Array.isArray(this.options.customAttribution)) {
|
|
297
|
-
attributions = attributions.concat(
|
|
298
|
-
this.options.customAttribution.map((attribution) => {
|
|
299
|
-
if (typeof attribution !== 'string') return '';
|
|
300
|
-
return attribution;
|
|
301
|
-
}),
|
|
302
|
-
);
|
|
303
|
-
} else if (typeof this.options.customAttribution === 'string') {
|
|
304
|
-
attributions.push(this.options.customAttribution);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
if (this._map.style.stylesheet) {
|
|
309
|
-
const stylesheet = this._map.style.stylesheet;
|
|
310
|
-
this.styleOwner = stylesheet.owner;
|
|
311
|
-
this.styleId = stylesheet.id;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
const tileManagers = this._map.style.tileManagers;
|
|
315
|
-
for (const id in tileManagers) {
|
|
316
|
-
const tileManager = tileManagers[id];
|
|
317
|
-
if (tileManager.used || tileManager.usedForTerrain) {
|
|
318
|
-
const source = tileManager.getSource();
|
|
319
|
-
if (
|
|
320
|
-
source.attribution &&
|
|
321
|
-
attributions.indexOf(source.attribution) < 0
|
|
322
|
-
) {
|
|
323
|
-
attributions.push(source.attribution);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
// remove any entries that are whitespace
|
|
329
|
-
attributions = attributions.filter((e) => String(e).trim());
|
|
330
|
-
|
|
331
|
-
// remove any entries that are substrings of another entry.
|
|
332
|
-
// first sort by length so that substrings come first
|
|
333
|
-
attributions.sort((a, b) => a.length - b.length);
|
|
334
|
-
attributions = attributions.filter((attrib, i) => {
|
|
335
|
-
for (let j = i + 1; j < attributions.length; j++) {
|
|
336
|
-
if (attributions[j].indexOf(attrib) >= 0) {
|
|
337
|
-
return false;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
return true;
|
|
341
|
-
});
|
|
342
|
-
|
|
343
|
-
// check if attribution string is different to minimize DOM changes
|
|
344
|
-
const attribHTML = attributions.join(' | ');
|
|
345
|
-
if (attribHTML === this._attribHTML) return;
|
|
346
|
-
|
|
347
|
-
this._attribHTML = attribHTML;
|
|
348
|
-
|
|
349
|
-
if (attributions.length) {
|
|
350
|
-
this._innerContainer.innerHTML = attribHTML;
|
|
351
|
-
this._shadowContainer.classList.remove('maplibregl-attrib-empty');
|
|
352
|
-
} else {
|
|
353
|
-
this._shadowContainer.classList.add('maplibregl-attrib-empty');
|
|
354
|
-
}
|
|
355
|
-
this._updateCompact();
|
|
356
|
-
// remove old DOM node from _editLink
|
|
357
|
-
this._editLink = null;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
_updateCompact() {
|
|
361
|
-
if (this._map.getCanvasContainer().offsetWidth <= 640 || this._compact) {
|
|
362
|
-
if (this._compact === false) {
|
|
363
|
-
this._shadowContainer.setAttribute('open', '');
|
|
364
|
-
} else if (
|
|
365
|
-
!this._shadowContainer.classList.contains('maplibregl-compact') &&
|
|
366
|
-
!this._shadowContainer.classList.contains('maplibregl-attrib-empty')
|
|
367
|
-
) {
|
|
368
|
-
this._shadowContainer.setAttribute('open', '');
|
|
369
|
-
this._shadowContainer.classList.add(
|
|
370
|
-
'maplibregl-compact',
|
|
371
|
-
'maplibregl-compact-show',
|
|
372
|
-
);
|
|
373
|
-
}
|
|
374
|
-
} else {
|
|
375
|
-
this._shadowContainer.setAttribute('open', '');
|
|
376
|
-
if (this._shadowContainer.classList.contains('maplibregl-compact')) {
|
|
377
|
-
this._shadowContainer.classList.remove(
|
|
378
|
-
'maplibregl-compact',
|
|
379
|
-
'maplibregl-compact-show',
|
|
380
|
-
);
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
_updateCompactMinimize() {
|
|
386
|
-
if (this._shadowContainer.classList.contains('maplibregl-compact')) {
|
|
387
|
-
if (this._shadowContainer.classList.contains('maplibregl-compact-show')) {
|
|
388
|
-
this._shadowContainer.classList.remove('maplibregl-compact-show');
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
export default CustomAttributionControl;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { ControlPosition, IControl } from 'maplibre-gl';
|
|
2
|
-
|
|
3
|
-
export class GeoloniaControl implements IControl {
|
|
4
|
-
private container: HTMLDivElement;
|
|
5
|
-
|
|
6
|
-
onAdd() {
|
|
7
|
-
this.container = document.createElement('div');
|
|
8
|
-
this.container.className = 'maplibregl-ctrl';
|
|
9
|
-
|
|
10
|
-
const img = document.createElement('img');
|
|
11
|
-
img.src = 'https://cdn.geolonia.com/logo/geolonia-symbol_1.png';
|
|
12
|
-
img.style.width = '16px';
|
|
13
|
-
img.style.height = '16px';
|
|
14
|
-
img.style.display = 'block';
|
|
15
|
-
img.style.cursor = 'pointer';
|
|
16
|
-
img.style.padding = '0';
|
|
17
|
-
img.style.margin = '0';
|
|
18
|
-
img.style.border = 'none';
|
|
19
|
-
img.alt = 'Geolonia';
|
|
20
|
-
|
|
21
|
-
const link = document.createElement('a');
|
|
22
|
-
link.href = 'https://geolonia.com/';
|
|
23
|
-
link.appendChild(img);
|
|
24
|
-
link.title = 'Powered by Geolonia';
|
|
25
|
-
|
|
26
|
-
this.container.appendChild(link);
|
|
27
|
-
|
|
28
|
-
return this.container;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
onRemove() {
|
|
32
|
-
this.container.parentNode.removeChild(this.container);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
getDefaultPosition(): ControlPosition {
|
|
36
|
-
return 'bottom-left';
|
|
37
|
-
}
|
|
38
|
-
}
|