ol 10.6.2-dev.1753710948374 → 10.6.2-dev.1753864148401

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,6 +23,11 @@ export type Options = {
23
23
  * extent of the view projection is used.
24
24
  */
25
25
  extent?: import("../extent.js").Extent | undefined;
26
+ /**
27
+ * Options to pass to the view when fitting
28
+ * the extent (e.g. `padding`, `duration`, `minResolution`, `maxZoom`, `easing`, `callback`).
29
+ */
30
+ fitOptions?: import("../View.js").FitOptions | undefined;
26
31
  };
27
32
  /**
28
33
  * @typedef {Object} Options
@@ -34,6 +39,8 @@ export type Options = {
34
39
  * @property {string} [tipLabel='Fit to extent'] Text label to use for the button tip.
35
40
  * @property {import("../extent.js").Extent} [extent] The extent to zoom to. If undefined the validity
36
41
  * extent of the view projection is used.
42
+ * @property {import("../View.js").FitOptions} [fitOptions] Options to pass to the view when fitting
43
+ * the extent (e.g. `padding`, `duration`, `minResolution`, `maxZoom`, `easing`, `callback`).
37
44
  */
38
45
  /**
39
46
  * @classdesc
@@ -52,6 +59,11 @@ declare class ZoomToExtent extends Control {
52
59
  * @protected
53
60
  */
54
61
  protected extent: (import("../extent.js").Extent | null) | null;
62
+ /**
63
+ * @type {import("../View.js").FitOptions}
64
+ * @protected
65
+ */
66
+ protected fitOptions: import("../View.js").FitOptions;
55
67
  /**
56
68
  * @param {MouseEvent} event The event to handle
57
69
  * @private
@@ -1 +1 @@
1
- {"version":3,"file":"ZoomToExtent.d.ts","sourceRoot":"","sources":["ZoomToExtent.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AASA;;;;;;;;;;GAUG;AAEH;;;;;;GAMG;AACH;IACE;;OAEG;IACH,sBAFW,OAAO,EAwCjB;IA9BC;;;OAGG;IACH,kBAHU,CAAC,OAAO,cAAc,EAAE,MAAM,GAAC,IAAI,QAAA,CAGO;IA4BtD;;;OAGG;IACH,qBAGC;IAED;;OAEG;IACH,qCAOC;CACF;oBArFmB,cAAc"}
1
+ {"version":3,"file":"ZoomToExtent.d.ts","sourceRoot":"","sources":["ZoomToExtent.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA;;;;;;;;;;;;GAYG;AAEH;;;;;;GAMG;AACH;IACE;;OAEG;IACH,sBAFW,OAAO,EA8CjB;IApCC;;;OAGG;IACH,kBAHU,CAAC,OAAO,cAAc,EAAE,MAAM,GAAC,IAAI,QAAA,CAGO;IAEpD;;;OAGG;IACH,sBAHU,OAAO,YAAY,EAAE,UAAU,CAGC;IA4B5C;;;OAGG;IACH,qBAGC;IAED;;OAEG;IACH,qCAQC;CACF;oBA9FmB,cAAc"}
@@ -17,6 +17,8 @@ import Control from './Control.js';
17
17
  * @property {string} [tipLabel='Fit to extent'] Text label to use for the button tip.
18
18
  * @property {import("../extent.js").Extent} [extent] The extent to zoom to. If undefined the validity
19
19
  * extent of the view projection is used.
20
+ * @property {import("../View.js").FitOptions} [fitOptions] Options to pass to the view when fitting
21
+ * the extent (e.g. `padding`, `duration`, `minResolution`, `maxZoom`, `easing`, `callback`).
20
22
  */
21
23
 
22
24
  /**
@@ -44,6 +46,12 @@ class ZoomToExtent extends Control {
44
46
  */
45
47
  this.extent = options.extent ? options.extent : null;
46
48
 
49
+ /**
50
+ * @type {import("../View.js").FitOptions}
51
+ * @protected
52
+ */
53
+ this.fitOptions = options.fitOptions || {};
54
+
47
55
  const className =
48
56
  options.className !== undefined ? options.className : 'ol-zoom-extent';
49
57
 
@@ -88,7 +96,8 @@ class ZoomToExtent extends Control {
88
96
  const extent = !this.extent
89
97
  ? view.getProjection().getExtent()
90
98
  : fromUserExtent(this.extent, view.getProjection());
91
- view.fitInternal(polygonFromExtent(extent));
99
+
100
+ view.fitInternal(polygonFromExtent(extent), this.fitOptions);
92
101
  }
93
102
  }
94
103