Merge pull request #7537 from walkermatt/removeLastPoint
Fix Draw.removeLastPoint exception when no points to remove
This commit is contained in:
@@ -168,7 +168,12 @@ ol.interaction.Draw = function(options) {
|
||||
var geometry = opt_geometry;
|
||||
if (geometry) {
|
||||
if (mode === ol.interaction.Draw.Mode_.POLYGON) {
|
||||
geometry.setCoordinates([coordinates[0].concat([coordinates[0][0]])]);
|
||||
if (coordinates[0].length) {
|
||||
// Add a closing coordinate to match the first
|
||||
geometry.setCoordinates([coordinates[0].concat([coordinates[0][0]])]);
|
||||
} else {
|
||||
geometry.setCoordinates([]);
|
||||
}
|
||||
} else {
|
||||
geometry.setCoordinates(coordinates);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user