Add check that Position is set in panIntoView()

* If panIntoView is an API method, it may now be called when the
   position of the overlay has not yet been set.

 * Adds a check for a set position to the panIntoView() method,
   and removes the now unneccessary check in handlePositionChanged()
This commit is contained in:
Edward Nash
2020-03-30 07:15:03 +02:00
parent b1b01cf943
commit 2537da690a

View File

@@ -328,9 +328,7 @@ class Overlay extends BaseObject {
*/
handlePositionChanged() {
this.updatePixelPosition();
if (this.get(Property.POSITION) && this.autoPan) {
this.performAutoPan();
}
this.performAutoPan();
}
/**
@@ -403,7 +401,7 @@ class Overlay extends BaseObject {
panIntoView(panIntoViewOptions) {
const map = this.getMap();
if (!map || !map.getTargetElement()) {
if (!map || !map.getTargetElement() || !this.get(Property.POSITION)) {
return;
}