@cowegis/client 1.0.1 → 1.0.2
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/js/element/MapElement.js +21 -4
- package/package.json +4 -4
package/js/element/MapElement.js
CHANGED
|
@@ -13,7 +13,7 @@ class MapElement extends HTMLElement {
|
|
|
13
13
|
this.attachShadow({mode: 'open'});
|
|
14
14
|
this.shadowRoot.innerHTML = template;
|
|
15
15
|
this._leaflet = L;
|
|
16
|
-
this._container = this.shadowRoot.querySelector('.cowegis-map-container')
|
|
16
|
+
this._container = this.shadowRoot.querySelector('.cowegis-map-container');
|
|
17
17
|
this._map = null;
|
|
18
18
|
this._layers = {};
|
|
19
19
|
this._controls = {};
|
|
@@ -21,6 +21,7 @@ class MapElement extends HTMLElement {
|
|
|
21
21
|
this._listeners = {};
|
|
22
22
|
this._config = {};
|
|
23
23
|
this._assets = new AssetsLoader(this);
|
|
24
|
+
this._connected = false;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
get container() {
|
|
@@ -41,9 +42,11 @@ class MapElement extends HTMLElement {
|
|
|
41
42
|
this._listeners = {};
|
|
42
43
|
this._config = this._prepareConfig(config);
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
this.
|
|
46
|
-
}
|
|
45
|
+
if (this._connected) {
|
|
46
|
+
this._createMap();
|
|
47
|
+
} else {
|
|
48
|
+
this.addEventListener('cowegis:connected', this._createMap.bind(this));
|
|
49
|
+
}
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
get leaflet() {
|
|
@@ -89,6 +92,7 @@ class MapElement extends HTMLElement {
|
|
|
89
92
|
|
|
90
93
|
config.then(function (config) {
|
|
91
94
|
this.config = config;
|
|
95
|
+
this._setConnected();
|
|
92
96
|
}.bind(this));
|
|
93
97
|
|
|
94
98
|
return;
|
|
@@ -109,6 +113,8 @@ class MapElement extends HTMLElement {
|
|
|
109
113
|
configLoaded = true;
|
|
110
114
|
}.bind(this));
|
|
111
115
|
|
|
116
|
+
this._setConnected();
|
|
117
|
+
|
|
112
118
|
if (configLoaded) {
|
|
113
119
|
return;
|
|
114
120
|
}
|
|
@@ -163,6 +169,17 @@ class MapElement extends HTMLElement {
|
|
|
163
169
|
|
|
164
170
|
return config;
|
|
165
171
|
}
|
|
172
|
+
|
|
173
|
+
_createMap() {
|
|
174
|
+
mapFactory.create(this).then(function () {
|
|
175
|
+
this.dispatchEvent(new CustomEvent('cowegis:ready', {bubbles: true, detail: {element: this}}));
|
|
176
|
+
}.bind(this));
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
_setConnected() {
|
|
180
|
+
this._connected = true;
|
|
181
|
+
this.dispatchEvent(new CustomEvent('cowegis:connected', {bubbles: true, detail: {element: this}}));
|
|
182
|
+
}
|
|
166
183
|
}
|
|
167
184
|
|
|
168
185
|
export default MapElement;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cowegis/client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Cowegis web client",
|
|
5
5
|
"main": "js/client.js",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/cowegis/
|
|
8
|
+
"url": "git+https://github.com/cowegis/client.git"
|
|
9
9
|
},
|
|
10
10
|
"keywords": [
|
|
11
11
|
"Cowegis",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"author": "netzmacht David Molineus",
|
|
17
17
|
"license": "LGPL-3.0-or-later",
|
|
18
18
|
"bugs": {
|
|
19
|
-
"url": "https://github.com/cowegis/
|
|
19
|
+
"url": "https://github.com/cowegis/client/issues"
|
|
20
20
|
},
|
|
21
|
-
"homepage": "https://github.com/cowegis/
|
|
21
|
+
"homepage": "https://github.com/cowegis/client#readme",
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@fortawesome/fontawesome-svg-core": "^6.1",
|
|
24
24
|
"@fortawesome/free-brands-svg-icons": "^6.1",
|