Merge pull request #12028 from MoonE/overview-map-no-initial-target
Overview map no initial target
This commit is contained in:
@@ -1480,9 +1480,8 @@ class PluggableMap extends BaseObject {
|
||||
updateSize() {
|
||||
const targetElement = this.getTargetElement();
|
||||
|
||||
if (!targetElement) {
|
||||
this.setSize(undefined);
|
||||
} else {
|
||||
let size = undefined;
|
||||
if (targetElement) {
|
||||
const computedStyle = getComputedStyle(targetElement);
|
||||
const width =
|
||||
targetElement.offsetWidth -
|
||||
@@ -1496,15 +1495,18 @@ class PluggableMap extends BaseObject {
|
||||
parseFloat(computedStyle['paddingTop']) -
|
||||
parseFloat(computedStyle['paddingBottom']) -
|
||||
parseFloat(computedStyle['borderBottomWidth']);
|
||||
if (height === 0 || width === 0) {
|
||||
// eslint-disable-next-line
|
||||
console.warn(
|
||||
"No map visible because the map container's width or height are 0."
|
||||
);
|
||||
if (!isNaN(width) && !isNaN(height)) {
|
||||
size = [width, height];
|
||||
if (!hasArea(size)) {
|
||||
// eslint-disable-next-line
|
||||
console.warn(
|
||||
"No map visible because the map container's width or height are 0."
|
||||
);
|
||||
}
|
||||
}
|
||||
this.setSize([width, height]);
|
||||
}
|
||||
|
||||
this.setSize(size);
|
||||
this.updateViewportSize_();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user