Don't create Polygon with null coordinates
This commit is contained in:
@@ -40,9 +40,6 @@ function addInteraction() {
|
|||||||
} else if (value === 'Star') {
|
} else if (value === 'Star') {
|
||||||
value = 'Circle';
|
value = 'Circle';
|
||||||
geometryFunction = function(coordinates, geometry) {
|
geometryFunction = function(coordinates, geometry) {
|
||||||
if (!geometry) {
|
|
||||||
geometry = new Polygon(null);
|
|
||||||
}
|
|
||||||
const center = coordinates[0];
|
const center = coordinates[0];
|
||||||
const last = coordinates[1];
|
const last = coordinates[1];
|
||||||
const dx = center[0] - last[0];
|
const dx = center[0] - last[0];
|
||||||
@@ -59,7 +56,11 @@ function addInteraction() {
|
|||||||
newCoordinates.push([center[0] + offsetX, center[1] + offsetY]);
|
newCoordinates.push([center[0] + offsetX, center[1] + offsetY]);
|
||||||
}
|
}
|
||||||
newCoordinates.push(newCoordinates[0].slice());
|
newCoordinates.push(newCoordinates[0].slice());
|
||||||
geometry.setCoordinates([newCoordinates]);
|
if (!geometry) {
|
||||||
|
geometry = new Polygon([newCoordinates]);
|
||||||
|
} else {
|
||||||
|
geometry.setCoordinates([newCoordinates]);
|
||||||
|
}
|
||||||
return geometry;
|
return geometry;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user