diff options
author | Jakub Hampl <kopomir@gmail.com> | 2018-07-13 15:20:50 +0100 |
---|---|---|
committer | Jakub Hampl <kopomir@gmail.com> | 2018-07-13 15:20:50 +0100 |
commit | cc6d143dd8124e13059c26125e70237795e9a9a4 (patch) | |
tree | e7d6a658990046b672bb59e6d97912e26b5fe057 /src/js/main.js | |
parent | 181401c4ffd06c127c57e27e2e88b05f7fdd1f88 (diff) |
Clean up various messes
Diffstat (limited to 'src/js/main.js')
-rw-r--r-- | src/js/main.js | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/js/main.js b/src/js/main.js index 3d70e9b..ce720ca 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -7,7 +7,8 @@ function wrapElmApplication(elmApp, settings = {}) { incomingPort: "elmMapboxIncoming", easingFunctions: { linear: t => t - } + }, + onMount() {} }, settings ); @@ -223,7 +224,7 @@ function wrapElmApplication(elmApp, settings = {}) { } _createMapInstance() { - let options = { + let mapOptions = { container: this, style: this._style, minZoom: this._minZoom || 0, @@ -236,18 +237,18 @@ function wrapElmApplication(elmApp, settings = {}) { renderWorldCopies: this._renderWorldCopies }; if (this._center) { - options.center = this._center; + mapOptions.center = this._center; } if (this._zoom) { - options.zoom = this._zoom; + mapOptions.zoom = this._zoom; } if (this._bearing) { - options.bearing = this._bearing; + mapOptions.bearing = this._bearing; } if (this._pitch) { - options.pitch = this._pitch; + mapOptions.pitch = this._pitch; } - this._map = new mapboxgl.Map(options); + this._map = new mapboxgl.Map(mapOptions); Object.entries(this._eventRegistrationQueue).forEach( ([type, listeners]) => { @@ -257,6 +258,7 @@ function wrapElmApplication(elmApp, settings = {}) { } ); this._eventRegistrationQueue = {}; + options.onMount(this._map, this); return this._map; } |