From 9bd079e10dfa68df2f2fec5adb35df90edb3525f Mon Sep 17 00:00:00 2001
From: Jakub Hampl <kopomir@gmail.com>
Date: Fri, 15 Feb 2019 20:50:23 +0000
Subject: Mapbox Upgrade + Simplified Enums (#9)

---
 src/js/main.js | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

(limited to 'src/js/main.js')

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;
-- 
cgit v1.2.3