Skip to content

Commit

Permalink
fix #2034, fix tile debug rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
ansis committed Feb 6, 2016
1 parent 614bebe commit ec442fa
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
8 changes: 4 additions & 4 deletions js/render/draw_debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ var browser = require('../util/browser');

module.exports = drawDebug;

function drawDebug(painter, coords) {
function drawDebug(painter, source, coords) {
if (painter.isOpaquePass) return;
if (!painter.options.debug) return;

for (var i = 0; i < coords.length; i++) {
drawDebugTile(painter, coords[i]);
drawDebugTile(painter, source, coords[i]);
}
}

function drawDebugTile(painter, coord) {
function drawDebugTile(painter, source, coord) {
var gl = painter.gl;

var shader = painter.debugShader;
gl.switchShader(shader, painter.calculatePosMatrix(coord));
gl.switchShader(shader, painter.calculatePosMatrix(coord, source.maxzoom));

// draw bounding rectangle
gl.bindBuffer(gl.ARRAY_BUFFER, painter.debugBuffer);
Expand Down
4 changes: 3 additions & 1 deletion js/render/painter.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,9 @@ Painter.prototype.renderPass = function(options) {
this.renderLayer(this, source, layer, coords);
}

draw.debug(this, coords);
if (source) {
draw.debug(this, source, coords);
}
}
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"eslint": "^1.5.0",
"eslint-config-mourner": "^1.0.0",
"istanbul": "^0.4.1",
"mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#3fe57d5b2c885f758cc7667dbcce14a214b790e0",
"mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#ff214a62ba73fd64defffc40bffa3a2dfb7b2b55",
"prova": "^2.1.2",
"sinon": "^1.15.4",
"st": "^1.0.0",
Expand Down
3 changes: 3 additions & 0 deletions test/render.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ suite.run('js', {tests: tests}, function(style, options, callback) {
attributionControl: false
});

if (options.debug) map.debug = true;
if (options.collisionDebug) map.collisionDebug = true;

var gl = map.painter.gl;

map.once('load', function() {
Expand Down

0 comments on commit ec442fa

Please sign in to comment.