Fix calling Overlay.panIntoView with no options

* API-doc said undefined is OK, code assumed an object
This commit is contained in:
Edward Nash
2020-04-16 16:25:01 +02:00
parent 12043e147c
commit 17a8017e1e

View File

@@ -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)) {