diff --git a/config/jsdoc/api/index.md b/config/jsdoc/api/index.md
index 7f8855863b..c13118ca76 100644
--- a/config/jsdoc/api/index.md
+++ b/config/jsdoc/api/index.md
@@ -37,7 +37,7 @@
@@ -46,7 +46,7 @@
Interactions
-
Map default interactions
+
Map default interactions
Interactions for
vector features
- ol/interaction/Select
- ol/interaction/Draw
diff --git a/config/jsdoc/api/template/tmpl/method.tmpl b/config/jsdoc/api/template/tmpl/method.tmpl
index 509d6e0057..4fdd023627 100644
--- a/config/jsdoc/api/template/tmpl/method.tmpl
+++ b/config/jsdoc/api/template/tmpl/method.tmpl
@@ -34,8 +34,9 @@ if (/-dev$/.test(version)) {
-
-
-
import {} from '';
+
+
+ import from '';
diff --git a/src/ol/Map.js b/src/ol/Map.js
index 19c80b6a50..b0b47b2493 100644
--- a/src/ol/Map.js
+++ b/src/ol/Map.js
@@ -34,8 +34,8 @@ import {
getForViewAndSize,
isEmpty,
} from './extent.js';
-import {defaults as defaultControls} from './control.js';
-import {defaults as defaultInteractions} from './interaction.js';
+import {defaults as defaultControls} from './control/defaults.js';
+import {defaults as defaultInteractions} from './interaction/defaults.js';
import {fromUserCoordinate, toUserCoordinate} from './proj.js';
import {getUid} from './util.js';
import {hasArea} from './size.js';
@@ -115,12 +115,12 @@ import {removeNode} from './dom.js';
* @typedef {Object} MapOptions
* @property {Collection|Array} [controls]
* Controls initially added to the map. If not specified,
- * {@link module:ol/control.defaults} is used.
+ * {@link module:ol/control/defaults.defaults} is used.
* @property {number} [pixelRatio=window.devicePixelRatio] The ratio between
* physical pixels and device-independent pixels (dips) on the device.
* @property {Collection|Array} [interactions]
* Interactions that are initially added to the map. If not specified,
- * {@link module:ol/interaction.defaults} is used.
+ * {@link module:ol/interaction/defaults.defaults} is used.
* @property {HTMLElement|Document|string} [keyboardEventTarget] The element to
* listen to keyboard events on. This determines when the `KeyboardPan` and
* `KeyboardZoom` interactions trigger. For example, if this option is set to
diff --git a/src/ol/control.js b/src/ol/control.js
index 847109d3e0..7d08a03457 100644
--- a/src/ol/control.js
+++ b/src/ol/control.js
@@ -1,11 +1,6 @@
/**
* @module ol/control
*/
-import Attribution from './control/Attribution.js';
-import Collection from './Collection.js';
-import Rotate from './control/Rotate.js';
-import Zoom from './control/Zoom.js';
-
export {default as Attribution} from './control/Attribution.js';
export {default as Control} from './control/Control.js';
export {default as FullScreen} from './control/FullScreen.js';
@@ -16,58 +11,4 @@ export {default as ScaleLine} from './control/ScaleLine.js';
export {default as Zoom} from './control/Zoom.js';
export {default as ZoomSlider} from './control/ZoomSlider.js';
export {default as ZoomToExtent} from './control/ZoomToExtent.js';
-
-/**
- * @typedef {Object} DefaultsOptions
- * @property {boolean} [attribution=true] Include
- * {@link module:ol/control/Attribution~Attribution}.
- * @property {import("./control/Attribution.js").Options} [attributionOptions]
- * Options for {@link module:ol/control/Attribution~Attribution}.
- * @property {boolean} [rotate=true] Include
- * {@link module:ol/control/Rotate~Rotate}.
- * @property {import("./control/Rotate.js").Options} [rotateOptions] Options
- * for {@link module:ol/control/Rotate~Rotate}.
- * @property {boolean} [zoom] Include {@link module:ol/control/Zoom~Zoom}.
- * @property {import("./control/Zoom.js").Options} [zoomOptions] Options for
- * {@link module:ol/control/Zoom~Zoom}.
- * @api
- */
-
-/**
- * Set of controls included in maps by default. Unless configured otherwise,
- * this returns a collection containing an instance of each of the following
- * controls:
- * * {@link module:ol/control/Zoom~Zoom}
- * * {@link module:ol/control/Rotate~Rotate}
- * * {@link module:ol/control/Attribution~Attribution}
- *
- * @param {DefaultsOptions} [opt_options]
- * Defaults options.
- * @return {Collection}
- * Controls.
- * @api
- */
-export function defaults(opt_options) {
- const options = opt_options ? opt_options : {};
-
- /** @type {Collection} */
- const controls = new Collection();
-
- const zoomControl = options.zoom !== undefined ? options.zoom : true;
- if (zoomControl) {
- controls.push(new Zoom(options.zoomOptions));
- }
-
- const rotateControl = options.rotate !== undefined ? options.rotate : true;
- if (rotateControl) {
- controls.push(new Rotate(options.rotateOptions));
- }
-
- const attributionControl =
- options.attribution !== undefined ? options.attribution : true;
- if (attributionControl) {
- controls.push(new Attribution(options.attributionOptions));
- }
-
- return controls;
-}
+export {defaults} from './control/defaults.js';
diff --git a/src/ol/control/defaults.js b/src/ol/control/defaults.js
new file mode 100644
index 0000000000..2216406b6c
--- /dev/null
+++ b/src/ol/control/defaults.js
@@ -0,0 +1,60 @@
+/**
+ * @module ol/control/defaults
+ */
+import Attribution from './Attribution.js';
+import Collection from '../Collection.js';
+import Rotate from './Rotate.js';
+import Zoom from './Zoom.js';
+
+/**
+ * @typedef {Object} DefaultsOptions
+ * @property {boolean} [attribution=true] Include
+ * {@link module:ol/control/Attribution~Attribution}.
+ * @property {import("./Attribution.js").Options} [attributionOptions]
+ * Options for {@link module:ol/control/Attribution~Attribution}.
+ * @property {boolean} [rotate=true] Include
+ * {@link module:ol/control/Rotate~Rotate}.
+ * @property {import("./Rotate.js").Options} [rotateOptions] Options
+ * for {@link module:ol/control/Rotate~Rotate}.
+ * @property {boolean} [zoom] Include {@link module:ol/control/Zoom~Zoom}.
+ * @property {import("./Zoom.js").Options} [zoomOptions] Options for
+ * {@link module:ol/control/Zoom~Zoom}.
+ */
+
+/**
+ * Set of controls included in maps by default. Unless configured otherwise,
+ * this returns a collection containing an instance of each of the following
+ * controls:
+ * * {@link module:ol/control/Zoom~Zoom}
+ * * {@link module:ol/control/Rotate~Rotate}
+ * * {@link module:ol/control/Attribution~Attribution}
+ *
+ * @param {DefaultsOptions} [opt_options] Options for the default controls.
+ * @return {Collection} A collection of controls
+ * to be used with the {@link module:ol/Map~Map} constructor's `controls` option.
+ * @api
+ */
+export function defaults(opt_options) {
+ const options = opt_options ? opt_options : {};
+
+ /** @type {Collection} */
+ const controls = new Collection();
+
+ const zoomControl = options.zoom !== undefined ? options.zoom : true;
+ if (zoomControl) {
+ controls.push(new Zoom(options.zoomOptions));
+ }
+
+ const rotateControl = options.rotate !== undefined ? options.rotate : true;
+ if (rotateControl) {
+ controls.push(new Rotate(options.rotateOptions));
+ }
+
+ const attributionControl =
+ options.attribution !== undefined ? options.attribution : true;
+ if (attributionControl) {
+ controls.push(new Attribution(options.attributionOptions));
+ }
+
+ return controls;
+}
diff --git a/src/ol/interaction.js b/src/ol/interaction.js
index ffd8a94b3d..a74cd06b8e 100644
--- a/src/ol/interaction.js
+++ b/src/ol/interaction.js
@@ -1,18 +1,6 @@
/**
* @module ol/interaction
*/
-import Collection from './Collection.js';
-import DoubleClickZoom from './interaction/DoubleClickZoom.js';
-import DragPan from './interaction/DragPan.js';
-import DragRotate from './interaction/DragRotate.js';
-import DragZoom from './interaction/DragZoom.js';
-import KeyboardPan from './interaction/KeyboardPan.js';
-import KeyboardZoom from './interaction/KeyboardZoom.js';
-import Kinetic from './Kinetic.js';
-import MouseWheelZoom from './interaction/MouseWheelZoom.js';
-import PinchRotate from './interaction/PinchRotate.js';
-import PinchZoom from './interaction/PinchZoom.js';
-
export {default as DoubleClickZoom} from './interaction/DoubleClickZoom.js';
export {default as DragAndDrop} from './interaction/DragAndDrop.js';
export {default as DragBox} from './interaction/DragBox.js';
@@ -34,137 +22,4 @@ export {default as Pointer} from './interaction/Pointer.js';
export {default as Select} from './interaction/Select.js';
export {default as Snap} from './interaction/Snap.js';
export {default as Translate} from './interaction/Translate.js';
-
-/**
- * @typedef {Object} DefaultsOptions
- * @property {boolean} [altShiftDragRotate=true] Whether Alt-Shift-drag rotate is
- * desired.
- * @property {boolean} [onFocusOnly=false] Interact only when the map has the
- * focus. This affects the `MouseWheelZoom` and `DragPan` interactions and is
- * useful when page scroll is desired for maps that do not have the browser's
- * focus.
- * @property {boolean} [doubleClickZoom=true] Whether double click zoom is
- * desired.
- * @property {boolean} [keyboard=true] Whether keyboard interaction is desired.
- * @property {boolean} [mouseWheelZoom=true] Whether mousewheel zoom is desired.
- * @property {boolean} [shiftDragZoom=true] Whether Shift-drag zoom is desired.
- * @property {boolean} [dragPan=true] Whether drag pan is desired.
- * @property {boolean} [pinchRotate=true] Whether pinch rotate is desired.
- * @property {boolean} [pinchZoom=true] Whether pinch zoom is desired.
- * @property {number} [zoomDelta] Zoom level delta when using keyboard or double click zoom.
- * @property {number} [zoomDuration] Duration of the zoom animation in
- * milliseconds.
- */
-
-/**
- * Set of interactions included in maps by default. Specific interactions can be
- * excluded by setting the appropriate option to false in the constructor
- * options, but the order of the interactions is fixed. If you want to specify
- * a different order for interactions, you will need to create your own
- * {@link module:ol/interaction/Interaction~Interaction} instances and insert
- * them into a {@link module:ol/Collection~Collection} in the order you want
- * before creating your {@link module:ol/Map~Map} instance. Changing the order can
- * be of interest if the event propagation needs to be stopped at a point.
- * The default set of interactions, in sequence, is:
- * * {@link module:ol/interaction/DragRotate~DragRotate}
- * * {@link module:ol/interaction/DoubleClickZoom~DoubleClickZoom}
- * * {@link module:ol/interaction/DragPan~DragPan}
- * * {@link module:ol/interaction/PinchRotate~PinchRotate}
- * * {@link module:ol/interaction/PinchZoom~PinchZoom}
- * * {@link module:ol/interaction/KeyboardPan~KeyboardPan}
- * * {@link module:ol/interaction/KeyboardZoom~KeyboardZoom}
- * * {@link module:ol/interaction/MouseWheelZoom~MouseWheelZoom}
- * * {@link module:ol/interaction/DragZoom~DragZoom}
- *
- * @param {DefaultsOptions} [opt_options] Defaults options.
- * @return {import("./Collection.js").default}
- * A collection of interactions to be used with the {@link module:ol/Map~Map}
- * constructor's `interactions` option.
- * @api
- */
-export function defaults(opt_options) {
- const options = opt_options ? opt_options : {};
-
- /** @type {Collection} */
- const interactions = new Collection();
-
- const kinetic = new Kinetic(-0.005, 0.05, 100);
-
- const altShiftDragRotate =
- options.altShiftDragRotate !== undefined
- ? options.altShiftDragRotate
- : true;
- if (altShiftDragRotate) {
- interactions.push(new DragRotate());
- }
-
- const doubleClickZoom =
- options.doubleClickZoom !== undefined ? options.doubleClickZoom : true;
- if (doubleClickZoom) {
- interactions.push(
- new DoubleClickZoom({
- delta: options.zoomDelta,
- duration: options.zoomDuration,
- })
- );
- }
-
- const dragPan = options.dragPan !== undefined ? options.dragPan : true;
- if (dragPan) {
- interactions.push(
- new DragPan({
- onFocusOnly: options.onFocusOnly,
- kinetic: kinetic,
- })
- );
- }
-
- const pinchRotate =
- options.pinchRotate !== undefined ? options.pinchRotate : true;
- if (pinchRotate) {
- interactions.push(new PinchRotate());
- }
-
- const pinchZoom = options.pinchZoom !== undefined ? options.pinchZoom : true;
- if (pinchZoom) {
- interactions.push(
- new PinchZoom({
- duration: options.zoomDuration,
- })
- );
- }
-
- const keyboard = options.keyboard !== undefined ? options.keyboard : true;
- if (keyboard) {
- interactions.push(new KeyboardPan());
- interactions.push(
- new KeyboardZoom({
- delta: options.zoomDelta,
- duration: options.zoomDuration,
- })
- );
- }
-
- const mouseWheelZoom =
- options.mouseWheelZoom !== undefined ? options.mouseWheelZoom : true;
- if (mouseWheelZoom) {
- interactions.push(
- new MouseWheelZoom({
- onFocusOnly: options.onFocusOnly,
- duration: options.zoomDuration,
- })
- );
- }
-
- const shiftDragZoom =
- options.shiftDragZoom !== undefined ? options.shiftDragZoom : true;
- if (shiftDragZoom) {
- interactions.push(
- new DragZoom({
- duration: options.zoomDuration,
- })
- );
- }
-
- return interactions;
-}
+export {defaults} from './interaction/defaults.js';
diff --git a/src/ol/interaction/defaults.js b/src/ol/interaction/defaults.js
new file mode 100644
index 0000000000..c9e7e3dd7f
--- /dev/null
+++ b/src/ol/interaction/defaults.js
@@ -0,0 +1,148 @@
+/**
+ * @module ol/interaction/defaults
+ */
+import Collection from '../Collection.js';
+import DoubleClickZoom from './DoubleClickZoom.js';
+import DragPan from './DragPan.js';
+import DragRotate from './DragRotate.js';
+import DragZoom from './DragZoom.js';
+import KeyboardPan from './KeyboardPan.js';
+import KeyboardZoom from './KeyboardZoom.js';
+import Kinetic from '../Kinetic.js';
+import MouseWheelZoom from './MouseWheelZoom.js';
+import PinchRotate from './PinchRotate.js';
+import PinchZoom from './PinchZoom.js';
+
+/**
+ * @typedef {Object} DefaultsOptions
+ * @property {boolean} [altShiftDragRotate=true] Whether Alt-Shift-drag rotate is
+ * desired.
+ * @property {boolean} [onFocusOnly=false] Interact only when the map has the
+ * focus. This affects the `MouseWheelZoom` and `DragPan` interactions and is
+ * useful when page scroll is desired for maps that do not have the browser's
+ * focus.
+ * @property {boolean} [doubleClickZoom=true] Whether double click zoom is
+ * desired.
+ * @property {boolean} [keyboard=true] Whether keyboard interaction is desired.
+ * @property {boolean} [mouseWheelZoom=true] Whether mousewheel zoom is desired.
+ * @property {boolean} [shiftDragZoom=true] Whether Shift-drag zoom is desired.
+ * @property {boolean} [dragPan=true] Whether drag pan is desired.
+ * @property {boolean} [pinchRotate=true] Whether pinch rotate is desired.
+ * @property {boolean} [pinchZoom=true] Whether pinch zoom is desired.
+ * @property {number} [zoomDelta] Zoom level delta when using keyboard or double click zoom.
+ * @property {number} [zoomDuration] Duration of the zoom animation in
+ * milliseconds.
+ */
+
+/**
+ * Set of interactions included in maps by default. Specific interactions can be
+ * excluded by setting the appropriate option to false in the constructor
+ * options, but the order of the interactions is fixed. If you want to specify
+ * a different order for interactions, you will need to create your own
+ * {@link module:ol/interaction/Interaction~Interaction} instances and insert
+ * them into a {@link module:ol/Collection~Collection} in the order you want
+ * before creating your {@link module:ol/Map~Map} instance. Changing the order can
+ * be of interest if the event propagation needs to be stopped at a point.
+ * The default set of interactions, in sequence, is:
+ * * {@link module:ol/interaction/DragRotate~DragRotate}
+ * * {@link module:ol/interaction/DoubleClickZoom~DoubleClickZoom}
+ * * {@link module:ol/interaction/DragPan~DragPan}
+ * * {@link module:ol/interaction/PinchRotate~PinchRotate}
+ * * {@link module:ol/interaction/PinchZoom~PinchZoom}
+ * * {@link module:ol/interaction/KeyboardPan~KeyboardPan}
+ * * {@link module:ol/interaction/KeyboardZoom~KeyboardZoom}
+ * * {@link module:ol/interaction/MouseWheelZoom~MouseWheelZoom}
+ * * {@link module:ol/interaction/DragZoom~DragZoom}
+ *
+ * @param {DefaultsOptions} [opt_options] Defaults options.
+ * @return {Collection}
+ * A collection of interactions to be used with the {@link module:ol/Map~Map}
+ * constructor's `interactions` option.
+ * @api
+ */
+export function defaults(opt_options) {
+ const options = opt_options ? opt_options : {};
+
+ /** @type {Collection} */
+ const interactions = new Collection();
+
+ const kinetic = new Kinetic(-0.005, 0.05, 100);
+
+ const altShiftDragRotate =
+ options.altShiftDragRotate !== undefined
+ ? options.altShiftDragRotate
+ : true;
+ if (altShiftDragRotate) {
+ interactions.push(new DragRotate());
+ }
+
+ const doubleClickZoom =
+ options.doubleClickZoom !== undefined ? options.doubleClickZoom : true;
+ if (doubleClickZoom) {
+ interactions.push(
+ new DoubleClickZoom({
+ delta: options.zoomDelta,
+ duration: options.zoomDuration,
+ })
+ );
+ }
+
+ const dragPan = options.dragPan !== undefined ? options.dragPan : true;
+ if (dragPan) {
+ interactions.push(
+ new DragPan({
+ onFocusOnly: options.onFocusOnly,
+ kinetic: kinetic,
+ })
+ );
+ }
+
+ const pinchRotate =
+ options.pinchRotate !== undefined ? options.pinchRotate : true;
+ if (pinchRotate) {
+ interactions.push(new PinchRotate());
+ }
+
+ const pinchZoom = options.pinchZoom !== undefined ? options.pinchZoom : true;
+ if (pinchZoom) {
+ interactions.push(
+ new PinchZoom({
+ duration: options.zoomDuration,
+ })
+ );
+ }
+
+ const keyboard = options.keyboard !== undefined ? options.keyboard : true;
+ if (keyboard) {
+ interactions.push(new KeyboardPan());
+ interactions.push(
+ new KeyboardZoom({
+ delta: options.zoomDelta,
+ duration: options.zoomDuration,
+ })
+ );
+ }
+
+ const mouseWheelZoom =
+ options.mouseWheelZoom !== undefined ? options.mouseWheelZoom : true;
+ if (mouseWheelZoom) {
+ interactions.push(
+ new MouseWheelZoom({
+ onFocusOnly: options.onFocusOnly,
+ duration: options.zoomDuration,
+ })
+ );
+ }
+
+ const shiftDragZoom =
+ options.shiftDragZoom !== undefined ? options.shiftDragZoom : true;
+ if (shiftDragZoom) {
+ interactions.push(
+ new DragZoom({
+ duration: options.zoomDuration,
+ })
+ );
+ }
+
+ return interactions;
+}