diff --git a/src/ol/Overlay.js b/src/ol/Overlay.js index e3387e71b8..12245077c6 100644 --- a/src/ol/Overlay.js +++ b/src/ol/Overlay.js @@ -408,10 +408,10 @@ class Overlay extends BaseObject { /** * Pan the map so that the overlay is entirely visible in the current viewport * (if necessary). - * @param {PanIntoViewOptions|undefined} panIntoViewOptions Options for the pan action + * @param {PanIntoViewOptions|undefined} opt_panIntoViewOptions Options for the pan action * @api */ - panIntoView(panIntoViewOptions) { + panIntoView(opt_panIntoViewOptions) { const map = this.getMap(); if (!map || !map.getTargetElement() || !this.get(Property.POSITION)) { @@ -425,6 +425,8 @@ class Overlay extends BaseObject { outerHeight(element), ]); + const panIntoViewOptions = opt_panIntoViewOptions || {}; + const myMargin = panIntoViewOptions.margin === undefined ? 20 : panIntoViewOptions.margin; if (!containsExtent(mapRect, overlayRect)) {