Merge pull request #1623 from elemoine/1623

ol.interaction.DragBox.getGeometry returns non-closed polygon
This commit is contained in:
Éric Lemoine
2014-02-04 22:10:11 -08:00
+7 -7
View File
@@ -69,15 +69,15 @@ ol.render.Box.prototype.createGeometry_ = function() {
var startPixel = this.startPixel_; var startPixel = this.startPixel_;
var endPixel = this.endPixel_; var endPixel = this.endPixel_;
var pixels = [ var pixels = [
[ startPixel,
startPixel, [startPixel[0], endPixel[1]],
[startPixel[0], endPixel[1]], endPixel,
endPixel, [endPixel[0], startPixel[1]]
[endPixel[0], startPixel[1]]
]
]; ];
var coordinates = goog.array.map(pixels[0], var coordinates = goog.array.map(pixels,
this.map_.getCoordinateFromPixel, this.map_); this.map_.getCoordinateFromPixel, this.map_);
// close the polygon
coordinates[4] = coordinates[0].slice();
return new ol.geom.Polygon([coordinates]); return new ol.geom.Polygon([coordinates]);
}; };