From 2b863793d0ba70d570966bb6436cbd9b2e43a5a4 Mon Sep 17 00:00:00 2001 From: Edward Nash Date: Wed, 1 Apr 2020 06:50:01 +0200 Subject: [PATCH] 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 --- src/ol/Overlay.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ol/Overlay.js b/src/ol/Overlay.js index b0025d08d8..c99aea8452 100644 --- a/src/ol/Overlay.js +++ b/src/ol/Overlay.js @@ -300,6 +300,7 @@ class Overlay extends BaseObject { } else { container.appendChild(this.element); } + this.performAutoPan(); } }