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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user