Fix calling Overlay.panIntoView with no options
* API-doc said undefined is OK, code assumed an object
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user