@teipublisher/pb-components 2.26.1-next.3 → 3.0.0
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/main.yml +3 -3
- package/.github/workflows/node.js.yml +3 -3
- package/.github/workflows/release.js.yml +4 -4
- package/.releaserc.json +2 -2
- package/CHANGELOG.md +262 -11
- package/Dockerfile +78 -70
- package/css/components.css +5 -5
- package/css/leaflet/images/layers.png +0 -0
- package/dist/demo/components.css +46 -1
- package/dist/demo/pb-browse-docs2.html +1 -1
- package/dist/demo/pb-dialog.html +3 -5
- package/dist/demo/pb-drawer2.html +1 -1
- package/dist/demo/pb-facsimile.html +2 -2
- package/dist/demo/pb-grid.html +19 -6
- package/dist/demo/pb-leaflet-map.html +1 -1
- package/dist/demo/pb-login.html +0 -2
- package/dist/demo/pb-message.html +1 -2
- package/dist/demo/pb-progress.html +2 -2
- package/dist/demo/pb-repeat.html +1 -3
- package/dist/demo/pb-search.html +7 -4
- package/dist/demo/pb-search3.html +1 -1
- package/dist/demo/pb-search4.html +2 -2
- package/dist/demo/pb-view3.html +1 -1
- package/dist/{iron-form-3b8dcaa7.js → iron-form-dfb3e3b1.js} +95 -95
- package/dist/paper-checkbox-645e1077.js +200 -0
- package/dist/{paper-icon-button-b1d31571.js → paper-icon-button-984162bd.js} +1 -1
- package/dist/{paper-checkbox-515a5284.js → paper-inky-focus-behavior-fa16796b.js} +58 -247
- package/dist/{paper-listbox-a3b7175c.js → paper-listbox-5f5d1cec.js} +152 -162
- package/dist/pb-code-editor.js +25 -20
- package/dist/pb-component-docs.js +68 -64
- package/dist/pb-components-bundle.js +1983 -2293
- package/dist/pb-edit-app.js +167 -107
- package/dist/pb-elements.json +176 -120
- package/dist/{pb-i18n-0611135a.js → pb-i18n-4cc00bfe.js} +1 -1
- package/dist/pb-leaflet-map.js +23 -23
- package/dist/pb-mei.js +56 -41
- package/dist/{pb-mixin-b1caa22e.js → pb-mixin-886ece32.js} +1 -1
- package/dist/pb-odd-editor.js +1023 -782
- package/dist/pb-tify.js +2 -2
- package/dist/vaadin-element-mixin-beb74ffd.js +545 -0
- package/gh-pages.js +5 -3
- package/i18n/common/en.json +6 -0
- package/i18n/common/pl.json +2 -2
- package/lib/openseadragon.min.js +6 -6
- package/package.json +3 -3
- package/pb-elements.json +176 -120
- package/src/assets/components.css +5 -5
- package/src/authority/airtable.js +20 -21
- package/src/authority/anton.js +129 -129
- package/src/authority/custom.js +23 -21
- package/src/authority/geonames.js +38 -32
- package/src/authority/gnd.js +50 -42
- package/src/authority/kbga.js +137 -134
- package/src/authority/metagrid.js +44 -46
- package/src/authority/reconciliation.js +66 -67
- package/src/authority/registry.js +4 -4
- package/src/docs/pb-component-docs.js +2 -2
- package/src/docs/pb-component-view.js +5 -5
- package/src/docs/pb-components-list.js +2 -2
- package/src/docs/pb-demo-snippet.js +2 -2
- package/src/dts-client.js +299 -297
- package/src/dts-select-endpoint.js +90 -82
- package/src/parse-date-service.js +184 -135
- package/src/pb-ajax.js +158 -171
- package/src/pb-authority-lookup.js +191 -156
- package/src/pb-autocomplete.js +292 -280
- package/src/pb-blacklab-highlight.js +264 -259
- package/src/pb-blacklab-results.js +236 -221
- package/src/pb-browse-docs.js +540 -475
- package/src/pb-browse.js +68 -65
- package/src/pb-clipboard.js +79 -76
- package/src/pb-code-editor.js +110 -102
- package/src/pb-code-highlight.js +209 -204
- package/src/pb-codepen.js +79 -72
- package/src/pb-collapse.js +211 -151
- package/src/pb-combo-box.js +190 -190
- package/src/pb-components-bundle.js +1 -1
- package/src/pb-components.js +1 -0
- package/src/pb-custom-form.js +173 -153
- package/src/pb-dialog.js +98 -62
- package/src/pb-document.js +89 -90
- package/src/pb-download.js +212 -196
- package/src/pb-drawer.js +145 -148
- package/src/pb-edit-app.js +301 -229
- package/src/pb-edit-xml.js +100 -97
- package/src/pb-events.js +114 -107
- package/src/pb-facs-link.js +104 -102
- package/src/pb-facsimile.js +474 -410
- package/src/pb-formula.js +151 -153
- package/src/pb-geolocation.js +129 -131
- package/src/pb-grid-action.js +53 -56
- package/src/pb-grid.js +231 -228
- package/src/pb-highlight.js +140 -140
- package/src/pb-hotkeys.js +40 -42
- package/src/pb-i18n.js +101 -104
- package/src/pb-image-strip.js +84 -78
- package/src/pb-lang.js +142 -57
- package/src/pb-leaflet-map.js +488 -485
- package/src/pb-link.js +126 -124
- package/src/pb-load.js +431 -429
- package/src/pb-login.js +299 -244
- package/src/pb-manage-odds.js +352 -336
- package/src/pb-map-icon.js +89 -89
- package/src/pb-map-layer.js +85 -85
- package/src/pb-markdown.js +90 -99
- package/src/pb-media-query.js +74 -72
- package/src/pb-mei.js +306 -295
- package/src/pb-message.js +139 -97
- package/src/pb-mixin.js +269 -264
- package/src/pb-navigation.js +80 -95
- package/src/pb-observable.js +38 -38
- package/src/pb-odd-editor.js +1054 -958
- package/src/pb-odd-elementspec-editor.js +349 -298
- package/src/pb-odd-model-editor.js +1075 -909
- package/src/pb-odd-parameter-editor.js +200 -178
- package/src/pb-odd-rendition-editor.js +136 -124
- package/src/pb-page.js +431 -422
- package/src/pb-paginate.js +228 -179
- package/src/pb-panel.js +198 -182
- package/src/pb-popover-themes.js +15 -8
- package/src/pb-popover.js +296 -287
- package/src/pb-print-preview.js +127 -127
- package/src/pb-progress.js +51 -51
- package/src/pb-repeat.js +105 -104
- package/src/pb-restricted.js +84 -77
- package/src/pb-search.js +256 -228
- package/src/pb-select-feature.js +127 -120
- package/src/pb-select-odd.js +132 -124
- package/src/pb-select-template.js +89 -78
- package/src/pb-select.js +251 -227
- package/src/pb-split-list.js +179 -174
- package/src/pb-svg.js +80 -79
- package/src/pb-table-column.js +54 -54
- package/src/pb-table-grid.js +221 -203
- package/src/pb-tabs.js +61 -63
- package/src/pb-tify.js +154 -154
- package/src/pb-timeline.js +382 -249
- package/src/pb-toggle-feature.js +195 -187
- package/src/pb-upload.js +184 -174
- package/src/pb-version.js +30 -30
- package/src/pb-view-annotate.js +135 -98
- package/src/pb-view.js +1282 -1270
- package/src/pb-zoom.js +127 -45
- package/src/polymer-hack.js +1 -1
- package/src/search-result-service.js +256 -223
- package/src/seed-element.js +13 -20
- package/src/settings.js +4 -4
- package/src/theming.js +98 -91
- package/src/urls.js +289 -289
- package/src/utils.js +53 -51
- package/css/pb-styles.css +0 -51
- package/dist/vaadin-element-mixin-fe4a4883.js +0 -527
- package/src/assets/pb-styles.css +0 -51
- package/src/pb-light-dom.js +0 -41
package/src/pb-leaflet-map.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { LitElement, html, css } from 'lit-element';
|
|
2
|
-
import
|
|
2
|
+
import '@lrnwebcomponents/es-global-bridge';
|
|
3
3
|
import { pbMixin } from './pb-mixin.js';
|
|
4
4
|
import { resolveURL } from './utils.js';
|
|
5
|
-
import { get as i18n } from
|
|
5
|
+
import { get as i18n } from './pb-i18n.js';
|
|
6
6
|
import './pb-map-layer.js';
|
|
7
7
|
import './pb-map-icon.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* A wrapper component for [leaflet](https://leafletjs.com/) displaying a map.
|
|
11
|
-
*
|
|
11
|
+
*
|
|
12
12
|
* The map layers displayed can be configured via nested `pb-map-layer` (see docs) elements,
|
|
13
13
|
* icons via `pb-map-icon`.
|
|
14
14
|
*
|
|
@@ -33,522 +33,525 @@ import './pb-map-icon.js';
|
|
|
33
33
|
* @fires pb-geocode - emitted if geocoding is enabled and the user searches or selects a location from the map
|
|
34
34
|
*/
|
|
35
35
|
export class PbLeafletMap extends pbMixin(LitElement) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
36
|
+
static get properties() {
|
|
37
|
+
return {
|
|
38
|
+
...super.properties,
|
|
39
|
+
latitude: {
|
|
40
|
+
type: Number,
|
|
41
|
+
},
|
|
42
|
+
longitude: {
|
|
43
|
+
type: Number,
|
|
44
|
+
},
|
|
45
|
+
zoom: {
|
|
46
|
+
type: Number,
|
|
47
|
+
},
|
|
48
|
+
crs: {
|
|
49
|
+
type: String,
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
* If set, the map will automatically zoom so it can fit all the markers
|
|
53
|
+
*/
|
|
54
|
+
fitMarkers: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
attribute: 'fit-markers',
|
|
57
|
+
},
|
|
58
|
+
/**
|
|
59
|
+
* If set, combine markers into clusters if they are located too close together
|
|
60
|
+
* to display as single markers
|
|
61
|
+
*/
|
|
62
|
+
cluster: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
},
|
|
65
|
+
/**
|
|
66
|
+
* Limits up to which zoom level markers are arranged into clusters.
|
|
67
|
+
* Using a higher zoom level here will result in more markers to be shown.
|
|
68
|
+
*
|
|
69
|
+
* Requires `cluster` option to be enabled.
|
|
70
|
+
*/
|
|
71
|
+
disableClusteringAt: {
|
|
72
|
+
type: Number,
|
|
73
|
+
attribute: 'disable-clustering-at',
|
|
74
|
+
},
|
|
75
|
+
/**
|
|
76
|
+
* If enabled, the map will not automatically scroll to the coordinates received via `pb-geolocation`
|
|
77
|
+
*/
|
|
78
|
+
noScroll: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
attribute: 'no-scroll',
|
|
81
|
+
},
|
|
82
|
+
accessToken: {
|
|
83
|
+
type: String,
|
|
84
|
+
attribute: 'access-token',
|
|
85
|
+
},
|
|
86
|
+
/**
|
|
87
|
+
* If enabled, the map will remain invisible until an event is received from `pb-geolocation`.
|
|
88
|
+
* In this case the map also offers a close button to hide it again.
|
|
89
|
+
*/
|
|
90
|
+
toggle: {
|
|
91
|
+
type: Boolean,
|
|
92
|
+
},
|
|
93
|
+
imagesPath: {
|
|
94
|
+
type: String,
|
|
95
|
+
attribute: 'images-path',
|
|
96
|
+
},
|
|
97
|
+
cssPath: {
|
|
98
|
+
type: String,
|
|
99
|
+
attribute: 'css-path',
|
|
100
|
+
},
|
|
101
|
+
/**
|
|
102
|
+
* Enables geocoding: an additional control will allow users to search for a place.
|
|
103
|
+
* Reverse geocoding is also possible: clicking on the map while pressing ctrl or cmd
|
|
104
|
+
* will request information about the current location.
|
|
105
|
+
*
|
|
106
|
+
* In both cases, a `pb-geocode` event will be emitted containing additional information
|
|
107
|
+
* about the place in the event details (see demo).
|
|
108
|
+
*
|
|
109
|
+
* For lookups the free OSM/Nominatim service is used.
|
|
110
|
+
*/
|
|
111
|
+
geoCoding: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
attribute: 'geo-coding',
|
|
114
|
+
},
|
|
115
|
+
_map: {
|
|
116
|
+
type: Object,
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
constructor() {
|
|
122
|
+
super();
|
|
123
|
+
this.latitude = 51.505;
|
|
124
|
+
this.longitude = -0.09;
|
|
125
|
+
this.zoom = 15;
|
|
126
|
+
this.crs = 'EPSG3857';
|
|
127
|
+
this.accessToken = '';
|
|
128
|
+
this.imagesPath = '../images/leaflet/';
|
|
129
|
+
this.cssPath = '../css/leaflet';
|
|
130
|
+
this.toggle = false;
|
|
131
|
+
this.noScroll = false;
|
|
132
|
+
this.disabled = true;
|
|
133
|
+
this.cluster = false;
|
|
134
|
+
this.fitMarkers = false;
|
|
135
|
+
this.disableClusteringAt = null;
|
|
136
|
+
this._icons = {};
|
|
137
|
+
this.geoCoding = false;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
connectedCallback() {
|
|
141
|
+
super.connectedCallback();
|
|
142
|
+
|
|
143
|
+
this._layers = this.querySelectorAll('pb-map-layer');
|
|
144
|
+
this._markers = this.querySelectorAll('pb-map-icon');
|
|
139
145
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
const marker = L.marker([loc.latitude, loc.longitude]);
|
|
161
|
-
if (loc.label) {
|
|
162
|
-
marker.bindTooltip(loc.label);
|
|
163
|
-
}
|
|
164
|
-
marker.addEventListener('click', () => {
|
|
165
|
-
this.emitTo('pb-leaflet-marker-click', { element: loc });
|
|
166
|
-
});
|
|
167
|
-
marker.bindTooltip(loc.label);
|
|
168
|
-
this.setMarkerIcon(marker);
|
|
169
|
-
this._markerLayer.addLayer(marker);
|
|
170
|
-
});
|
|
171
|
-
this._fitBounds();
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* React to pb-update event triggered by a pb-view
|
|
176
|
-
*
|
|
177
|
-
* @param {{ detail: { root: { querySelectorAll: (arg0: string) => any[]; }; }; }} ev
|
|
178
|
-
*/
|
|
179
|
-
this.subscribeTo('pb-update', (ev) => {
|
|
180
|
-
this._markerLayer.clearLayers();
|
|
181
|
-
const locations = ev.detail.root.querySelectorAll('pb-geolocation');
|
|
182
|
-
/**
|
|
183
|
-
* @param {{ latitude: any; longitude: any; }} loc
|
|
184
|
-
*/
|
|
185
|
-
locations.forEach((loc) => {
|
|
186
|
-
const coords = L.latLng(loc.latitude, loc.longitude);
|
|
187
|
-
const marker = L.marker(coords).addTo(this._markerLayer);
|
|
188
|
-
if (loc.label) {
|
|
189
|
-
marker.bindTooltip(loc.label);
|
|
190
|
-
}
|
|
191
|
-
if (loc.popup) {
|
|
192
|
-
marker.bindPopup(loc.popup);
|
|
193
|
-
}
|
|
194
|
-
marker.addEventListener('click', () => {
|
|
195
|
-
this.emitTo('pb-leaflet-marker-click', { element: loc });
|
|
196
|
-
});
|
|
197
|
-
this.setMarkerIcon(marker);
|
|
198
|
-
});
|
|
199
|
-
this._fitBounds();
|
|
146
|
+
/**
|
|
147
|
+
* Custom event which passes an array of pb-geolocation within event details
|
|
148
|
+
* @param {{ detail: any[]; }} ev
|
|
149
|
+
*/
|
|
150
|
+
this.subscribeTo('pb-update-map', ev => {
|
|
151
|
+
this._markerLayer.clearLayers();
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* @param {{ latitude: any; longitude: any; label: any; }} loc
|
|
155
|
+
*/
|
|
156
|
+
/**
|
|
157
|
+
* @param {{ latitude: any; longitude: any; label: any; }} loc
|
|
158
|
+
*/
|
|
159
|
+
ev.detail.forEach(loc => {
|
|
160
|
+
const marker = L.marker([loc.latitude, loc.longitude]);
|
|
161
|
+
if (loc.label) {
|
|
162
|
+
marker.bindTooltip(loc.label);
|
|
163
|
+
}
|
|
164
|
+
marker.addEventListener('click', () => {
|
|
165
|
+
this.emitTo('pb-leaflet-marker-click', { element: loc });
|
|
200
166
|
});
|
|
167
|
+
marker.bindTooltip(loc.label);
|
|
168
|
+
this.setMarkerIcon(marker);
|
|
169
|
+
this._markerLayer.addLayer(marker);
|
|
170
|
+
});
|
|
171
|
+
this._fitBounds();
|
|
172
|
+
});
|
|
201
173
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
marker.bindPopup(ev.detail.popup);
|
|
225
|
-
}
|
|
226
|
-
this.setMarkerIcon(marker);
|
|
227
|
-
marker.addTo(this._markerLayer);
|
|
228
|
-
|
|
229
|
-
if (ev.detail.fitBounds) {
|
|
230
|
-
this._fitBounds();
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
console.log('<pb-leaflet-map> added marker');
|
|
234
|
-
} else {
|
|
235
|
-
console.log('<pb-leaflet-map> Marker already added to map');
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
if (this.toggle) {
|
|
239
|
-
this.disabled = false;
|
|
240
|
-
}
|
|
241
|
-
const activateMarker = ev.detail.event;
|
|
242
|
-
this._locationChanged(this.latitude, this.longitude, ev.detail.zoom, activateMarker);
|
|
243
|
-
}
|
|
174
|
+
/**
|
|
175
|
+
* React to pb-update event triggered by a pb-view
|
|
176
|
+
*
|
|
177
|
+
* @param {{ detail: { root: { querySelectorAll: (arg0: string) => any[]; }; }; }} ev
|
|
178
|
+
*/
|
|
179
|
+
this.subscribeTo('pb-update', ev => {
|
|
180
|
+
this._markerLayer.clearLayers();
|
|
181
|
+
const locations = ev.detail.root.querySelectorAll('pb-geolocation');
|
|
182
|
+
/**
|
|
183
|
+
* @param {{ latitude: any; longitude: any; }} loc
|
|
184
|
+
*/
|
|
185
|
+
locations.forEach(loc => {
|
|
186
|
+
const coords = L.latLng(loc.latitude, loc.longitude);
|
|
187
|
+
const marker = L.marker(coords).addTo(this._markerLayer);
|
|
188
|
+
if (loc.label) {
|
|
189
|
+
marker.bindTooltip(loc.label);
|
|
190
|
+
}
|
|
191
|
+
if (loc.popup) {
|
|
192
|
+
marker.bindPopup(loc.popup);
|
|
193
|
+
}
|
|
194
|
+
marker.addEventListener('click', () => {
|
|
195
|
+
this.emitTo('pb-leaflet-marker-click', { element: loc });
|
|
244
196
|
});
|
|
245
|
-
|
|
197
|
+
this.setMarkerIcon(marker);
|
|
198
|
+
});
|
|
199
|
+
this._fitBounds();
|
|
200
|
+
});
|
|
246
201
|
|
|
247
202
|
/**
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
* be sure it has initialized.
|
|
203
|
+
* React to events send by pb-geolocation
|
|
204
|
+
*
|
|
205
|
+
* @param {{ detail: { coordinates: { latitude: number; longitude: number; }, label: string; }; }} ev
|
|
252
206
|
*/
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
layer.setIcon(this._icons.default);
|
|
207
|
+
this.subscribeTo('pb-geolocation', ev => {
|
|
208
|
+
if (ev.detail.coordinates) {
|
|
209
|
+
this.latitude = ev.detail.coordinates.latitude;
|
|
210
|
+
this.longitude = ev.detail.coordinates.longitude;
|
|
211
|
+
if (ev.detail.clear) {
|
|
212
|
+
this._markerLayer.clearLayers();
|
|
260
213
|
}
|
|
261
|
-
}
|
|
262
214
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
215
|
+
if (!this._hasMarker(this.latitude, this.longitude)) {
|
|
216
|
+
const marker = L.marker([this.latitude, this.longitude]);
|
|
217
|
+
marker.addEventListener('click', () => {
|
|
218
|
+
this.emitTo('pb-leaflet-marker-click', ev.detail);
|
|
219
|
+
});
|
|
220
|
+
if (ev.detail.label) {
|
|
221
|
+
marker.bindTooltip(ev.detail.label);
|
|
222
|
+
}
|
|
223
|
+
if (ev.detail.popup) {
|
|
224
|
+
marker.bindPopup(ev.detail.popup);
|
|
225
|
+
}
|
|
226
|
+
this.setMarkerIcon(marker);
|
|
227
|
+
marker.addTo(this._markerLayer);
|
|
228
|
+
|
|
229
|
+
if (ev.detail.fitBounds) {
|
|
230
|
+
this._fitBounds();
|
|
231
|
+
}
|
|
267
232
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
233
|
+
console.log('<pb-leaflet-map> added marker');
|
|
234
|
+
} else {
|
|
235
|
+
console.log('<pb-leaflet-map> Marker already added to map');
|
|
271
236
|
}
|
|
272
237
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
const
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
238
|
+
if (this.toggle) {
|
|
239
|
+
this.disabled = false;
|
|
240
|
+
}
|
|
241
|
+
const activateMarker = ev.detail.event;
|
|
242
|
+
this._locationChanged(this.latitude, this.longitude, ev.detail.zoom, activateMarker);
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* The underlying leafletjs map. Can be used for custom scripts.
|
|
249
|
+
*
|
|
250
|
+
* Will be null until the component is fully loaded. Listen to `pb-ready` on the component to
|
|
251
|
+
* be sure it has initialized.
|
|
252
|
+
*/
|
|
253
|
+
get map() {
|
|
254
|
+
return this._map;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
setMarkerIcon(layer) {
|
|
258
|
+
if (this._icons && this._icons.default) {
|
|
259
|
+
layer.setIcon(this._icons.default);
|
|
289
260
|
}
|
|
261
|
+
}
|
|
290
262
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
<link rel="Stylesheet" href="${cssPath}/leaflet.css">
|
|
295
|
-
<link rel="Stylesheet" href="${cssPath}/MarkerCluster.Default.css">
|
|
296
|
-
${this.geoCoding ? html`<link rel="Stylesheet" href="${cssPath}/Control.Geocoder.css">` : null}
|
|
297
|
-
<div id="map" style="height: 100%; width: 100%"></div>
|
|
298
|
-
`;
|
|
263
|
+
firstUpdated() {
|
|
264
|
+
if (!this.toggle) {
|
|
265
|
+
this.disabled = false;
|
|
299
266
|
}
|
|
300
267
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
display: block;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
:host([disabled]) {
|
|
308
|
-
visibility: hidden;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
.close {
|
|
312
|
-
border-radius: 4px;
|
|
313
|
-
background-color: #fff;
|
|
314
|
-
color: inherit;
|
|
315
|
-
padding: 8px;
|
|
316
|
-
font-size: 18px;
|
|
317
|
-
font-weight: bold;
|
|
318
|
-
text-decoration: none;
|
|
319
|
-
cursor: pointer;
|
|
320
|
-
}
|
|
321
|
-
`;
|
|
268
|
+
if (window.L !== undefined) {
|
|
269
|
+
this._initMap();
|
|
270
|
+
return;
|
|
322
271
|
}
|
|
323
272
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
center: L.latLng(this.latitude, this.longitude),
|
|
335
|
-
crs
|
|
336
|
-
});
|
|
337
|
-
this._configureLayers();
|
|
338
|
-
this._configureMarkers();
|
|
339
|
-
|
|
340
|
-
if (this.cluster) {
|
|
341
|
-
const options = {};
|
|
342
|
-
if (this.disableClusteringAt) {
|
|
343
|
-
options.disableClusteringAtZoom = this.disableClusteringAt;
|
|
344
|
-
}
|
|
345
|
-
this._markerLayer = L.markerClusterGroup(options);
|
|
273
|
+
window.ESGlobalBridge.requestAvailability();
|
|
274
|
+
const leafletPath = resolveURL('../lib/leaflet-src.js');
|
|
275
|
+
const pluginPath = resolveURL('../lib/leaflet.markercluster-src.js');
|
|
276
|
+
const geoCodingPath = resolveURL('../lib/Control.Geocoder.min.js');
|
|
277
|
+
window.ESGlobalBridge.instance.load('leaflet', leafletPath).then(() => {
|
|
278
|
+
window.ESGlobalBridge.instance.load('plugin', pluginPath).then(() => {
|
|
279
|
+
if (this.geoCoding) {
|
|
280
|
+
window.ESGlobalBridge.instance
|
|
281
|
+
.load('geocoding', geoCodingPath)
|
|
282
|
+
.then(this._initMap.bind(this));
|
|
346
283
|
} else {
|
|
347
|
-
|
|
348
|
-
}
|
|
349
|
-
this._markerLayer.addTo(this._map);
|
|
350
|
-
|
|
351
|
-
this.signalReady();
|
|
352
|
-
|
|
353
|
-
L.control.scale().addTo(this._map);
|
|
354
|
-
|
|
355
|
-
if (this.toggle) {
|
|
356
|
-
let container;
|
|
357
|
-
L.Control.CloseButton = L.Control.extend({
|
|
358
|
-
options: {
|
|
359
|
-
position: 'topright'
|
|
360
|
-
},
|
|
361
|
-
onAdd: (map) => {
|
|
362
|
-
container = L.DomUtil.create('div');
|
|
363
|
-
container.className = 'close';
|
|
364
|
-
container.innerHTML = 'X';
|
|
365
|
-
L.DomEvent.on(container, 'click', this._hide.bind(this));
|
|
366
|
-
return container;
|
|
367
|
-
},
|
|
368
|
-
onRemove: (map) => {
|
|
369
|
-
L.DomEvent.off(container, 'click', this._hide.bind(this));
|
|
370
|
-
}
|
|
371
|
-
});
|
|
372
|
-
L.control.closeButton = (options) => new L.Control.CloseButton(options);
|
|
373
|
-
L.control.closeButton({ position: 'topright' }).addTo(this._map);
|
|
284
|
+
this._initMap();
|
|
374
285
|
}
|
|
375
|
-
|
|
376
|
-
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
render() {
|
|
291
|
+
const cssPath = resolveURL(this.cssPath);
|
|
292
|
+
return html`
|
|
293
|
+
<link rel="Stylesheet" href="${cssPath}/leaflet.css" />
|
|
294
|
+
<link rel="Stylesheet" href="${cssPath}/MarkerCluster.Default.css" />
|
|
295
|
+
${this.geoCoding
|
|
296
|
+
? html`<link rel="Stylesheet" href="${cssPath}/Control.Geocoder.css" />`
|
|
297
|
+
: null}
|
|
298
|
+
<div id="map" style="height: 100%; width: 100%"></div>
|
|
299
|
+
`;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
static get styles() {
|
|
303
|
+
return css`
|
|
304
|
+
:host {
|
|
305
|
+
display: block;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
:host([disabled]) {
|
|
309
|
+
visibility: hidden;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.close {
|
|
313
|
+
border-radius: 4px;
|
|
314
|
+
background-color: #fff;
|
|
315
|
+
color: inherit;
|
|
316
|
+
padding: 8px;
|
|
317
|
+
font-size: 18px;
|
|
318
|
+
font-weight: bold;
|
|
319
|
+
text-decoration: none;
|
|
320
|
+
cursor: pointer;
|
|
321
|
+
}
|
|
322
|
+
`;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
_initMap() {
|
|
326
|
+
if (this._map) {
|
|
327
|
+
return;
|
|
377
328
|
}
|
|
378
329
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
});
|
|
330
|
+
L.Icon.Default.imagePath = resolveURL(this.imagesPath);
|
|
331
|
+
|
|
332
|
+
const crs = L.CRS[this.crs] || L.CRS.EPSG3857;
|
|
333
|
+
this._map = L.map(this.shadowRoot.getElementById('map'), {
|
|
334
|
+
zoom: this.zoom,
|
|
335
|
+
center: L.latLng(this.latitude, this.longitude),
|
|
336
|
+
crs,
|
|
337
|
+
});
|
|
338
|
+
this._configureLayers();
|
|
339
|
+
this._configureMarkers();
|
|
340
|
+
|
|
341
|
+
if (this.cluster) {
|
|
342
|
+
const options = {};
|
|
343
|
+
if (this.disableClusteringAt) {
|
|
344
|
+
options.disableClusteringAtZoom = this.disableClusteringAt;
|
|
345
|
+
}
|
|
346
|
+
this._markerLayer = L.markerClusterGroup(options);
|
|
347
|
+
} else {
|
|
348
|
+
this._markerLayer = L.layerGroup();
|
|
349
|
+
}
|
|
350
|
+
this._markerLayer.addTo(this._map);
|
|
351
|
+
|
|
352
|
+
this.signalReady();
|
|
353
|
+
|
|
354
|
+
L.control.scale().addTo(this._map);
|
|
355
|
+
|
|
356
|
+
if (this.toggle) {
|
|
357
|
+
let container;
|
|
358
|
+
L.Control.CloseButton = L.Control.extend({
|
|
359
|
+
options: {
|
|
360
|
+
position: 'topright',
|
|
361
|
+
},
|
|
362
|
+
onAdd: map => {
|
|
363
|
+
container = L.DomUtil.create('div');
|
|
364
|
+
container.className = 'close';
|
|
365
|
+
container.innerHTML = 'X';
|
|
366
|
+
L.DomEvent.on(container, 'click', this._hide.bind(this));
|
|
367
|
+
return container;
|
|
368
|
+
},
|
|
369
|
+
onRemove: map => {
|
|
370
|
+
L.DomEvent.off(container, 'click', this._hide.bind(this));
|
|
371
|
+
},
|
|
372
|
+
});
|
|
373
|
+
L.control.closeButton = options => new L.Control.CloseButton(options);
|
|
374
|
+
L.control.closeButton({ position: 'topright' }).addTo(this._map);
|
|
427
375
|
}
|
|
428
376
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
return;
|
|
432
|
-
}
|
|
377
|
+
this._configureGeoCoding();
|
|
378
|
+
}
|
|
433
379
|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
this._icons[config.name] = L.icon(config.options);
|
|
438
|
-
}
|
|
439
|
-
})
|
|
380
|
+
_configureGeoCoding() {
|
|
381
|
+
if (!this.geoCoding) {
|
|
382
|
+
return;
|
|
440
383
|
}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
384
|
+
const geocoder = L.Control.Geocoder.nominatim({
|
|
385
|
+
geocodingQueryParams: {
|
|
386
|
+
'accept-language': 'en',
|
|
387
|
+
},
|
|
388
|
+
});
|
|
389
|
+
const control = L.Control.geocoder({
|
|
390
|
+
defaultMarkGeocode: false,
|
|
391
|
+
geocoder,
|
|
392
|
+
placeholder: i18n('search.search'),
|
|
393
|
+
suggestMinLength: 3,
|
|
394
|
+
});
|
|
395
|
+
control.on('markgeocode', e => {
|
|
396
|
+
const { geocode } = e;
|
|
397
|
+
const options = {
|
|
398
|
+
coordinates: {
|
|
399
|
+
longitude: geocode.center.lng,
|
|
400
|
+
latitude: geocode.center.lat,
|
|
401
|
+
},
|
|
402
|
+
name: geocode.name,
|
|
403
|
+
label: geocode.html,
|
|
404
|
+
properties: geocode.properties,
|
|
405
|
+
};
|
|
406
|
+
this.emitTo('pb-geocode', options);
|
|
407
|
+
});
|
|
408
|
+
control.addTo(this._map);
|
|
409
|
+
|
|
410
|
+
this._map.on('click', e => {
|
|
411
|
+
if (e.originalEvent.ctrlKey || e.originalEvent.metaKey) {
|
|
412
|
+
e.originalEvent.stopPropagation();
|
|
413
|
+
geocoder.reverse(e.latlng, this._map.options.crs.scale(this._map.getZoom()), results => {
|
|
414
|
+
const geocode = results[0];
|
|
415
|
+
const options = {
|
|
416
|
+
coordinates: {
|
|
417
|
+
longitude: e.latlng.lng,
|
|
418
|
+
latitude: e.latlng.lat,
|
|
419
|
+
},
|
|
420
|
+
name: geocode.name,
|
|
421
|
+
label: geocode.html,
|
|
422
|
+
properties: geocode.properties,
|
|
423
|
+
};
|
|
424
|
+
this.emitTo('pb-geocode', options);
|
|
469
425
|
});
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
}
|
|
474
|
-
this._layers = null;
|
|
475
|
-
}
|
|
426
|
+
}
|
|
427
|
+
});
|
|
428
|
+
}
|
|
476
429
|
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
}
|
|
481
|
-
if (config.label) {
|
|
482
|
-
if (config.base) {
|
|
483
|
-
layers.addBaseLayer(layer, config.label);
|
|
484
|
-
} else {
|
|
485
|
-
layers.addOverlay(layer, config.label);
|
|
486
|
-
}
|
|
487
|
-
}
|
|
430
|
+
_configureMarkers() {
|
|
431
|
+
if (this._markers.length === 0) {
|
|
432
|
+
return;
|
|
488
433
|
}
|
|
489
434
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
435
|
+
this._icons = {};
|
|
436
|
+
this._markers.forEach(config => {
|
|
437
|
+
if (config.iconUrl) {
|
|
438
|
+
this._icons[config.name] = L.icon(config.options);
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
_configureLayers() {
|
|
444
|
+
if (this._layers.length === 0) {
|
|
445
|
+
// configure a default layer
|
|
446
|
+
L.tileLayer(
|
|
447
|
+
'https://api.mapbox.com/styles/v1/mapbox/streets-v11/tiles/{z}/{x}/{y}?access_token={accessToken}',
|
|
448
|
+
{
|
|
449
|
+
attribution:
|
|
450
|
+
'© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a></strong>',
|
|
451
|
+
maxZoom: 18,
|
|
452
|
+
zoomOffset: -1,
|
|
453
|
+
tileSize: 512,
|
|
454
|
+
accessToken: this.accessToken,
|
|
455
|
+
},
|
|
456
|
+
).addTo(this._map);
|
|
457
|
+
return;
|
|
507
458
|
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
if (setActive && this._icons && this._icons.active) {
|
|
530
|
-
layer.setIcon(this._icons.active);
|
|
531
|
-
}
|
|
532
|
-
} else if (this._icons && this._icons.default && layer.getIcon() !== this._icons.default) {
|
|
533
|
-
layer.setIcon(this._icons.default);
|
|
534
|
-
}
|
|
535
|
-
});
|
|
536
|
-
}
|
|
459
|
+
const layers = L.control.layers(null, null, { collapsed: true });
|
|
460
|
+
this._layers.forEach(config => {
|
|
461
|
+
let layer;
|
|
462
|
+
switch (config.type) {
|
|
463
|
+
case 'geojson':
|
|
464
|
+
config.data().then(data => {
|
|
465
|
+
layer = L.geoJSON([data]);
|
|
466
|
+
this._addLayer(config, layer, layers);
|
|
467
|
+
});
|
|
468
|
+
break;
|
|
469
|
+
default:
|
|
470
|
+
layer = L.tileLayer(config.url, config.options);
|
|
471
|
+
this._addLayer(config, layer, layers);
|
|
472
|
+
break;
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
// only show layer control if there's more than one layer
|
|
476
|
+
if (this._layers.length > 1) {
|
|
477
|
+
layers.addTo(this._map);
|
|
537
478
|
}
|
|
479
|
+
this._layers = null;
|
|
480
|
+
}
|
|
538
481
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
482
|
+
_addLayer(config, layer, layers) {
|
|
483
|
+
if (config.show) {
|
|
484
|
+
layer.addTo(this._map);
|
|
485
|
+
}
|
|
486
|
+
if (config.label) {
|
|
487
|
+
if (config.base) {
|
|
488
|
+
layers.addBaseLayer(layer, config.label);
|
|
489
|
+
} else {
|
|
490
|
+
layers.addOverlay(layer, config.label);
|
|
491
|
+
}
|
|
548
492
|
}
|
|
493
|
+
}
|
|
549
494
|
|
|
550
|
-
|
|
551
|
-
|
|
495
|
+
_fitBounds() {
|
|
496
|
+
if (!this.fitMarkers) {
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
const bounds = L.latLngBounds();
|
|
500
|
+
let len = 0;
|
|
501
|
+
this._markerLayer.eachLayer(layer => {
|
|
502
|
+
bounds.extend(layer.getLatLng());
|
|
503
|
+
len += 1;
|
|
504
|
+
});
|
|
505
|
+
if (len === 0) {
|
|
506
|
+
this._map.fitWorld();
|
|
507
|
+
} else if (len === 1) {
|
|
508
|
+
this._map.fitBounds(bounds, { maxZoom: this.zoom });
|
|
509
|
+
} else {
|
|
510
|
+
this._map.fitBounds(bounds);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
_locationChanged(lat, long, zoom, setActive) {
|
|
515
|
+
if (this._map) {
|
|
516
|
+
const coords = L.latLng([lat, long]);
|
|
517
|
+
this._markerLayer.eachLayer(layer => {
|
|
518
|
+
if (layer.getLatLng().equals(coords)) {
|
|
519
|
+
if (zoom && !this.noScroll) {
|
|
520
|
+
layer.openTooltip();
|
|
521
|
+
this._map.setView(coords, zoom);
|
|
522
|
+
} else if (this.cluster) {
|
|
523
|
+
this._markerLayer.zoomToShowLayer(layer, () => layer.openTooltip());
|
|
524
|
+
} else {
|
|
525
|
+
layer.openTooltip();
|
|
526
|
+
if (zoom) {
|
|
527
|
+
this._map.setView(coords, zoom);
|
|
528
|
+
} else {
|
|
529
|
+
this._map.panTo(coords);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
if (setActive && this._icons && this._icons.active) {
|
|
533
|
+
layer.setIcon(this._icons.active);
|
|
534
|
+
}
|
|
535
|
+
} else if (this._icons && this._icons.default && layer.getIcon() !== this._icons.default) {
|
|
536
|
+
layer.setIcon(this._icons.default);
|
|
537
|
+
}
|
|
538
|
+
});
|
|
552
539
|
}
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
_hasMarker(lat, long) {
|
|
543
|
+
const coords = L.latLng([lat, long]);
|
|
544
|
+
let found = null;
|
|
545
|
+
this._markerLayer.eachLayer(layer => {
|
|
546
|
+
if (layer instanceof L.Marker && layer.getLatLng().equals(coords)) {
|
|
547
|
+
found = layer;
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
return found;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
_hide() {
|
|
554
|
+
this.disabled = true;
|
|
555
|
+
}
|
|
553
556
|
}
|
|
554
|
-
customElements.define('pb-leaflet-map', PbLeafletMap);
|
|
557
|
+
customElements.define('pb-leaflet-map', PbLeafletMap);
|