diff --git a/types/openlayers/index.d.ts b/types/openlayers/index.d.ts index 2b721ab7ca..e863a28ad3 100644 --- a/types/openlayers/index.d.ts +++ b/types/openlayers/index.d.ts @@ -5255,6 +5255,15 @@ declare module ol { */ extend(feature: ol.Feature): void; + /** + * Create a `geometryFunction` that will create a box-shaped polygon (aligned + * with the coordinate system axes). Use this with the draw interaction and + * `type: 'Circle'` to return a box instead of a circle geometry. + * @return {ol.DrawGeometryFunctionType} Function that draws a box-shaped polygon. + * @api + */ + static createBox(): ol.DrawGeometryFunctionType; + /** * Create a `geometryFunction` for `mode: 'Circle'` that will create a regular * polygon with a user specified number of sides and start angle instead of an diff --git a/types/openlayers/openlayers-tests.ts b/types/openlayers/openlayers-tests.ts index ca74a6bbc2..01d12bf1b6 100644 --- a/types/openlayers/openlayers-tests.ts +++ b/types/openlayers/openlayers-tests.ts @@ -662,6 +662,12 @@ draw = new ol.interaction.Draw({ type: "Point", style: styleFunctionAsStyle }); +ol.interaction.Draw.createBox(); +ol.interaction.Draw.createRegularPolygon(); +ol.interaction.Draw.createRegularPolygon(4); +ol.interaction.Draw.createRegularPolygon(4,0); + + let styleFunctionAsArray = function(feature: ol.Feature, resolution: number): ol.style.Style[] { return styleArray; } draw = new ol.interaction.Draw({ type: "Point",