diff --git a/types/ol/interaction/extent.d.ts b/types/ol/interaction/extent.d.ts new file mode 100644 index 0000000000..43c69756e3 --- /dev/null +++ b/types/ol/interaction/extent.d.ts @@ -0,0 +1,3 @@ +import * as ol from 'openlayers'; + +export default ol.interaction.Extent; diff --git a/types/openlayers/index.d.ts b/types/openlayers/index.d.ts index b0356122e4..d7eddc312d 100644 --- a/types/openlayers/index.d.ts +++ b/types/openlayers/index.d.ts @@ -5349,6 +5349,76 @@ export namespace interaction { static createRegularPolygon(opt_sides?: number, opt_angle?: number): ol.DrawGeometryFunctionType; } + namespace Extent { + /** + * @classdesc + * Events emitted by {@link ol.interaction.Extent} instances are instances of + * this type. + * + * @param extent the new extent + */ + class Event extends events.Event { + /** + * @classdesc + * Events emitted by {@link ol.interaction.Extent} instances are instances of + * this type. + * + * @param type Type. + * @param feature The feature drawn. + */ + constructor(type: ExtentEventType, extent: ol.Extent); + + /** + * The current extent. + * @api stable + */ + extent: ol.Extent; + } + } + + type ExtentEventType = string; + + /** + * @classdesc + * Interaction for drawing feature geometries. + * + * @fires ol.interaction.DrawEvent + * @param options Options. + * @api stable + */ + class Extent extends Pointer { + /** + * @classdesc + * Interaction for drawing feature geometries. + * + * @fires ol.interaction.DrawEvent + * @param options Options. + * @api stable + */ + constructor(options: olx.interaction.ExtentOptions); + + /** + * @inheritDoc + */ + setMap(map: ol.Map): void; + + /** + * Returns the current drawn extent in the view projection + * + * @return Drawn extent in the view projection. + * @api + */ + getExtent(): ol.Extent; + + /** + * Manually sets the drawn extent, using the view projection. + * + * @param extent Extent + * @api + */ + setExtent(extent: ol.Extent): void; + } + /** * Set of interactions included in maps by default. Specific interactions can be * excluded by setting the appropriate option to false in the constructor @@ -11788,6 +11858,14 @@ export namespace olx { wrapX?: boolean; } + interface ExtentOptions { + extent?: ol.Extent; + boxStyle?: (ol.style.Style | ol.style.Style[] | ol.StyleFunction); + pixelTolerance?: number; + pointerStyle?: (ol.style.Style | ol.style.Style[] | ol.StyleFunction); + wrapX?: boolean; + } + interface TranslateOptions { features?: ol.Collection; layers?: (ol.layer.Layer[] | ((layer: ol.layer.Layer) => boolean));