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
+1 -3
View File
@@ -328,10 +328,8 @@ class Overlay extends BaseObject {
*/ */
handlePositionChanged() { handlePositionChanged() {
this.updatePixelPosition(); this.updatePixelPosition();
if (this.get(Property.POSITION) && this.autoPan) {
this.performAutoPan(); this.performAutoPan();
} }
}
/** /**
* @protected * @protected
@@ -403,7 +401,7 @@ class Overlay extends BaseObject {
panIntoView(panIntoViewOptions) { panIntoView(panIntoViewOptions) {
const map = this.getMap(); const map = this.getMap();
if (!map || !map.getTargetElement()) { if (!map || !map.getTargetElement() || !this.get(Property.POSITION)) {
return; return;
} }