Skip to content

Commit

Permalink
stop dashes from sliding along lines, fix #2039
Browse files Browse the repository at this point in the history
  • Loading branch information
ansis committed Feb 2, 2016
1 parent 1323394 commit 1ceacd9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions js/render/draw_line.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,13 @@ module.exports = function drawLine(painter, source, layer, coords) {

gl.setPosMatrix(posMatrix);
gl.setExMatrix(painter.transform.exMatrix);
var zoom = painter.transform.zoom;
var ratio = 1 / tile.pixelsToTileUnits(1, zoom);
var ratio = 1 / tile.pixelsToTileUnits(1, painter.transform.zoom);

if (dasharray) {
var widthA = posA.width * dasharray.fromScale;
var widthB = posB.width * dasharray.toScale;
var scaleA = [1 / tile.pixelsToTileUnits(widthA, zoom), -posA.height / 2];
var scaleB = [1 / tile.pixelsToTileUnits(widthB, zoom), -posB.height / 2];
var scaleA = [1 / tile.pixelsToTileUnits(widthA, painter.transform.tileZoom), -posA.height / 2];
var scaleB = [1 / tile.pixelsToTileUnits(widthB, painter.transform.tileZoom), -posB.height / 2];
var gamma = painter.lineAtlas.width / (Math.min(widthA, widthB) * 256 * browser.devicePixelRatio) / 2;
gl.uniform1f(shader.u_ratio, ratio);
gl.uniform2fv(shader.u_patternscale_a, scaleA);
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#bd74e2c8aef40651f5fcc9d5544b89b6707787ae",
"mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#7815cccb8ab2ad960c0d876f2e3abc40ecdda291",
"prova": "^2.1.2",
"sinon": "^1.15.4",
"st": "^1.0.0",
Expand Down

0 comments on commit 1ceacd9

Please sign in to comment.