Perform auto-pan when adding an Overlay to a Map

* Auto-pan settings currently only activate when the position of the
   Overlay is set and the Overlay is already on a Map.

 * The consequence of this is that creating an Overlay with position
   set and then adding to a Map results in no auto-pan being performed -
   it is necessary to first create the Overlay, then add to a Map and
   finally set the position in order for the Map to auto-pan.

 * This commit changes this behaviour so that the auto-pan settings are
   also considered when the map property of the Overlay is set and not
   only when the position property is set, leading to a more intuitive
   behaviour.

 * Fixes Issue #10843
This commit is contained in:
Edward Nash
2020-04-01 06:50:01 +02:00
parent 2401e0af00
commit 2b863793d0

View File

@@ -300,6 +300,7 @@ class Overlay extends BaseObject {
} else {
container.appendChild(this.element);
}
this.performAutoPan();
}
}