diff --git a/examples/mapbox-layer.js b/examples/mapbox-layer.js index 0ea4f79824..5612fbc6a9 100644 --- a/examples/mapbox-layer.js +++ b/examples/mapbox-layer.js @@ -56,6 +56,7 @@ class Mapbox extends Layer { }); this.mbmap = new mapboxgl.Map(options); + this.mbmap.on('load', function() { this.mbmap.getCanvas().remove(); this.loaded = true; @@ -134,38 +135,6 @@ class Mapbox extends Layer { } -mapboxgl.Map.prototype._setupContainer = function _setupContainer() { - const container = this._container; - container.classList.add('mapboxgl-map'); - - const canvasContainer = this._canvasContainer = container.firstChild; - - this._canvas = document.createElement('canvas'); - canvasContainer.insertBefore(this._canvas, canvasContainer.firstChild); - this._canvas.style.position = 'absolute'; - this._canvas.addEventListener('webglcontextlost', this._contextLost, false); - this._canvas.addEventListener('webglcontextrestored', this._contextRestored, false); - this._canvas.setAttribute('tabindex', '0'); - this._canvas.setAttribute('aria-label', 'Map'); - this._canvas.className = 'mapboxgl-canvas'; - - const dimensions = this._containerDimensions(); - this._resizeCanvas(dimensions[0], dimensions[1]); - - this._controlContainer = canvasContainer; - const controlContainer = this._controlContainer = document.createElement('div'); - controlContainer.className = 'mapboxgl-control-container'; - container.appendChild(controlContainer); - - const positions = this._controlPositions = {}; - ['top-left', 'top-right', 'bottom-left', 'bottom-right'].forEach(function(positionName) { - const elem = document.createElement('div'); - elem.className = 'mapboxgl-ctrl-' + positionName; - controlContainer.appendChild(elem); - positions[positionName] = elem; - }); -}; - const style = new Style({ stroke: new Stroke({ color: '#319FD3',