Skip to content

Commit

Permalink
Stabilize OverviewMap creation with custom map
Browse files Browse the repository at this point in the history
  • Loading branch information
buehner committed Sep 9, 2021
1 parent 605014c commit 9688322
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/component/OverviewMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,11 @@ Ext.define('GeoExt.component.OverviewMap', {
initOverviewMap: function() {
var me = this;
var parentMap = me.getParentMap();
var ovMap = me.getMap();

me.getLayers().push(me.extentLayer);

if (!me.getMap()) {
if (!ovMap) {
var parentView = parentMap.getView();
var olMap = new ol.Map({
controls: new ol.Collection(),
Expand All @@ -345,6 +346,11 @@ Ext.define('GeoExt.component.OverviewMap', {
})
});
me.setMap(olMap);
} else if (ovMap.getView() && !ovMap.getView().getCenter()) {
// OL expects (any) center here.
// otherwise problems as described in
// https://github.com/geoext/geoext/issues/707 can occur
ovMap.getView().setCenter([0, 0]);
}

GeoExt.util.Layer.cascadeLayers(parentMap.getLayerGroup(),
Expand Down

0 comments on commit 9688322

Please sign in to comment.