aboutsummaryrefslogtreecommitdiffstats
path: root/src/js
diff options
context:
space:
mode:
authorJakub Hampl <kopomir@gmail.com>2019-02-15 20:50:23 +0000
committerGitHub <noreply@github.com>2019-02-15 20:50:23 +0000
commit9bd079e10dfa68df2f2fec5adb35df90edb3525f (patch)
treec65a4314629a043b1fe91dca0d56bbdcfb4c5dff /src/js
parent16f0d89d0f19c2d8bf1bad6c41383973d9ce1ad6 (diff)
Mapbox Upgrade + Simplified Enums (#9)4.0.0
Diffstat (limited to 'src/js')
-rw-r--r--src/js/main.js22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/js/main.js b/src/js/main.js
index bfef979..7699bb3 100644
--- a/src/js/main.js
+++ b/src/js/main.js
@@ -14,7 +14,7 @@ export function registerCustomElement(settings) {
}
window.customElements.define(
"elm-mapbox-map",
- class MapboxMap extends window.HTMLElement {
+ class MapboxMap extends HTMLElement {
constructor() {
super();
this._refreshExpiredTiles = true;
@@ -272,9 +272,29 @@ export function registerCustomElement(settings) {
this.style.display = "block";
this.style.width = "100%";
this.style.height = "100%";
+
+ this._upgradeProperty("mapboxStyle");
+ this._upgradeProperty("minZoom");
+ this._upgradeProperty("maxZoom");
+ this._upgradeProperty("maxBounds");
+ this._upgradeProperty("renderWorldCopies");
+ this._upgradeProperty("center");
+ this._upgradeProperty("zoom");
+ this._upgradeProperty("bearing");
+ this._upgradeProperty("pitch");
+ this._upgradeProperty("featureState");
+
this._map = this._createMapInstance();
}
+ _upgradeProperty(prop) {
+ if (this.hasOwnProperty(prop)) {
+ let value = this[prop];
+ delete this[prop];
+ this[prop] = value;
+ }
+ }
+
disconnectedCallback() {
this._map.remove();
delete this._map;