Skip to content

Commit

Permalink
Issue an error when map canvas is larger than allowed by gl.MAX_RENDE…
Browse files Browse the repository at this point in the history
…RBUFFER_SIZE mapbox#2893
  • Loading branch information
stepankuzmin committed Dec 20, 2016
1 parent 9bb6de3 commit c14d390
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions js/ui/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,15 @@ class Map extends Camera {
return;
}

const MAX_RENDERBUFFER_SIZE = gl.MAX_RENDERBUFFER_SIZE / 2;
if (this._canvas.width > MAX_RENDERBUFFER_SIZE ||
this._canvas.height > MAX_RENDERBUFFER_SIZE) {
this.fire('error', {
error: new Error('Map canvas is larger than allowed by gl.MAX_RENDERBUFFER_SIZE')
});
return;
}

this.painter = new Painter(gl, this.transform);
}

Expand Down

0 comments on commit c14d390

Please sign in to comment.