Always close polygon rings

This ensures that we do not optimize away the last vertex of a polygon
This commit is contained in:
Andreas Hocevar
2016-09-01 16:19:41 +02:00
parent 11e4675337
commit 6e0b406c7b

View File

@@ -89,10 +89,8 @@ ol.render.canvas.PolygonReplay.prototype.drawFlatCoordinatess_ = function(flatCo
for (var i = 0; i < numEnds; ++i) {
var end = ends[i];
var myBegin = this.coordinates.length;
var myEnd = this.appendFlatCoordinates(flatCoordinates, offset, end, stride,
// Performance optimization: only close the ring when we do not have a
// stroke. Otherwise closePath() will take care of that.
!stroke);
var myEnd = this.appendFlatCoordinates(
flatCoordinates, offset, end, stride, true);
var moveToLineToInstruction =
[ol.render.canvas.Instruction.MOVE_TO_LINE_TO, myBegin, myEnd];
this.instructions.push(moveToLineToInstruction);