Skip to content

Commit

Permalink
Do not optimize lines away entirely
Browse files Browse the repository at this point in the history
  • Loading branch information
ahocevar committed Jun 23, 2016
1 parent 3726b25 commit 35129af
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ol/render/canvas/canvasreplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ ol.render.canvas.Replay.prototype.replay_ = function(
y = pixelCoordinates[d + 1];
roundX = (x + 0.5) | 0;
roundY = (y + 0.5) | 0;
if (roundX !== prevX || roundY !== prevY) {
if (d == dd - 2 || roundX !== prevX || roundY !== prevY) {
context.lineTo(x, y);
prevX = roundX;
prevY = roundY;
Expand Down
Binary file modified test_rendering/spec/ol/layer/expected/vector-canvas.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions test_rendering/spec/ol/layer/vector.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ describe('ol.rendering.layer.Vector', function() {

it('renders correctly with the canvas renderer', function(done) {
map = createMap('canvas');
var smallLine = new ol.Feature(new ol.geom.LineString([
[center[0], center[1] - 1],
[center[0], center[1] + 1]
]));
smallLine.setStyle(new ol.style.Style({
zIndex: -99,
stroke: new ol.style.Stroke({width: 75, color: 'red'})
}));
source.addFeature(smallLine);
addPolygon(100);
addCircle(200);
addPolygon(250);
Expand Down

0 comments on commit 35129af

Please sign in to comment.